Sign in to follow this  
Followers 0
kwikshere

Newbie seeks guidance

5 posts in this topic

Greetings all,

I have joined the forum as a newbie in the hope of learning/teaching myself how to use this wonderful and potentially powerful tool called 'AutoIt'.

I have taken a 'look around' in some of the forums but it seems there aren't many people as dense as I am because I can't see the answer to my initial query anywhere (maybe I need more practice with the 'search' function). :)

My question/problem is, I think, a comparatively simple one.

I intend using AutoIt to 'script' the installation of a number of applications. Initially this will be used only on my own computer but, if successful, I may also use it at work (I am a casual I.T. Tutor - mainly to 'Intro to Computer' type classes.).

My problem is this:

All examples I have found in tutorials etc seem to show the 'Script' in the same folder as the application with which you are working (Is this neccessary?) so I created a folder called 'AutoIt Projects' off the root directory then copied the applications I will be working with into it.

I then started an experimental script (within that folder) as a 'first step' to install "IzArc" - See below. I chose this program because I see it as a fairly basic install (at least when using slow old 'mouse clicks'). Darn it... do you think I can get it to even complile let alone run cleanly?

I'd really appreciate some guidance on just what obvious point I have missed.

##################################################

Sample Script

##################################################

Run ("IZArc_Setup.exe")

;Wait for the Install window to become active

WinWaitActive ("Open File - Security Warning")

;Approve Installation Continuing

Send("!R")

;Wait For Setup Window To Become Active

WinWaitActive ("Setup - IZArc 3.7")

;Initiate The Setup

Send("!N")

;Agree To EULA

Send("!A")

;Proceed With Setup&Decline Donation

Send("!N" 2)

;Accept Default Install Location

Send("!N")

;Accept Start Menu Folder

Send("!N")

;Skip Additional Tasks And Proceed

Send("!N")

;Final Approval For Install

Send("!I")

;Accept Default Language

Send("!O")

;Wait For Options Window To Become Active

WinWaitActive ("Options")

;Accept All File Associations'

ControlClick("Options", "OK", 263152)

;Wait For Setup Window To Become Active

WinWaitActive ("Setup - IZArc 3.7")

;Decline Whats New'

ControlClick("Setup - IZArc 3.7", "", 721628)

;Complete Setup Process

Send("!F")

#################################################

End of sample script

#################################################

P.S. If I have made any errors in my choice of thread or 'posting' methodology, please let me know so I can avoid any repetition in future.

Share this post


Link to post
Share on other sites



Welcome to the board. :-) When posting code, try to include it inside a code, codebox, or autoit tags, so it looks formatted like below. Click on the BB Code help for more information.

I threw together a quick little installer for izarc. It's a bit ugly, but it should work and is just to give you some ideas. It's probably preferably to use Control commands where possible, incase the user switches windows during the install process, either purposely or by accident, with control commands it won't interrupt your script. I put a ton of sleep(1000)'s in to make it go slow. It will still work if you take them all out. It's not necessary for the script to be in the same folder as the app you are working with. Depending on the functions you use, just make sure you are using full or relative paths. I put the installer for Izarc in c:\temp, and ran the script from my desktop.

#Include <GuiListBox.au3>

opt("WinTitleMatchMode",2)

Run("C:\Temp\IZArc_Setup.exe")
If WinActive("Security Warning") Then
    ControlClick("Security Warning","","Button1")
EndIf

WinWaitActive("Setup - IZArc 3.81")
ControlClick("Setup - IZArc 3.81","","TButton1")
Sleep(1000)
WinWaitActive("Setup - IZArc 3.81")
ControlClick("Setup - IZArc 3.81","","TRadioButton1")
Sleep(1000)
ControlClick("Setup - IZArc 3.81","","TButton2")
Sleep(1000)
ControlClick("Setup - IZArc 3.81","","TButton3")
Sleep(1000)
ControlClick("Setup - IZArc 3.81","","TButton4")
Sleep(1000)
ControlClick("Setup - IZArc 3.81","","TNewCheckListBox1")
Sleep(1000)
ControlClick("Setup - IZArc 3.81","","TButton4")
Sleep(1000)
ControlClick("Setup - IZArc 3.81","","TButton4")

