corey822 Posted January 3, 2008 Share Posted January 3, 2008 hiya all ive got something im working on as secret and im jsut wondering is ti possible to try and run a certain program from a button but if the file doesnt exist on their computer it will try in another drive on their computer i have accidentally split my drive in 2 and the main one is called F: not C: but there still is a C:. CODE Case $Button3 Run("F:\Program Files\Windows NT\Accessories\wordpad.exe") Run("C:\Program Files\Windows NT\Accessories\wordpad.exe") thats is what im having trouble with any ideas? cheers C.W C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake Link to comment Share on other sites More sharing options...
Kerros Posted January 3, 2008 Share Posted January 3, 2008 if FileExists("F:\Program Files\Windows NT\Accessories\wordpad.exe") then Run("F:\Program Files\Windows NT\Accessories\wordpad.exe") Else Run("C:\Program Files\Windows NT\Accessories\wordpad.exe") endif Else you could put the drive letters into an array, and use a for statement. example dim $array[2] $array[0] = "C:" $array[1] = "F:" $file = "\Program Files\Windows NT\Accessories\wordpad.exe" for $icc = 0 to ubound($array)-1 if fileexists($array[$icc]&$file) then run($array[$icc]&$file) next Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance. Link to comment Share on other sites More sharing options...
corey822 Posted January 3, 2008 Author Share Posted January 3, 2008 if FileExists("F:\Program Files\Windows NT\Accessories\wordpad.exe") then Run("F:\Program Files\Windows NT\Accessories\wordpad.exe") Else Run("C:\Program Files\Windows NT\Accessories\wordpad.exe") endif Else you could put the drive letters into an array, and use a for statement. example dim $array[2] $array[0] = "C:" $array[1] = "F:" $file = "\Program Files\Windows NT\Accessories\wordpad.exe" for $icc = 0 to ubound($array)-1 if fileexists($array[$icc]&$file) then run($array[$icc]&$file) next ohhhhhh thnx i knew it had a else if or soemthing in there just didnt know how to do it im a total noob to arrays thnx m8 cheers C.W C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake 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