Jump to content

WAIK silent install


neuropass

Recommended Posts

could you guys help me with an autoit scritp? i actually made it and everything is ok.. the only step that gets stuck is at the end of the installation when i have to click on the close buttons.

this is my script, i can't figure ot whjat the problem is because everything is working except for that last step .

the program that i'm trying to install is WAIK. i extracted the components needed from the iso. which are :

  • Neutral.cab
  • aikx86.cab
  • WinPE.cab
  • wAIKX86.msi

#region - wAIKX86 install script - (Automated with WinWait functions)

Opt('TrayIconDebug', 1)
Opt('WinDetectHiddenText', 1)
Opt('WinTitleMatchMode', 4)

; Installer.
$executable = 'wAIKX86.msi'
; 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("classname=WorkerW","FolderView") Then
$CLVItem = ControlListView("classname=WorkerW","FolderView","SysListView321","FindItem","wAIKX86.msi")
ControlListView("classname=WorkerW","FolderView","SysListView321","SelectClear")
ControlListView("classname=WorkerW","FolderView","SysListView321","Select",$CLVItem)
$CLVItem = ControlListView("classname=WorkerW","FolderView","SysListView321","FindItem","wAIKX86.msi")
ControlListView("classname=WorkerW","FolderView","SysListView321","SelectClear")
ControlListView("classname=WorkerW","FolderView","SysListView321","Select",$CLVItem)
WinWait("Windows Automated Installation Kit","MsiHorizontalLine")
ControlClick("Windows Automated Installation Kit","MsiHorizontalLine","Button1")
WinWait("Windows Automated Installation Kit","MsiRadioButtonGroup")
ControlClick("Windows Automated Installation Kit","MsiRadioButtonGroup","Button3")
ControlClick("Windows Automated Installation Kit","MsiRadioButtonGroup","Button6")
WinWait("Windows Automated Installation Kit","&Disk Cost...")
ControlClick("Windows Automated Installation Kit","&Disk Cost...","Button1")
WinWait("Windows Automated Installation Kit","MsiHorizontalLine")
ControlClick("Windows Automated Installation Kit","MsiHorizontalLine","Button1")
ControlClick("Windows Automated Installation Kit","MsiHorizontalLine","Button1")
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

thanks in advance guys.....

Link to comment
Share on other sites


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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...