opt("WinTitleMatchMode",1)
WinWaitActive("IZArc")
ControlCommand("IZArc","","TListBox1","SelectString","English")
Sleep(1000)
ControlClick("IZArc","","TButton1")
Sleep(1000)
$ListBox = ControlGetHandle("Options","","TCheckListBox1")
;Click on .RAR
ControlClick("Options","","TCheckListBox1","Left",1,93,189)
Sleep(1000)
;Click on .BIN
ControlClick("Options","","TCheckListBox1","Left",1,11, 107)
Sleep(1000)
;Click on .ISO
ControlClick("Options","","TCheckListBox1","Left",1,93, 8)
Sleep(1000)

Do 
    ControlCommand("Options","","TPageControl1","TabLeft","")
    Sleep(1000)
Until ControlCommand("Options","","TPageControl1","CurrentTab","") = 2

ControlClick("Options","","TCheckBox1")
Sleep(1000)

Do 
    ControlCommand("Options","","TPageControl1","TabRight","")
    Sleep(1000)
Until ControlCommand("Options","","TPageControl1","CurrentTab","") = 6

ControlSetText("Options","","TEdit2","Wordpad")
Sleep(1000)
ControlClick("Options","","TButton3")
Sleep(1000)

WinWaitActive("Setup - IZArc 3.81")
ControlClick("Setup - IZArc 3.81","","TButton4")

Share this post


Link to post
Share on other sites

Greetings all,

I have joined the forum as a newbie in the hope of learning/teaching myself

Welcome to AutoIt. :)

All examples I have found in tutorials etc seem to show the 'Script' in the same folder as the application with which you are working (Is this neccessary?) so I created a folder called 'AutoIt Projects' off the root directory then copied the applications I will be working with into it.

No, that is not required or desired. Just provide the full path to any files you need to reference, and they can be anywhere, including on a network share.

I then started an experimental script (within that folder) as a 'first step' to install "IzArc" - See below. I chose this program because I see it as a fairly basic install (at least when using slow old 'mouse clicks'). Darn it... do you think I can get it to even complile let alone run cleanly?

I'd really appreciate some guidance on just what obvious point I have missed.

The first thing you missed is using SciTE. Although it is possible to write AutoIt scripts in notepad, that is very much the hard way! Download SciTE (SciTE4AutoIt3.exe) and use it for all your AutoIt scripting. Context highlighting, syntax prompting, Tidy, and syntax check are all there to help you with your scripts.

Also, when you post code on the forum, put it inside "codebox" tags. That makes it easier to read and preserves indentation.

##################################################

Sample Script

##################################################

The comment character for AutoIt is a semicolon, not pound sign.

CODE
Run ("IZArc_Setup.exe")

;Wait for the Install window to become active

WinWaitActive ("Open File - Security Warning")

;Approve Installation Continuing

Send("!R")

;Wait For Setup Window To Become Active

WinWaitActive ("Setup - IZArc 3.7")

;Initiate The Setup

Send("!N")

;Agree To EULA

Send("!A")

;Proceed With Setup&Decline Donation

Send("!N" 2)

;Accept Default Install Location

Send("!N")

;Accept Start Menu Folder

Send("!N")

;Skip Additional Tasks And Proceed

Send("!N")

;Final Approval For Install

Send("!I")

;Accept Default Language

Send("!O")

;Wait For Options Window To Become Active

WinWaitActive ("Options")

;Accept All File Associations'

ControlClick("Options", "OK", 263152)

;Wait For Setup Window To Become Active

WinWaitActive ("Setup - IZArc 3.7")

;Decline Whats New'

ControlClick("Setup - IZArc 3.7", "", 721628)

;Complete Setup Process

Send("!F")


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

In my opinion you are over complicating it. From experience, if you preset a window that is clickable, users will click on it and totally screw up the deployment, plus if you get an updated version, it may not have the same install window as a previous one and you will have to redo all your mouseclicks.

Unless you have no option you should always run it unattended or silent.

$done = runwait ("IZArc_Setup.exe /silent")
msgbox(0,"","exit code = "& $done)

Share this post


Link to post
Share on other sites

Greetings all,

Wow! :)

I am VERY impressed by the quality and nature of the assistance you all offered.

Thank you all so much.

I believe that I now have a chance to get this process moving again.

I will avoid the posting errors you highlighted in any future posts (and I'm sure there will be more questions...lol).

Again... Thank you all.

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  
Followers 0