Sublime Posted March 24, 2009 Share Posted March 24, 2009 I realize this probably already exists.. But anywho... FYI: look at the 3rd include. All application scripts for install are located in the same directory as INCLUDES.au3 that file simply houses the #include arguments for all of them. Which contains there functions. expandcollapse popup;=========================================================================== ;=================================Program Variables============================== ;=========================================================================== #include <File.au3> #include <Array.au3> #include <E:\Auto Progs\AutoIT\Program Functions\INCLUDES.au3> Opt("WinTitleMatchMode", 2) Dim $InstallerSettings = ".\AutoIT\Installer V3.ini" Dim $AutoInstallLog = ".\AutoIT\AutoInstall.dat" Dim $x, $time = 1000, $Run = 0, $ProgramX, $SplitArray[3] Dim $_FileDest = @HomeDrive Dim $_FileDest2 = @ScriptDir Global $Paused ;================================================================================ ;=================================RUNS PROGRAM=================================== ;================================================================================ HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") $oShell = ObjCreate("shell.application") $oShell.MinimizeAll Program() Func Program() $Run = 1 If FileExists($AutoInstallLog) Then FileDelete($AutoInstallLog) _FileWriteLog($AutoInstallLog, "*AutoInstall* INI READ INITIATED") $FUNCTION = IniReadSection($InstallerSettings, "Program Functions") _FileWriteLog($AutoInstallLog, "*AutoInstall* Reading INI: Program Functions: Finished Reading with error code of:" & @error) $PROGRAM = IniReadSection($InstallerSettings, "Program File Locations") _FileWriteLog($AutoInstallLog, "*AutoInstall* Program File Locations: Finished Reading with error code of:" & @error) _FileWriteLog($AutoInstallLog, "*AutoInstall* Starting Main Program") _FileWriteLog($AutoInstallLog, "*AutoInstall* Main Program was Initiated") For $x = 1 To $PROGRAM[0][0] $ProgramX = FileDirective($PROGRAM[$x][1]) ToolTip("AutoInstall currently on " & " Function: " & $FUNCTION[$x][1] & " - " & $ProgramX, 0, 0) If Not FileExists($ProgramX) Then Call($FUNCTION[$x][1]) _FileWriteLog($AutoInstallLog, "*AutoInstall* HAS COMPLETED STEP " & $x & " " & $FUNCTION[$x][1]) Else _FileWriteLog($AutoInstallLog, "*AutoInstall* " & "Already Exists:" & $FUNCTION[$x][1] & " - " & $ProgramX) EndIf Sleep($time) Next _FileWriteLog($AutoInstallLog, "*AutoInstall* HAS FINISHED.") $Run = 0 Exit EndFunc ;==>Program Func FileDirective($ProgramFileLocation) While @error = 0 Local $SplitArray = StringSplit($ProgramFileLocation, "*") Local $ProgramX = _ArrayToString($SplitArray, "", 2, 2) $ProgramX = MacroRef($ProgramX) & $SplitArray[$SplitArray[0]] Return ($ProgramX) ExitLoop WEnd EndFunc ;==>FileDirective Func MacroRef($ZogramX) Switch $ZogramX Case "@AppDataCommonDir" $ZogramX = @AppDataCommonDir Case "@DesktopCommonDir" $ZogramX = @DesktopCommonDir Case "@DocumentsCommonDir" $ZogramX = @DocumentsCommonDir Case "@FavoritesCommonDir" $ZogramX = @FavoritesCommonDir Case "@ProgramsCommonDir" $ZogramX = @ProgramsCommonDir Case "@StartMenuCommonDir" $ZogramX = @StartMenuCommonDir Case "@StartupCommonDir" $ZogramX = @StartupCommonDir Case "@AppDataDir" $ZogramX = @AppDataDir Case "@DesktopDir" $ZogramX = @DesktopDir Case "@MyDocumentsDir" $ZogramX = @MyDocumentsDir Case "@FavoritesDir" $ZogramX = @FavoritesDir Case "@ProgramsDir" $ZogramX = @ProgramsDir Case "@StartMenuDir" $ZogramX = @StartMenuDir Case "@StartupDir" $ZogramX = @StartupDir Case "@UserProfileDir" $ZogramX = @UserProfileDir Case "@HomeDrive" $ZogramX = @HomeDrive Case "@HomePath" $ZogramX = @HomePath Case "@HomeShare" $ZogramX = @HomeShare Case "@LogonDNSDomain" $ZogramX = @LogonDNSDomain Case "@LogonDomain" $ZogramX = @LogonDomain Case "@LogonServer" $ZogramX = @LogonServer Case "@ProgramFilesDir" $ZogramX = @ProgramFilesDir Case "@CommonFilesDir" $ZogramX = @CommonFilesDir Case "@WindowsDir" $ZogramX = @WindowsDir Case "@SystemDir" $ZogramX = @SystemDir Case "@TempDir" $ZogramX = @TempDir Case Else ;;; EndSwitch Return ($ZogramX) EndFunc ;==>MacroRef ;========================================================================== ;=================================File Functions================================= ;========================================================================== Func TogglePause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('AutoInstall "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func Terminate() _FileWriteLog($AutoInstallLog, "*AutoInstall* PANIC KEY PRESSED. EXITING.") Exit 900 EndFunc ;==>Terminate Func OnAutoItExit() _FileWriteLog($AutoInstallLog, "*AutoInstall* Exit with Error Code:" & @error) _FileWriteLog($AutoInstallLog, "*AutoInstall* Exit with Exit Code:" & @exitCode) _FileWriteLog($AutoInstallLog, "*AutoInstall* Exit with Exit Method:" & @exitMethod) EndFunc ;==>OnAutoItExit And the INI FILE: expandcollapse popup[Program Functions] $FUNCTION[1]=CHKDSK $FUNCTION[2]=DOTNETFX20 $FUNCTION[3]=ATF $FUNCTION[4]=DRIVERAGENT $FUNCTION[5]=PRIMOPDF $FUNCTION[6]=SPYBOT $FUNCTION[7]=ANTIVIRUS $FUNCTION[8]=ADOBE $FUNCTION[9]=OPENOFFICE $FUNCTION[10]=NERO $FUNCTION[11]=DISKKEEPER $FUNCTION[12]=DLLS $FUNCTION[13]=WINDOC $FUNCTION[14]=PICASA $FUNCTION[15]=CPSURL $FUNCTION[16]=SYSTEMRESTORE $FUNCTION[17]=IEPROPERTIES $FUNCTION[18]=DISKCLEANUP $FUNCTION[19]=CALLINGCARD $FUNCTION[20]=ACRONIS [Program File Locations] $PROGRAM[1]=CHKDSK $PROGRAM[2]=DOTNETFX20 $PROGRAM[3]=*@DesktopDir*\ATF-Cleaner.exe $PROGRAM[4]=*@DesktopDir*\driveragent_488.exe $PROGRAM[5]=*@ProgramFilesDir*\activePDF\PrimoPDF\ $PROGRAM[6]=*@DesktopDir*\Spybot - Search & Destroy.lnk $PROGRAM[7]=Antivirus $PROGRAM[8]=*@ProgramFilesDir*\Adobe\Reader 8.0\ $PROGRAM[9]=*@ProgramFilesDir*\OpenOffice.org 3\ $PROGRAM[10]=*@ProgramFilesDir*\Nero\Nero 7\ $PROGRAM[11]=*@ProgramFilesDir*\Diskeeper Corporation\Diskeeper\ $PROGRAM[12]=DLLS $PROGRAM[13]=WinDoc $PROGRAM[14]=*@ProgramFilesDir*\Google\Picasa3\ $PROGRAM[15]=*@DesktopDir*\CPS Fix My Pc.url $PROGRAM[16]=System Restore $PROGRAM[17]=IE Properties $PROGRAM[18]=*@HomeDrive*\CCleaner\ $PROGRAM[19]=*@ProgramFilesDir*\LogMeIn Rescue Calling Card\ $PROGRAM[20]=*@ProgramFilesDir*\Acronis\ Link to comment Share on other sites More sharing options...
Spiff59 Posted March 24, 2009 Share Posted March 24, 2009 (edited) What would the problem/question be? Not finding the third include? Tried #include"" instead of #include<> ? Edit: A suggested improvement... Func MacroRef($ZogramX) Return (Execute($ZogramX)) EndFunc ;==>MacroRef Edited March 24, 2009 by Spiff59 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