apache Posted April 7, 2009 Share Posted April 7, 2009 hi there, i wana use if then, else if statement. i put this If ProcessExists (help.Exe) Then MsgBox(4096,"", "Value might be hexadecimal!") Else ShellExecute ("help.exe") EndIf simply i want my application to do nothing if the help.exe in alredy opened, but it uses condition MsgBox(4096,"", "Value might be hexadecimal!"). please tell me how i can fix it. Link to comment Share on other sites More sharing options...
Skruge Posted April 7, 2009 Share Posted April 7, 2009 If you don't want it to do anything under one condition, then you don't need an else. If Not ProcessExists("help.exe") then ShellExecute("help.exe") [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
apache Posted April 7, 2009 Author Share Posted April 7, 2009 actually if the help file is already opened, it should not do anything. and if not opened then it should open help.exe through shell execute. If you don't want it to do anything under one condition, then you don't need an else. If Not ProcessExists("help.exe") then ShellExecute("help.exe") Link to comment Share on other sites More sharing options...
SpookMeister Posted April 7, 2009 Share Posted April 7, 2009 skruge's solution does what you are asking. Alternatively you could also simply comment out (or delete) the MsgBox line: If ProcessExists(help.Exe) Then ;MsgBox(4096, "", "Value might be hexadecimal!") Else ShellExecute("help.exe") EndIf [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
youknowwho4eva Posted April 7, 2009 Share Posted April 7, 2009 I wanna try If ProcessExists("help.exe") = 0 then ShellExecute("help.exe") Giggity Link to comment Share on other sites More sharing options...
apache Posted April 7, 2009 Author Share Posted April 7, 2009 leaving blank msg box do not show any msg. wen i del the complete msg box line, it show the error for then condition is there any command to pause script? no way without box? skruge's solution does what you are asking. Alternatively you could also simply comment out (or delete) the MsgBox line: If ProcessExists(help.Exe) Then ;MsgBox(4096, "", "Value might be hexadecimal!") Else ShellExecute("help.exe") EndIf Link to comment Share on other sites More sharing options...
youknowwho4eva Posted April 7, 2009 Share Posted April 7, 2009 If you just want to pause it for a set period of time use sleep() If you want to pause it till a certain condition while $condition = false sleep(100) wend or do sleep(100) untill $condition = true Giggity Link to comment Share on other sites More sharing options...
apache Posted April 7, 2009 Author Share Posted April 7, 2009 @ youknowwho i wana use shell execute as a "else" statement this (If ProcessExists("help.exe") = 0 then ShellExecute("help.exe) shows this C:\Documents and Settings\vindos\Desktop\new.au3(1,52) : ERROR: syntax error (illegal character) If ProcessExists("help.exe") = 0 then ShellExecute(" Link to comment Share on other sites More sharing options...
youknowwho4eva Posted April 7, 2009 Share Posted April 7, 2009 (edited) Your missing a " this (If ProcessExists("help.exe") = 0 then ShellExecute("help.exe") Edited April 7, 2009 by youknowwho4eva Giggity Link to comment Share on other sites More sharing options...
apache Posted April 7, 2009 Author Share Posted April 7, 2009 i've been using "" sleep(100) untill $condition = true it will just make sleep for some moments what if i use sleep(2147483647) for 24 day????? lol Link to comment Share on other sites More sharing options...
youknowwho4eva Posted April 7, 2009 Share Posted April 7, 2009 no a do until loop will sleep until the set condition is true. What ever you want to set that condition to. Same with the while loop except inverse. It will repeat the sleep until the condition is no longer not true (so I guess not inverse) Giggity Link to comment Share on other sites More sharing options...
apache Posted April 7, 2009 Author Share Posted April 7, 2009 can u paste my complete script with your idea actually i cant understand $condition=true here If ProcessExists("help.Exe") Then sleep(100) untill $condition=true Else ShellExecute("help.exe") EndIf is it correct? Link to comment Share on other sites More sharing options...
Developers Jos Posted April 7, 2009 Developers Share Posted April 7, 2009 (edited) can u paste my complete script with your ideaactually i cant understand $condition=truehereIf ProcessExists("help.Exe") Then sleep(100)untill $condition=trueElse ShellExecute("help.exe")EndIfis it correct?Try learning some programming/scrip basics before starting to script.Open the helpfile and look at the commands used in your little piece of code and sort out what is wrong.Learn....Jos Edited April 7, 2009 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
apache Posted April 7, 2009 Author Share Posted April 7, 2009 i've been learning for a long time to solve it. now im fedup thats why im asking here. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 7, 2009 Developers Share Posted April 7, 2009 i've been learning for a long time to solve it. now im fedup thats why im asking here.Don't make your impatience our problem.*click*Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts