slightly_abnormal Posted March 23, 2006 Posted March 23, 2006 (edited) If FileExists(@UserProfileDir & "/horde/rainmain.exe") then run("%appdata%/horde/rainmain.exe") else msgbox(0,"Where did it go george?","Can't find what you want") endif this is supposed to run the file if found in the users %appdata% , if not found then display message.. but the stupid thing is that it doesn't look at all. Edited March 23, 2006 by slightly_abnormal
PsaltyDS Posted March 23, 2006 Posted March 23, 2006 If FileExists(@UserProfileDir & "/horde/rainmain.exe") then run("%appdata%/horde/rainmain.exe") else msgbox(0,"Where did it go george?","Can't find what you want") endif this is supposed to run the file if found in the users %appdata% , if not found then display message.. but the stupid thing is that it doesn't look at all. Works great for all my Linux boxes, but using forward-slashes in a Windows CMD shell blows up a lot of things. Try it with back-slashes? If FileExists(@UserProfileDir & "\horde\rainmain.exe") then run("%appdata%\horde\rainmain.exe") else msgbox(0,"Where did it go george?","Can't find what you want") endif Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Moderators SmOke_N Posted March 23, 2006 Moderators Posted March 23, 2006 (edited) Is this what you are trying to do?Local $AppLocation = @AppDataDir & "\horde\rainmain.exe" If FileExists($AppLocation) then Run($AppLocation) Else MsgBox(0,"Where did it go george?","Can't find what you want") EndIfYour back slashes were off a tad too Edit: PsaltyDS beat me too it, serves me right to answer the phone 1st Edited March 23, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
PsaltyDS Posted March 23, 2006 Posted March 23, 2006 Is this what you are trying to do?Local $AppLocation = @AppDataDir & "\horde\rainmain.exe" If FileExists($AppLocation) then Run($AppLocation) Else MsgBox(0,"Where did it go george?","Can't find what you want") EndIfYour back slashes were off a tad too Edit: PsaltyDS beat me too it, serves me right to answer the phone 1st I DON'T BELIEVE IT!!! I got a reply typed faster than SmOke_N! Go Me! Party time! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
slightly_abnormal Posted March 23, 2006 Author Posted March 23, 2006 lol ps, I didn't relize it was backwards!!!!!, thanks, and smoke, thats a clever way of running it thanks guys
CyberSlug Posted March 23, 2006 Posted March 23, 2006 FYI, you would probably need Opt("ExpandEnvStrings", 1) at the top of the script if you decided to use %appdata% anyway:Changes how literal strings and % symbols are interpreted. By default strings are treated literally, this option allows you to use %environment% variables inside strings, e.g., "The temp directory is: %temp%".1 = expand environment variables (similar to AutoIt v2)0 = do not expand environment variables (default)Without this option the usual way would be: "The temp directory is: " & EnvGet("temp") Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
slightly_abnormal Posted March 23, 2006 Author Posted March 23, 2006 FYI, you would probably need Opt("ExpandEnvStrings", 1) at the top of the script if you decided to use %appdata% anyway:hey that's good to know! gracious cyberslug!
coolness Posted April 8, 2006 Posted April 8, 2006 (edited) why don't you just tell it to run the file. If it exests its gonna run it. If it doesn't it won't; that simple. Edited April 8, 2006 by coolness
cdkid Posted April 8, 2006 Posted April 8, 2006 (edited) coolness, it's always best to add error handling. Let's say he puts it out w/o the If Filexists.... part. If rainman.exe doesn't exist, it throws an auto-it error box & closes. Most people wouldn't know what that meant, and claim there was a bug in his code. If he keeps the If FileExists... then he can add his own error box like so MsgBox(4096, "Houston, we have a problem",@AppDataDir & "\horde\rainman.exe doesn't exist, please install the program before running this.") Exit ~cdkid Edited April 8, 2006 by cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
coolness Posted April 8, 2006 Posted April 8, 2006 (edited) Why not just choose to run it, then make a spot in the script, to where it will take down the air box, after it comes up. Answer that smartass, it's one less click. Edited April 8, 2006 by coolness
Moderators SmOke_N Posted April 8, 2006 Moderators Posted April 8, 2006 Why not just choose to run it, then make a spot in the script, to where it will take down the air box, after it comes up. Answer that smartass, it's one less click.Do you have an example of what you mean?... And I don't think cdkid was being a smart ass, more informative than anything else. Also, you don't "have" to use a MsgBox() for the "Else" statement, that can be anything, we generally put that there so that there for debugging purposes, but most will have it either Exit or go to another function or whatever they want to accomplish if in fact it doesn't exist. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
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