Create A Freaky Possessed Computer With Windows Script For Halloween

Ryan Dube 28-10-2011

typing ghostThere are a lot of fun pranks you can play on your friends with a computer. You’ve probably seen all of those creepy YouTube videos 14 Most Popular YouTube Pranks You Can Play on Your Friends Want to pull a good-natured prank on your friends, family, and colleagues? Here are some of the best prank ideas on YouTube. Read More that people forward to each other for a good scare. Not long ago, Justin covered a few really funny ways to prank your parents 4 Funny Ways to Prank Your Parents With the Family Computer Read More with a computer too. All of those ideas are fun, but this year, how about creeping out your friends a bit with your very own programming skill?


In this article, I’m going to show you how you can create your own little Windows script that will run on just about any modern Windows computer. All you have to do is open up Notepad, type up this script, save it as a .wsf file and then have your friends open up the file. The script will automatically open up Notepad and then start typing – complete with typewriter sound effects – just like the computer itself is possessed by a typing ghost.

The real beauty of this little script is how creative you are with launching it. Insert it into the computer’s startup folder so it launches when the computer starts, or replace one of their favorite desktop shortcuts to link to your file instead of their application!

Scripting A Possessed Typing Computer

The idea for this came from an experience at college, when I walked past a professor’s office and saw that he had an old DOS computer that was typing all by itself. He was a Computer Science professor, and he’d clearly written a DOS program that could type all by itself, complete with sound effects, pauses and everything. Very authentic. In this article, you’re going to do the same thing, just with Windows and using VB Script to accomplish the job. I’ll walk you through the process.

First step – download a typewriter WAV file from any of your favorite free WAV file websites SoundBible: Free To Download MP3 & WAV Sounds Read More .

typing ghost


Preferably download one that lasts from 30 seconds to a minute, depending on how much text you want your phantom app to type on the screen by itself. Save the file to c:/windows/Media/ with the rest of the Windows sound files so it’ll be easy to find later.

Create A Freaky Possessed Computer With Windows Script For Halloween typing2

Next, open up a text file and save it as a .wsf file. In my case I called it “phantomtype.wsf“. Declare all of the required variables, set up your text file link and then type the text that you want your typing ghost app to type on the screen.


<script language="VBScript">
Option Explicit
On Error Resume Next

Dim NoteShell
Dim SoundShell
Dim strText
Dim intTextLen
Dim x
Dim intPause
Dim strTempText

strSoundFile = "C:\Windows\Media\typewriter1.wav"

strText = "Hello. My name is Ryan. I have possessed your computer
and there is nothing you can do about it. Of course, I suppose you
can always close the window if you want to, but that wouldn't be any fun!"


Pretty simple so far right? The two “Shell” variables are basically the shell commands that are going to launch Notepad and your sound file. The phantom typing will come from your script sending keystrokes to the Notepad app behind the scenes. Accomplishing that is easy – you just use “CreateObject” to set up your two application objects, and then launch each app, waiting a tiny bit between each launch.


Set NoteShell = CreateObject("WScript.Shell")
Set SoundShell = CreateObject("Wscript.Shell")

NoteShell.Run "notepad"
WScript.Sleep 1000

SoundShell.Run "C:\Windows\Media\typewriter1.wav", 0, True
WScript.Sleep 500


Now, the victim will see Notepad pop up on the screen, and after a second, the typewriter typing sound will start. At that moment, you will start sending ghostly text to the screen, just like someone is sitting there typing. Here’s how that part works.


intTextLen = Len(strText)
intPause = 100

For x = 1 to intTextLen
	strTempText = Mid(strText,x,1)
	NoteShell.SendKeys strTempText

	WScript.Sleep intPause

	If intPause <= 500 Then
		intPause = intPause + 100
		intPause = 100
	End If

This may look complicated, but don’t worry, it’s not at all. The first line checks the length of the long string of text that you typed up at the start of this program. That’s the text that you want to magically appear – one letter at a time – on the screen. The next line creates a starting pause (a tenth of a second) between each typed letter.


