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.