mcgill Posted August 4, 2006 Share Posted August 4, 2006 Hey all, I have having issues with my runwait command when I try to install I program. This program works fine if I point it to the directory where the files are ie " C:\where my program is" but what i want is my autoit exe will be in the directory of the install files. Want to run the script from inside the install directory, help would be appreciated. If anyone has any ideas how I can add a progress bar to this would be great also. #include <file.au3> #include <mousefix.au3> $TMPDIR = EnvGet ( "TEMP") $ALLUSERSPROFILE = EnvGet ( "ALLUSERSPROFILE") $PATH = EnvGet ("PATH") $LogFile = $TMPDIR & "\wksAutoITscript_logfile.txt" $AppName = "BlackBerry Desktop Software" ;The binary file whose version we will check. $AppBinFile = "C:\Program Files\Research In Motion\BlackBerry\DesktopMgr.exe" ; name of app to check to see if install already ;The expected file version. $AppBinFileVersion = "4.1.0.8" ;The installation source directory $SourceDir = "C:\Program Files\" ;Check for the existence of the correct version. _FileWriteLog($LogFile, "Now checking for " & $AppName & "...") $CurrentVer = FileGetVersion ( $AppBinFile ) _FileWriteLog($LogFile, "The current version is: " & $CurrentVer) If $CurrentVer <> $AppBinFileVersion Then _FileWriteLog($LogFile, $AppName & " needs to be installed or upgraded.") _FileWriteLog($LogFile, "Launching Setup now...") ;Start the setup. ;$go = RunWait(@ComSpec & ' /c msiexec /i "C:\Blackberry1\BB\BlackBerry Desktop Software.msi" TRANSFORMS="C:\Blackberry1\BB\BlackBerry Desktop Software.mst" REBOOT=ReallySuppress /qb!',@WindowsDir) $go = RunWait(@ComSpec & ' /c msiexec /i ' @WorkingDir & "\BlackBerry Desktop Software.msi" TRANSFORMS= @WorkingDir & "\BlackBerry Desktop Software.mst" REBOOT=ReallySuppress /qn,@SW_HIDE) Sleep (3000) ;if $size = DirGetSize("C:") ;Re-check the version after install. $CurrentVer = FileGetVersion ( $AppBinFile ) _FileWriteLog($LogFile, "The current version is: " & $CurrentVer) _FileWriteLog($LogFile, $AppName & " setup is now finished.") Else ;The correct version must be installed. _FileWriteLog($LogFile, $AppName & " is the correct version. Nothing to install.") msgbox(0,"", $AppName & " is the correct version. Nothing to install.") EndIf Link to comment Share on other sites More sharing options...
MHz Posted August 4, 2006 Share Posted August 4, 2006 (edited) You had some issues with your Run() command but I ironed it out. I used FileChangeDir() to change the WorkingDir if that is what you want? Not sure of where your install directroy actually is. expandcollapse popup#include <file.au3> #include <mousefix.au3> $TMPDIR = EnvGet ( "TEMP") $ALLUSERSPROFILE = EnvGet ( "ALLUSERSPROFILE") $PATH = EnvGet ("PATH") $LogFile = $TMPDIR & "\wksAutoITscript_logfile.txt" $AppName = "BlackBerry Desktop Software" ;The binary file whose version we will check. $AppBinFile = "C:\Program Files\Research In Motion\BlackBerry\DesktopMgr.exe" ; name of app to check to see if install already ;The expected file version. $AppBinFileVersion = "4.1.0.8" ;The installation source directory $SourceDir = "C:\Program Files\" ;Check for the existence of the correct version. _FileWriteLog($LogFile, "Now checking for " & $AppName & "...") $CurrentVer = FileGetVersion ( $AppBinFile ) _FileWriteLog($LogFile, "The current version is: " & $CurrentVer) If $CurrentVer <> $AppBinFileVersion Then _FileWriteLog($LogFile, $AppName & " needs to be installed or upgraded.") _FileWriteLog($LogFile, "Launching Setup now...") ;Start the setup. ;$go = RunWait(@ComSpec & ' /c msiexec /i "C:\Blackberry1\BB\BlackBerry Desktop Software.msi" TRANSFORMS="C:\Blackberry1\BB\BlackBerry Desktop Software.mst" REBOOT=ReallySuppress /qb!',@WindowsDir) If FileChangeDir("C:\Blackberry1\BB") Then $go = RunWait(@ComSpec & ' /c msiexec /i "' & @WorkingDir & '\BlackBerry Desktop Software.msi" TRANSFORMS="' & @WorkingDir & '\BlackBerry Desktop Software.mst" REBOOT=ReallySuppress /qn') EndIf Sleep (3000) ;if $size = DirGetSize("C:") ;Re-check the version after install. $CurrentVer = FileGetVersion ( $AppBinFile ) _FileWriteLog($LogFile, "The current version is: " & $CurrentVer) _FileWriteLog($LogFile, $AppName & " setup is now finished.") Else ;The correct version must be installed. _FileWriteLog($LogFile, $AppName & " is the correct version. Nothing to install.") msgbox(0,"", $AppName & " is the correct version. Nothing to install.") EndIf Edited August 4, 2006 by MHz 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