Sign in to follow this  
Followers 0
ali

Run Error

5 posts in this topic

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.

Share this post


Link to post
Share on other sites



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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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!! :ph34r:

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