AutoIt vs. VBScript.

I’ve been playing around with AutoIt and think it’s going to come in very handy at the office where I work. I’m finding it easier to learn than VBScript, in fact, way easier. I’m already making AutoIt scripts to replace the ones I made with VBScript. For example, here’s a VBScript I made a while back that retrieves the contents of the clipboard and then writes it to a file with the computer name as the name of that file along with the string “_cb”.

DIM fso, MFile
Set objNetwork = CreateObject(“Wscript.Network”)
strComputer = objNetwork.ComputerName

Set objHTML = CreateObject(“htmlfile”)
ClipboardText = objHTML.ParentWindow.ClipboardData.GetData(“text”)

Set fso = CreateObject(“Scripting.FileSystemObject”)
Set MFile = fso.CreateTextFile(strComputer & “_cb.txt”, True)
MFile.WriteLine(ClipboardText)
MFile.Close

And now here’s an AutoIt script that does the exact same thing:

$file=@ComputerName & “_cb.txt”
$clipboard = ClipGet()
FileOpen ($file, 2)
FileWrite($file, $clipboard)
FileClose ($file)

Pretty impressive, huh? The AutoIt script is much more straightforward and easier to read.
I’ve yet to see if AutoIt can replace some of the more advanced VBScripts I’ve made but so far it’s been a smooth ride.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s