Jump to content

AutoIT Guide


Recommended Posts

I have searched through hundreds of scripts and posts and I am struggling with AutoIT. Can someone please help me with the last few pieces with regards to "running" the scripts during UA install using RunOnceEx method. Or point me to a post as I cannot find one at all that covers this topic, sorry. Also the help files within AutoIT don't cover running scripts from U/A CD's.

I can write a crude working script through reading these help files, and I can compile this script into an .exe but what I want to know is:

1]Where does the compiled .exe go? In the $OEM$\$1\Install\Apps\ProgName folder?

2]Are any switches necessary?

3]Does the <progname>setup.exe or .msi that you are calling go in same folder too?

4]Does the path at start of your script have to relate to where the setup.exe is during install stage? i.e. on the harddrive?

I can successfully launch an AutoIT .exe from within Windows and install a test app, but as soon as I try anything with RunOnceEx it goes pearshaped. It normally says "error in line <whatever>".

Link to comment
Share on other sites


Can post if you want, but it is not the scripts that are causing issue. Its how to IMPLEMENT the scripts thru RunOnceEx that is the problem.

Have also use other peoples scripts from the STICKY post in the MSFN Apps forum and they dont work for me either because of what I'm doing with them. The scripts are fine.

Link to comment
Share on other sites

Please no double posting.

1) Normally next to the application installation file. I use the following code to test if the file is there and if so install other wise exit.

; Execute Installer

If FileExists ( @ScriptDir & "\GetRight_6.0.exe" ) Then

Run ( @ScriptDir & "\GetRight_6.0.exe" )

Else

Exit

EndIf

Now as for where on disk, every thing goes...well since I don't see the need to copy stuff to disk I just run from the CD, so the application would be located at some thing like "Software\Internet\GetRight" from the root of the CD. I use a custom AutoIt script to replace the RunOnce batch script...but there are dozens of threads on how to launch applications from the UA CD.

2) No

3) No, but refer to 1)

4) it may...not sure since I always use the @ScriptDir macro to set pathing information...that is if your talking AutoIt...if your talking about the RunOnce batch...then yes it does require full pathing info.

Link to comment
Share on other sites

Are you putting the compiled scriptin the same folder as the prog. it is supposed to install?

It is easiest to not specify a path to the program in the script. just call it. The compiled script will search for it it the same folder it is in.

So in the runonce all you have to do is give the path to the compiled script. ( no switches you are replacing switches with auto-it )

Link to comment
Share on other sites

@nujackk

Are you putting the compiled scriptin the same folder as the prog. it is supposed to install?

Yes. Au3 file converted to .exe file in same folder as app I'm trying to install. So I can just call <au3-converted-to-exe> in my RunOnceEx without any switches? And the first line of my script doesn't need to have ANY path in it? Have I finally understood this correctly?

Cant find this info anywhere on forum. Thousands of scripts, yes, but not found anything on their implementation of any use to me.

Perhaps if some guidelines were "Stickied" it wouldn't make AutoIt so scary to use as I've shyed away fro it for ages. Not because of the commands because the Help files are superb from within the app, but because of how to use the app in conjunction with RunOnceEx.

Thanks nologic for all your help, too.

Link to comment
Share on other sites

@nujackk
Are you putting the compiled scriptin the same folder as the prog. it is supposed to install?

Yes. Au3 file converted to .exe file in same folder as app I'm trying to install. So I can just call <au3-converted-to-exe> in my RunOnceEx without any switches? And the first line of my script doesn't need to have ANY path in it? Have I finally understood this correctly?

Cant find this info anywhere on forum. Thousands of scripts, yes, but not found anything on their implementation of any use to me.

Perhaps if some guidelines were "Stickied" it wouldn't make AutoIt so scary to use as I've shyed away fro it for ages. Not because of the commands because the Help files are superb from within the app, but because of how to use the app in conjunction with RunOnceEx.

Thanks nologic for all your help, too.

Using Autoit during the RunOnceEx period is the same as using it on the desktop. Only difference that I have found, is you may need to use WinClose() twice, instead of once, on a open window.

Look in the Autoit helpfile for Tutorials -> WinZip Installation. Everything in it relates to making a script for desktop use or RunOnceEx. The last line of it, you can do twice for RunOnceEx. e.g:

WinClose("WinZip (Evaluation Version)")
WinClose("WinZip (Evaluation Version)")

Or you can use a loop for WinClose()

Example to try 5 times to close it:

For $i = 1 to 5
WinClose("WinZip (Evaluation Version)")
If Not WinExists("WinZip (Evaluation Version)") Then Exitloop
Sleep(1000)
Next

The help is there in the manual. With the first line, is fine to use.

Run("winzip90.exe")

If you want Autoit to only search for the file in the directory, rather then the directory and the system path, then you could use:

Run(@ScriptDir & "\winzip90.exe")

@ScriptDir is the current directory, of the script/compiled exe.

AutoIt has a excellent helpfile. People who read this Helpfile fully, are the one's who will succeed with AutoIt. I know it is hard to first start out with any programming language, but we all have to endure it to enjoy the experience of the benefits.

Yours sincerely,

Another AutoIt fanatic :D

Link to comment
Share on other sites

@Mhz

AutoIt has a excellent helpfile...

True, and thanks to it even I have managed to create some "crude" working scripts that run fine - (no, effectively!) - from within Win envir.

Its just my 100% failure rate from within RunOnceEx that has daunted me. :}

Link to comment
Share on other sites

@Mhz
AutoIt has a excellent helpfile...

True, and thanks to it even I have managed to create some "crude" working scripts that run fine - (no, effectively!) - from within Win envir.

Its just my 100% failure rate from within RunOnceEx that has daunted me. :}

Since you have mentioned line errors. Hopefully you are using a editor that has the tools on board, to help you with your code. Scite4AutoIt3 is a nice editor for creating AutoIt scripts. It has in it's Toolbar, a Tools dropdown, which contains SyntaxCheck. This will validate your lines of code. It also has a program called AutoItMacroGenerator. This tool creates a draft install script for you. Plus all the other tools onboard. If you are not using an editor like Scite4AutoIt3, then you are just making life hard for yourself.

Link to comment
Share on other sites

I think I know exactly what you are talking about, well maybe.

If you are trying to install an MSI file I have had the same problem.

First you can use

run("myfile.msi")

The path I THINK is run("msiexec /i myfile.msi")

That has worked when I'm in windows, but when I install from RunOnceEx it gets an error.

Link to comment
Share on other sites

I think I know exactly what you are talking about, well maybe.

If you are trying to install an MSI file I have had the same problem.

First you can use

run("myfile.msi")

The path I THINK is run("msiexec /i myfile.msi")

That has worked when I'm in windows, but when I install from RunOnceEx it gets an error.

run("myfile.msi") does not work at all.

You need to call msiexec or use @ComSpec to run it.

run("msiexec /i myfile.msi")

You are calling msiexec, which is in the system directory. How is msiexec, supposed to know, where to look for myfile.msi, unless you specify it. You are lucky when this runs in a Win32 environment, as you are only feeding msiexec a filename, with no address.

You should specify:

Run(@SystemDir & '\msiexec /i "' & @ScriptDir & '\myfile.msi"')
Run(@ComSpec & ' /c "' & @ScriptDir & '\myfile.msi"', '', @SW_HIDE)

You could probably, get away without using @SystemDir, as the system path should be available for msiexec location.

Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...