I need a script to help with the install. Problem is while trying to slipstream this norton ghost 2003, It starts the install but its like I need to stall the installation for a short time to give nortons time to install. I am new to autoit script. I am just now learning it. The first install I tried without script failed. Its like I need to stall the program to give it time to install. Without the script it starts to install, but the next addon starts to install at the same time and nortons fails.
I used automatated script maker for the setup file. I just need to figure out what to change and how to change it.
First question. What is the diffrence between "use winexists in a loop" and "use winwaits in sequence" ? I guessed and picked "use winwaits in sequence"
Second queston, What do I need to change to get the install to wait a short time to give nortons time to install.??
Here is my script.
#region - setup install script - (Automated with WinWait functions)
Opt('TrayIconDebug', 1)
Opt('WinDetectHiddenText', 1)
Opt('WinTitleMatchMode', 4)
; Installer.
$executable = 'setup.exe'
; Show progess.
$splash = 0
; Default catagory folder in startmenu.
$group = ''
; New catagory to move the default folder into.
$catagory = ''
; Installation folder in Program Files.
$directory = ''
; Run the installer.
$pid = _Install()
If WinWait('', '', 60) Then
ControlClick('', '', '')
WinWait('', '')
ControlClick('', '', '')
WinWait('', '')
ControlClick('', '', '')
WinWait('', '')
ControlClick('', '', '')
WinWait('', '')
ControlClick('', '', '')
Else
_Abort()
EndIf
ProcessWaitClose($pid)
; Remove shortcuts.
If _MainShortcut('?.lnk') Then
; Relative to shortcut directories
; Remove Startmenu shortcuts
FileDelete('?.lnk')
FileDelete('?.lnk')
FileDelete('?.lnk')
FileDelete('?.lnk')
FileDelete('?.lnk')
; Remove other shortcuts
_Desktop('?.lnk')
_QuickLaunch('?.lnk')
EndIf
#endregion
Exit
#cs - Exitcodes
1 = _Install(): Installer not found
2 = _Abort(): Installer process closed and then Abort
3 = _Abort(): Abort only
-1 = _ProcessBlock(): Blocked processes not unblocked
#ce
Func _Install($path = 'Default')
; Run the installer in Default Script directory.
Dim $splash, $processblock
If $path = 'Default' Then $path = @ScriptDir
If StringRight($path, 1) <> '\' Then $path = $path & '\'
If StringInStr($executable, '\') Then $path = ''
If Not FileExists($path & $executable) Then Exit 1
If $processblock <> '' Then Call('_' & 'ProcessBlock')
If $splash Then _Splash('Installing:' & StringTrimRight(StringReplace(@ScriptName, '_', ' '), 4))
If StringRight($executable, 3) = 'msi' Then
Return Run(@SystemDir & '\msiexec /i "' & $path & $executable & '"')
Else
Return Run($path & $executable)
EndIf
EndFunc
Func _Abort()
; close process if exists then exit.
Dim $pid
If ProcessExists($pid) Then
ProcessClose($pid)
Exit 2
Else
Exit 3
EndIf
EndFunc
Func _Desktop($shortcut)
; Delete a Desktop shortcut.
If FileExists(@DesktopDir & '\' & $shortcut) Then
Return FileDelete(@DesktopDir & '\' & $shortcut)
ElseIf FileExists(@DesktopCommonDir & '\' & $shortcut) Then
Return FileDelete(@DesktopCommonDir & '\' & $shortcut)
EndIf
EndFunc
Func _MainShortcut($shortcut, $rename = '')
; Change working directory to correct StartMenu\Group directory.
Dim $group, $catagory, $splash
If $group = '' Then Return 0
If FileExists(@ProgramsDir & '\' & $group) Then
FileChangeDir(@ProgramsDir & '\' & $group)
ElseIf FileExists(@ProgramsCommonDir & '\' & $group) Then
FileChangeDir(@ProgramsCommonDir & '\' & $group)
Else
Return 0
EndIf
; Wait for main shortcut.
If $splash Then _Splash('Waiting for shortcuts')
For $i = 1 To 20
If FileExists($shortcut) Then ExitLoop
Sleep(500)
Next
If $splash Then _Splash('Cleaning up:' & StringTrimRight(StringReplace(@ScriptName, '_', ' '), 4))
; If catagory not assigned anything, then return.
If $catagory = '' Then Return 1
; Move the group folder into the catagory folder.
If FileChangeDir('..') And DirCopy($group, $catagory & '\' & $group, 1) Then
If DirRemove($group, 1) Then
; If optional rename parameter is used, then rename the group folder.
If $rename <> '' And FileChangeDir($catagory) Then
If DirCopy($group, $rename, 1) And DirRemove($group, 1) Then
Return FileChangeDir($rename)
EndIf
Else
Return FileChangeDir($catagory & '\' & $group)
EndIf
EndIf
EndIf
EndFunc
Func _QuickLaunch($shortcut)
; Delete a Quicklaunch shortcut.
Local $subdirs = 'Microsoft\Internet Explorer\Quick Launch'
If FileExists(@AppDataDir & '\' & $subdirs & '\' & $shortcut) Then
Return FileDelete(@AppDataDir & '\' & $subdirs & '\' & $shortcut)
ElseIf FileExists(@AppDataCommonDir & '\' & $subdirs & '\' & $shortcut) Then
Return FileDelete(@AppDataCommonDir & '\' & $subdirs & '\' & $shortcut)
EndIf
EndFunc
Func _Splash($text = '')
; Shows a small borderless splash message.
Dim $splash
If $splash Then
If $text Then
SplashTextOn('', $text, 500, 25, -1, 5, 1, '', 14)
Else
SplashOff()
EndIf
EndIf
EndFunc
Func _WinClose($title, $text = '')
; Close a window with further attempts.
For $i = 1 To 10
WinClose($title, $text)
If Not WinExists($title) Then Return 1
Sleep(500)
Next
EndFunc
Func OnAutoItStart()
; A 2nd script instance will exit.
If StringInStr($CMDLINERAW, '/dummy') Then Exit
If WinExists(@ScriptName & '_Interpreter') Then Exit
AutoItWinSetTitle(@ScriptName & '_Interpreter')
EndFunc
This is just a copy and paste job.
This post has been edited by tym: 29 October 2008 - 01:10 PM



Help
Back to top








