SurfaceTension Posted September 9, 2010 Share Posted September 9, 2010 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.79test.au3 Link to comment Share on other sites More sharing options...
wakillon Posted September 9, 2010 Share Posted September 9, 2010 There is an winamp.au3see this post, it can be helpfull ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
zorphnog Posted September 9, 2010 Share Posted September 9, 2010 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 ... ... Link to comment Share on other sites More sharing options...
SurfaceTension Posted September 9, 2010 Author Share Posted September 9, 2010 (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 September 9, 2010 by SurfaceTension Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now