AutoIt v3 - getting your laptop ready quickly

Joined
Dec 9, 2003
Messages
4,839
Location
Oklahoma
I downloaded a program called AutoIt last year on a recommendation (that I thought I came across on ST, but didn't find it on a quick search), but only now have I gotten around to trying to learn the script language. The program (which is free, FWIW) is basically a scripting environment that is designed to automate tasks on Windows PCs.

It took me about 2 hours of messing around (mostly, looking through the online manual to find the functions I needed, etc.) to significantly simplify the task of getting my laptop ready for a chase. Whereas I've (up until now) had to launch each program one by one, and setup each program individually, I've now written a script that will do all of this solely by double-clicking it (AutoIt comes with a compiler if you want to take the automation script, as an *.exe, to another PC). More specifically, double-clicking the script on my desktop launches GpsGate (and starts the GPS), opens GR3 (and starts GR3's GPS tracking), opens ManyCam, opens iMap Tracker (and starts the tracking), opens Flash Media Encoder (and connects to the server and starts streaming), opens Street Atlas (and starts GPS logging), and opens Spotter Network (and sets my status as "active"). Again, it's not like this used to take a ridiculously long time to do separately, but it's not something I enjoyed having to fool around with when I would rather have been watching radar, forecasting, checking data, etc.

Rereading this, I guess it sounds a little bit like an ad, but I have no interest in AutoIt in terms of the developer, etc. I do think, however, that it may be useful to other chasers who are probably in the same boat as I was/am in terms of having to handle 5-7 different chasing-related apps.
 
I used AutoIt to automatically install software and drivers when I used to sell laptops on eBay. It's an excellent program with a powerful scripting language but I never thought about using it to get the chasing apps ready. Much better than Windows batch files. Great idea!!
 
This might be exactly what I've been looking for. I'm primarily a Linux user, and I'm spoiled by how easily tasks are automated with Cron and the like. Doing the same in Windows 7/XP has proven to be a challenge, and I've been fighting with batch files for some time. I'll start tinkering with this as soon as my new laptop arrives Monday!
 
hmmm, I wonder if I can automate my Expressions encoder to automatically reconnect when it drops.
 
A few years ago I build a homemade DVR out a spare computer. I was using BeyondTV as the DVR software, and someone on their forums put together some really cool post-processing scripts that would mark and cut the commercials from programs then re-encode them into smaller files in Divx of Xvid format. AutoIT was the automation program used. Most of the scripting was already done, but I had to learn quite a bit of it, so I could customize it exactly the way I wanted it.

I haven't used it in quite a few years, but I might have to dig it back out now.
 
This is interesting.....I've never written any script and I wouldn't do anything more advanced than what you are doing Jeff. I may just give this a try...

Jeff....could you post some of your script as an example to go by? I have some other things (such as NWSchat) that I have to fire up along the way, but being able to have a visual tool might be useful.
 
Last edited by a moderator:
Jeff....could you post some of your script as an example to go by? I

Didn't see this until now...

Sure. Note that I setup StreetAtlas to start up the GPS when the program starts (it's an option in the GPS options), but you should be able to relatively easily select the correct tab, then have it click "start gps" if you don't want SA to auto-start the GPS.

Below is my script -- certainly more room for optimization, but it does what I need it to do. I'll put it in the QUOTE tag since the CODE tag results in a window that's relatively narrow (so you have to pan right/left to go through the code). As an unfortunate side effect, however, the use of the "quote" tag doesn't seem to like multiple spaces, which means that the IF/THEN "loops" don't show up too well.

Oh yeah, the "AutoIt Window Info" program can be a great tool when you're writing the scripts. Read the documentation online about using the tool, which lets you identify the command names, etc.

AutoItSetOption("WinTitleMatchMode", 2)

$gpsconnected = MsgBox( 65, "Start GPS", "Make sure that the GPS is plugged into the computer")
If $gpsconnected == 2 Then
Exit ; stop the script if the user click "Cancel"
Else
ControlClick("[CLASS:Shell_TrayWnd]","","[CLASSNN:TrayShowDesktopButtonWClass1]")

Run("c:\program files (x86)\Franson\GpsGate 2.0\GpsGateXP.exe") ; start GpsGate, which is set to open the COM port automatically

$grexists = WinExists("[CLASS:GRLevel3]")
If $grexists == 0 Then
Run("d:\GRLevelX\GRLevel3\grlevel3.exe") ; only start GR3 if there isn't another instance open
sleep(2000)
ControlClick("[CLASS:GRLevel3]","","[CLASSNN:Button12]") ; click in the radar area to bring focus to GR3
Send("!F") ; This and the next three commands start the GPS in GR3
Send("G")
Send("S")
Send("{ENTER}")
sleep(500)

Run("d:\Delorme\Street Atlas USA 2009\SA2009.exe") ; SA is set to start automatically the GPS
WinWaitActive("DeLorme Street Atlas USA® 2009 - default")

Run("C:\Program Files (x86)\ManyCam 2.4\ManyCam.exe")
Sleep(1500)
$webcamconsole_exists=WinExists("Dell Webcam Console")
If $webcamconsole_exists == 1 Then
WinActivate("Dell Webcam Console")
ControlClick("Dell Webcam Console","","[CLASSNN:Button2]") ; close the console
EndIf

Run("C:\Program Files (x86)\iMap Tracker\iMapTracker.exe")
WinWaitActive("iMap Tracker")
ControlClick("iMap Tracker","","[NAME:buttonStart]") ; "Start" tracking/transmitting

Run("C:\Program Files (x86)\Adobe\Flash Media Live Encoder 3\FlashMediaLiveEncoder.exe")
WinWaitActive("Adobe")
sleep(3000)
ControlClick("Adobe","","[CLASSNN:Button3]") ; "Start" streaming
sleep(2000)
WinSetState("Adobe","",@SW_MINIMIZE) ; minimize Live Encoder

Run("C:\Program Files (x86)\SpotterNetwork\spotternetwork.exe")
WinWaitActive("[CLASS:ThunderRT6FormDC]")
ControlClick("Spotter Network","","[CLASSNN:ThunderRT6CommandButton5]") ; change status to "Active"
WinClose("Spotter Network") ; SN minimizes to the system tray when closed
EndIf
 
Does one have to learn every command of the scripting language, or can you go through the montions that you want automated with your mouse and it will automatically code it for you? Hope that question makes sense.
 
I have done this in the past too with AutoIT. It's great to click a button on the road after your laptop flakes out and crashes, and bring everything up, enable the GPSs, etc. Currently using it with GRLevel3, Street Atlas, and Spotter Network.
 
Back
Top