ali Posted September 12, 2004 Share Posted September 12, 2004 Does anyone know how 2 check if a program exists? i basically have this line of code: ; Run Sol Run(@systemdir & "\sol.exe") some users do not have sol.exe, it may have been deleted...how can i check that the file exists before running it? If i leave it like this...it will give an error in the program midway just before it is supposed to run the program. Basically i want it to check if the program is there... and if it isnt... the user gets a message sayin program wasnt found. Or... You could have the pc search for the file and then run it... either ways would be fine....i guess for the search idea..it wud need a message if it wusnt found.. Please help. Link to comment Share on other sites More sharing options...
Developers Jos Posted September 12, 2004 Developers Share Posted September 12, 2004 Does anyone know how 2 check if a program exists? i basically have this line of code: ; Run Sol Run(@systemdir & "\sol.exe") some users do not have sol.exe, it may have been deleted...how can i check that the file exists before running it? If i leave it like this...it will give an error in the program midway just before it is supposed to run the program. Basically i want it to check if the program is there... and if it isnt... the user gets a message sayin program wasnt found. Or... You could have the pc search for the file and then run it... either ways would be fine....i guess for the search idea..it wud need a message if it wusnt found.. Please help. <{POST_SNAPBACK}>If FileExists(@systemdir & "\sol.exe") then Run(@systemdir & "\sol.exe") Else msgbox(0,"Error", "File not there.....") EndIF 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...
ali Posted September 12, 2004 Author Share Posted September 12, 2004 If FileExists(@systemdir & "\sol.exe") then Run(@systemdir & "\sol.exe") Else msgbox(0,"Error", "File not there.....") EndIF <{POST_SNAPBACK}>this was a part of the application i was creating, but...after it does that...it will not continue with the rest of the program... what do i write to let it continue and not just end the application? Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted September 12, 2004 Share Posted September 12, 2004 Without knowing the rest of the code there is no way to help you answer that question. Even fake code to help us understand the structure of your script would be good. *** Matt @ MPCS Link to comment Share on other sites More sharing options...
ali Posted September 12, 2004 Author Share Posted September 12, 2004 Thanks for your help it was very appreciated...the coding worked perfectly.....and as for my last post...i realized my mistake..i had more code related to the program...so it should have been inside the If Then statement, rather than outside. Dunno if u understood wht i wrote buh basically...i got it working now...thanks loadsssss....verrrrrry much appreciated.... such prompt responses...keep it up guys!! 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