ok->
[autoit]
#cs----------------------------------------------------
Version 1.0 Installation von GhostScript und FreePDF
09.10.2007
#ce----------------------------------------------------
#include <GUIConstants.au3>
Local $install_title = "Softwareinstallation"
Local $admin = "admin"
Local $pwd = "pw"
Local $software_titel = "FreePDF 3.24"
Local $software1 = "gs854w32.exe"
Local $software2 = "FreePDFXP3.24.EXE"
;GUI - Installationsabfrage
$installGUI = GUICreate($install_title, 255, 70, -1, -1, BitOR($WS_CAPTION, $WS_SYSMENU));title,width,height..
GUICtrlCreateLabel("Installation von "& $software_titel, 20, 11, 235, 20);text,left,top,width,height
$b_install = GUICtrlCreateButton("installieren", 30, 40, 75, 23, BitOR($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON));Buttom text,left,top,width,height
$b_abbruch = GUICtrlCreateButton("abbrechen", 120, 40, 75, 23, BitOR($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON));Buttom text,left,top,width,height
GUICtrlSetState(-1, $GUI_FOCUS)
GUISetState (@SW_SHOW,$installGUI)
;-----------------------------------
$msg = 0
While $msg <> $GUI_EVENT_CLOSE
$msg = GUIGetMsg()
Select
case $msg = $b_install
copy_files($software1)
copy_files($software2)
install_ghost($software1)
install_freepdf($software2)
delete_files($software1)
delete_files($software2)
MsgBox(0,$install_title,"Die Installation ist beendet. Bitte den Rechner neustarten!!",5)
WinClose($install_title) ;schließen des Hauptinstallationsfensters
case $msg = $b_abbruch
Exit
EndSelect
Wend
Func copy_files($filename)
SplashTextOn($install_title,"Dateien werden kopiert. Bitte warten.") ;title,text,width of pix,height of pix,x pos,y pos,option=o title,top,center
FileCopy($filename,"c:\temp\",9) ;Flag 9= 1+8 erstellt Dir und überschreibt File
SplashOff()
EndFunc
Func delete_files($filename)
FileDelete("C:\temp\"& $filename)
EndFunc
Func install_ghost($software)
;GUISetState(@SW_DISABLE, $installGUI)
RunAsSet($admin, @Computername, $pwd) ;Adminrechte geben
Run($software,"c:\temp\")
RunAsSet() ;Adminrechte nehmen
AutoItSetOption("WinTitleMatchMode", 2) ;Mode geändert - sucht nach irgendeiner Übereinstimmung
If WinWaitActive("gs854w32.exe","",3) Then
ControlClick("gs854w32.exe","",1,"&Setup") ;setup ausführen
If WinWaitActive("AFPL") Then
ControlCommand("AFPL","All Users","Button3","Check","") ;für alle User installieren
;Installation beginnen
ControlClick("AFPL","",1004,"This install")
;Installation ist beendet - das Iconfenster lässt sich irgendwie nicht schließEndFunc
WinWaitClose("AFPL") ;schließen des Installationsfensters
EndIf
Else
MsgBox(0,"Error","Das benötigte Fenster ist nicht vorhanden.")
Exit
EndIf
EndFunc
Func install_freepdf($software)
AutoItSetOption("WinTitleMatchMode", 2) ;Mode geändert - sucht nach irgendeiner Übereinstimmung
RunAsSet($admin, @Computername, $pwd) ;Adminrechte geben
Run($software,"c:\temp\")
RunAsSet() ;Adminrechte nehmen
If WinWaitActive("FreePDF XP 3.24") Then
ControlClick("FreePDF XP 3.24","",7,"&Setup") ;Setup ausführen
If WinWaitActive("FreePDF XP 3.24","&End") Then
ControlClick("FreePDF XP 3.24","",4,"&End") ;Setup/Installation beenden
EndIf
EndIf
EndFunc