The For loop that you see below that basically starts at position 1, extracts a single letter from your text, sends that letter to Notepad, and then waits a little bit before moving forward to the next letter in your text. Pretty cool huh?

And to keep things authentic, the little “IF” statement keeps adding and subtracting pause time between typed letters to make the whole thing look really authentic, like someone is sitting right there typing.

Now close up the script.


Save the file again – making sure you’ve got the “wsf” extension – and you’re done. Double click the file and check out your haunted computer!

Here’s my script in action (I wish you could hear the typing sounds, it’s a riot!)

typing ghost

Like most programs, it could use a little perfecting if you’re up to it. The sound file needs to match the amount of time it takes for the typing to finish. Or, you could loop both the typing and the sound, but you’ll need to come up with a way to let the person close the typing ghost application. If you don’t, the “sendkeys” will just continue typing no matter what window they open…which, is actually a pretty funny virus-like behavior, but not something that I would recommend you do to your friends.

So give this creepy little script a try and let us know what your friends thought about it. Did you come up with any other ways to perfect it? Share your thoughts in the comments section below.

Image Credit : Shutterstock

Related topics: Halloween, Programming, Visual Basic Programming.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Sue
    November 2, 2011 at 2:18 am

    Got it working with a little editing, but exhibits the following behavior. If you close notepad and open another application, the characters will resume typing in your search bar or IM application for example. Also the media player has focus instead of notepad. Needs a little work, but fun.

  2. John Aylsworth
    November 2, 2011 at 1:37 am

    I experimented with modifying your script to allow looping the keystroke sound effect and preventing the shell from sending keystrokes to applications other than notepad, but I ran into all kinds of problems e.g. the user can't close Notepad because the shell continues to send keystrokes into the "Save As" dialog. 

    I decided it would be better to simply run the keystrokes and the audio all inside Internet Explorer.  While I was at it, I rewrote the whole thing in Javascript.  Now it's more of a web application than a haunted computer, but you can still turn it into a prank with a shortcut.  Just create a batch file with this:

    @echo off
    start /d "C:Program FilesInternet Explorer" IEXPLORE.EXE [Broken URL Removed]

    Save it somewhere like the home directory, then create a shortcut on the Desktop named as your victim's favorite web browser (or whatever) and make your batch file the target of the shortcut.  You'll also want to change the shortcut's icon to complete the disguise.  Then when your victim double-clicks on the shortcut, they'll be directed to the haunted webpage in Internet Explorer:

    [Broken URL Removed]

  3. Ryan Dube
    October 29, 2011 at 2:02 pm

    Hey everyone - sorry about the question marks...something happen between writing and publishing where spaces got filled with questions marks. I'll get those removed.

  4. Me
    October 29, 2011 at 4:20 am

    I got it working....and sorry for all those script kiddies out there who doesn't know how to program...HAHA :D

  5. Oloan
    October 28, 2011 at 7:45 pm

    I got the same problem. I have no the solution yet. T_T'

  6. Mindlesslessfreak2000
    October 28, 2011 at 7:20 pm

    Well now it seems to work thanks jrmbtr easiest way to replace all the ? with spaces is to copy and past it into a word doc, Hit ctrl F, and then go to replace Find what: put a ? Replace With: and just put a space. Much easier than manually replacing the ? marks.

  7. Mindlesslessfreak2000
    October 28, 2011 at 5:38 pm

    Removing the ? played the .wav and opened up a notepad, but unfortunately it didn't type anything.

  8. jrmbtr
    October 28, 2011 at 5:15 pm

    Try removing the question marks. It seem they indicate spaces.

  9. Higs_isle
    October 28, 2011 at 4:47 pm

    Line: 2
    Char: 9
    Error: Unexpected character
    Code: 80040001
    Source: Windows Script Host

    Don't know what's wrong, I'ved copied and pasted verbatim but error came.

  10. Mindlesslessfreak2000
    October 28, 2011 at 4:31 pm

    I got an error that says
    Error: Unexpected character
    Source: Windows Script Host