MykeV Posted August 31, 2006 Posted August 31, 2006 All, I need some help figuring out how to make this statement work. I'm using AutoIt to silently install a program and setup up some custom program links. Since I can't tell when the installation completes, I figured i would create an "IF" statement that would copy the links to the necessary folders once the program executable existed. I want the "IF" statement to keep repeating until the "FileExist" statement is true. What am i doing wrong. ;Program Install (silent mode) Run (@WorkingDir & "\8003\setup.exe -s") ;Copying File Links $C1 = @WorkingDir & "\misc\dynacomm.lnk" $C2 = @WorkingDir & "\misc\session1.ses" $C3 = @WorkingDir & "\misc\standard1.*" While 1 If FileExists (@ProgramFilesDir & "\Futuresoft\DCSeries\dseries.exe") Then FileCopy ($C1 , @DesktopDir,1) FileCopy ($C2 , @ProgramFilesDir & "\Futuresoft\DCSeries\session",1) FileCopy ($C3 , @ProgramFilesDir & "\Futuresoft\DCSeries\maps",1) EndIf WEnd Exit
Valuater Posted August 31, 2006 Posted August 31, 2006 (edited) maybe... ;Program Install (silent mode) If FileExists(@WorkingDir & "\8003\setup.exe") Then $run_file = FileGetShortName(@WorkingDir & "\8003\setup.exe") Run ($run_file & " -s") ;Copying File Links $C1 = @WorkingDir & "\misc\dynacomm.lnk" $C2 = @WorkingDir & "\misc\session1.ses" $C3 = @WorkingDir & "\misc\standard1.*" While 1 If FileExists (@ProgramFilesDir & "\Futuresoft\DCSeries\dseries.exe") Then FileCopy ($C1 , @DesktopDir,1) FileCopy ($C2 , @ProgramFilesDir & "\Futuresoft\DCSeries\session",9) FileCopy ($C3 , @ProgramFilesDir & "\Futuresoft\DCSeries\maps",9) ExitLoop EndIf Sleep(100) WEnd EndIf Exit 8) Edited August 31, 2006 by Valuater
MykeV Posted September 1, 2006 Author Posted September 1, 2006 Thanks for the help V. 2 questions? 1. What is served by making the entire script an "IF" statement? 2. What purpose does the "FileGetShortName" function serve? Again. Thanks for your help. maybe... ;Program Install (silent mode) If FileExists(@WorkingDir & "\8003\setup.exe") Then $run_file = FileGetShortName(@WorkingDir & "\8003\setup.exe") Run ($run_file & " -s") ;Copying File Links $C1 = @WorkingDir & "\misc\dynacomm.lnk" $C2 = @WorkingDir & "\misc\session1.ses" $C3 = @WorkingDir & "\misc\standard1.*" While 1 If FileExists (@ProgramFilesDir & "\Futuresoft\DCSeries\dseries.exe") Then FileCopy ($C1 , @DesktopDir,1) FileCopy ($C2 , @ProgramFilesDir & "\Futuresoft\DCSeries\session",9) FileCopy ($C3 , @ProgramFilesDir & "\Futuresoft\DCSeries\maps",9) ExitLoop EndIf Sleep(100) WEnd EndIf Exit 8)
Moderators SmOke_N Posted September 1, 2006 Moderators Posted September 1, 2006 "If" is exactly that, it's conditional, you only want to do something if the condition is true or untrure. FileGetShortName helps in run commands because spaces in the path sometimes will give you run errors, FileGetShortName() has no spaces in the path. 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.
Valuater Posted September 1, 2006 Posted September 1, 2006 "If" is exactly that, it's conditional, you only want to do something if the condition is true or untrure.FileGetShortName helps in run commands because spaces in the path sometimes will give you run errors, FileGetShortName() has no spaces in the path.exactly, I didn't know if you were running into errors with thisRun (@WorkingDir & "\8003\setup.exe -s")8)
MykeV Posted September 4, 2006 Author Posted September 4, 2006 Thanks for the assist fellas. I appreciate it. Long Live AutoIT!!!
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