Jump to content
Sign in to follow this  
BigRedEO

Can't get AutoIt Script to run properly after creating with Au3Record.exe

Recommended Posts

BigRedEO

Am trying to use AutoIt for the very first time. Tried using the record function to create a script to run an .exe install for OpenSSH. I will need to send this out to about 325 remote computers. The .exe for OpenSSH will not run silently with any switches, hence my need for AutoIt.

Here are the problems I ran into so far. AutoIt3 was installed by someone else years ago. These are on Windows XP systems (that will be upgraded to Windows 7 later this year, but in the meantime...). Just trying to run Au3Record.exe gave me a message that MSVCR100.DLL was missing. So I found I had to install Microsoft C++ Redistributable. Did so. Used Au3.Record.exe to record my running this install. Saved it as OpenSSHInstall.Au3. Tried to run it and got this message:

Line 16 AU3RecordSetup() ^ERROR Error: Unknown function name

Found that was because the record script creates the function with an underscore at the begnning of the name, yet doesn't put in the underscore in the actual function (someone please explain to me why that would be??). So I opened the Au3 script in SciTe and put the underscore in the function name. But then the system still doesn't recognize the Au3 script, so I had to tell it to open it with AutoIt3.exe (at least I hope that is what I was supposed to do). So that's one problem I'm running into - even though I've saved my script on a flash drive after using AutoIt3.exe ro run the script, when I try running it on other test PCs, I get the message that Windows can't run the script and needs to know what program I want to use to run it, which I won't be able to do remotely (these PCs will be updated via a batch script). And even then, when I try to run the Au3 script, it gets as far as doing the uninstall of the old version of Open SSH, but then stops before it's supposed to click on "Finish" to go on to the install of Open SSH 6.1. Any help anyone could give me would be greatly appreciated.

Here is the Au3 script created by the record:

#region ---Au3Recorder generated code Start (v3.3.7.0) ---

#region --- Internal functions Au3Recorder Start ---

Func _Au3RecordSetup()

Opt('WinWaitDelay',100)

Opt('WinDetectHiddenText',1)

Opt('MouseCoordMode',0)

EndFunc

Func _WinWaitActivate($title,$text,$timeout=0)

WinWait($title,$text,$timeout)

If Not WinActive($title,$text) Then WinActivate($title,$text)

WinWaitActive($title,$text,$timeout)

EndFunc

_AU3RecordSetup()

#endregion --- Internal functions Au3Recorder End ---

Run('C:\setupssh-6.1p1.exe')

_WinWaitActivate("OpenSSH for Windows 6.1p1 Setup","")

MouseClick("left",200,104,1)

_WinWaitActivate("OpenSSH for Windows 3.8.1p1-1 Uninstall","")

MouseClick("left",367,370,1)

_WinWaitActivate("OpenSSH for Windows 3.8.1p1-1 Uninstall ","")

MouseClick("left",367,370,1)

MouseClick("left",360,368,1)

_WinWaitActivate("OpenSSH for Windows 6.1p1 Setup","")

MouseClick("left",360,368,1)

_WinWaitActivate("OpenSSH for Windows 6.1p1 Setup ","")

MouseClick("left",30,303,1)

MouseClick("left",367,365,1)

MouseClick("left",367,365,1)

MouseClick("left",367,365,1)

MouseClick("left",367,365,1)

_WinWaitActivate("Install under Local System or SSHD_Server account","")

MouseClick("left",367,365,1)

_WinWaitActivate("Select port for SSHD listener daemon","")

MouseClick("left",357,364,1)

_WinWaitActivate("Setup Priviledge Seperation","")

MouseClick("left",356,364,1)

_WinWaitActivate("OpenSSH for Windows 6.1p1 Setup ","")

MouseClick("left",356,364,1)

#endregion --- Au3Recorder generated code End ---

Share this post


Link to post
Share on other sites
BigRedEO

PS - I did find that once I clicked on the "Finish" button after the Uninstall portion was done, the script continued on and did the rest of the OpenSSH installation on its own.

THANK YOU.

Share this post


Link to post
Share on other sites
BigRedEO

Never mind - I at least figured out a command line call - C:AutoIt3.exe OpenSSHInstall.Au3 And I'm finding that the recorder isn't always reliable - had to make sure I checked "Record Window Text" before it captured every move.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.