Sign in to follow this  
Followers 0
SurfaceTension

Noob GUI question

4 posts in this topic

Hi everyone. I'm new here so i hope not posting in wrong forum, but i have a little problem. Hope you be able to understand my bad english ;)

First and may be most important, this is my first try with AutoIT so please do not laugh to much on my stupidity. Ok let's go to the point.

I decided to create a simple GUI with buttons for automation of some installations that i often need to do on my clients computers. When i run the scritp and click a button (Winamp for example, witch after some "if" invokes Run("Winamp.exe") command) everything goes ok, it presses the nessesery button an mark/unmark desired check boxes, but if something goes wrong (for example Winamp.exe is not in the current directory or with different name), nothing happens, script just stops and none of the other buttons work, and the only way to close the script and run it again is to right-click on the icon in tray and press exit. I know this is normal, if there is no Winamp.exe the Run() command has nothing to run, thus giving an error, but why other buttons not working efter that (until restart of the script) even if the needed installation files are present and with correct names?

The .au3 file is attached to the post. Version used is AutoIT 3.3.6.1 and SciTE 1.79

test.au3

Share this post


Link to post
Share on other sites



There is an winamp.au3

see this post, it can be helpfull ! Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

You need to exit the button functions if the file is not there using the Return command.

For example:

Func button1()
    If not FileExists("Winamp.exe") Then
        MsgBox(0, "", "No such file Winamp")
        Return
    EndIf
    If FileExists("C:\Program Files\Winamp\Winamp.exe") Then
        MsgBox(0, "", "Winamp is installed")
        Return
    EndIf
    ...
    ...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You need to exit the button functions if the file is not there using the Return command.

For example:

Func button1()
    If not FileExists("Winamp.exe") Then
        MsgBox(0, "", "No such file Winamp")
        Return
    EndIf
    If FileExists("C:\Program Files\Winamp\Winamp.exe") Then
        MsgBox(0, "", "Winamp is installed")
        Return
    EndIf
    ...
    ...

Thank you guys for quick replays. I will try that Return command, and post the result as soon as possible ;) Edited by SurfaceTension

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