Jump to content

Run Error


ali
 Share

Recommended Posts

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

  • Developers

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

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

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:

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...