Vielen Dank dafür !!!!
Genau wie ich mir das vorgestellt habe. Das hätte ich vorerst so nicht hinbekommen.
Wäre es auch möglich, zusätzlich ein zweites Fenster, Namens "WindowsActive" nach links oder oben rechts zu verschieben?
Edit:
Ich habe das ganze nun in meinem Script eingefügt. Es soll ja nur ausgeführt werden, wenn sysprep.exe auch aktiv ist. Ich habe mir dazu folgende Abfrage eingebaut:
AutoIt
; ===================================================================
; SYSTEMPREPARATIONSTOOL CHANGE WINDOW POSITION
; ===================================================================
If ProcessExists("sysprep.exe") Then
_DragSysprepWindow ()
Else
EndIf
Alles anzeigen
Und die Funktion:
AutoIt
; ===================================================================
; SYSPREP WINDOWS POSITION
; ===================================================================
Func _DragSysprepWindow ()
Global $aLang[5][2]
$sText='(Sysprep)'
$iFound=_ArraySearch($aLang,@OSLang)
If $iFound<>-1 Then $sText=$aLang[$iFound][1]
$Hwnd = WinGetHandle('[CLASS:#32770]',$sText)
;MsgBox(64, 'Sysprep', 'Hwnd: ' & $Hwnd)
$aPos=WinGetPos($Hwnd)
WinMove($Hwnd,'',@DesktopWidth-$aPos[2]-5,@DesktopHeight-$aPos[3]-35)
EndFunc
Alles anzeigen
Jetzt ist es so, wenn die sysprep.exe aktiv ist, wird mein Script (GUI) geladen und das Sysprep Fenster verschoben. Wenn die Sysprep.exe allerdings nicht aktiv ist, dann schließt sich mein GUI sofort wieder
Hier gerne auch mal mein gesamtes Script. Eventuell hat jemand generell Vorschläge.
Spoiler anzeigen
AutoIt
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=SOURCES\fticon.ico
#AutoIt3Wrapper_Outfile=FINALTEST_32BIT.Exe
#AutoIt3Wrapper_Outfile_x64=FINALTEST_64BIT.Exe
#AutoIt3Wrapper_Compile_Both=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#pragma compile(AutoItExecuteAllowed, True)
#comments-start
FINAL TEST TOOLS
#comments-end
; ===================================================================
; AUTOIT INCLUDE
; ===================================================================
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <File.au3>
#include <Array.au3>
#Include <WinAPIEx.au3>
#Region GUI
$Form1 = GUICreate("Final Test Tools", 322, 240, -1, -1)
$idSFolderMenu = GUICtrlCreateMenu("Folder")
$idKeyDefItem = GUICtrlCreateMenuItem("Tastaturlayouts", $idSFolderMenu)
$idBiosItem = GUICtrlCreateMenuItem("Bios-File", $idSFolderMenu)
$idExtrasMenu = GUICtrlCreateMenu("Extras")
$idCopyBiosItem = GUICtrlCreateMenuItem("BIOS-File FIX", $idExtrasMenu)
$idFindWTPItem = GUICtrlCreateMenuItem("Find WTP", $idExtrasMenu)
$idKbLightFlashItem = GUICtrlCreateMenuItem("Keyboard Backlight Flash", $idExtrasMenu)
$idHelpMenu = GUICtrlCreateMenu("?")
$idAboutItem = GUICtrlCreateMenuItem("About", $idHelpMenu)
$idInfoItem = GUICtrlCreateMenuItem("Info", $idHelpMenu)
$idChangelogItem = GUICtrlCreateMenuItem("Changelog", $idHelpMenu)
$Button1 = GUICtrlCreateButton("Start Final Test", 6, 4, 90, 35, 0)
$Button2 = GUICtrlCreateButton("2ND Injection", 115, 4, 90, 35, 0)
$Button3 = GUICtrlCreateButton("Uploadtool", 225, 4, 90, 35, 0)
$Button4 = GUICtrlCreateButton("Autotimer", 60, 50, 90, 35, 0)
$Button5 = GUICtrlCreateButton("delReport", 180, 50, 90, 35, 0)
$Button6 = GUICtrlCreateButton("keyReset" & @CR & "OA30", 60, 95, 90, 35, $BS_MULTILINE)
$Button7 = GUICtrlCreateButton("ASUS Update", 180, 95, 90, 35, 0)
$Button8 = GUICtrlCreateButton("WTP", 6, 140, 90, 35, 0)
$Button9 = GUICtrlCreateButton("WindowsActive", 225, 140, 90, 35, 0)
$Button10= GUICtrlCreateButton("Sysprep", 115, 150, 90, 35, 0)
$Copyright = GUICtrlCreateLabel("Copyright by Benny Böhnke", 185, 195, 168, 17)
GUISetState(@SW_SHOW)
#EndRegion GUI
; ===================================================================
; VARIABLE
; ===================================================================
$WA = "1.6.7.4_20160519"
$WorkingDir = StringReplace(@WorkingDir, "WTP\finaltest", "")
; ===================================================================
; SYSTEMPREPARATIONSTOOL CHANGE WINDOW POSITION
; ===================================================================
If ProcessExists("sysprep.exe") Then
_DragSysprepWindow ()
Else
EndIf
; ===================================================================
; WHILE SWITCH FOR FUNCTION
; ===================================================================
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_Func1 ()
Case $Button2
_Func2 ()
Case $Button3
_Func3 ()
Case $Button4
_Func4 ()
Case $Button5
_Func5 ()
Case $Button6
_Func6 ()
Case $Button7
_Func7 ()
Case $Button8
_Func8 ()
Case $Button9
_Func9 ()
Case $Button10
_Func10 ()
Case $idInfoItem
_Info ()
Case $idChangelogItem
_Changelog ()
Case $idAboutItem
_About ()
Case $idKeyDefItem
_KeyDefFolder ()
Case $idBiosItem
_BiosFileFolder ()
Case $idCopyBiosItem
_BiosFileFix ()
Case $idFindWTPItem
_FindWtp ()
Case $idKbLightFlashItem
_KbBackLightFlash ()
EndSwitch
WEnd
; ===================================================================
; BUTTON: FINALTEST
; ===================================================================
Func _Func1 ()
Switch MsgBox($MB_OK + 32, 'Finaltest', 'Bitte beachten' & @CR & '' & @CR & ' - Test MB vorhanden?' & @CR & ' - Windows 7 System?' & @CR & ' - Free Dos / Kein OS ?')
Case 1 ; JA
ShellExecute($WorkingDir & 'WTP\finaltest\finaltest.exe')
ShellExecute($WorkingDir & 'WTP\WindowsActive' & $WA & '\WindowsActive.exe')
sleep(80000)
ShellExecute(@WorkingDir & "WTP\finaltest\nbsettings.bat")
Case 2 ; NEIN
EndSwitch
EndFunc
; ===================================================================
; BUTTON: 2ND INJECTION
; ===================================================================
Func _Func2 ()
ShellExecute($WorkingDir & 'WTP\finaltest\2ndinjection.exe')
EndFunc
; ===================================================================
; BUTTON: UPLOADTOOL
; ===================================================================
Func _Func3 ()
ShellExecute($WorkingDir & 'WTP\finaltest\uploadtool.exe')
EndFunc
; ===================================================================
; BUTTON: AUTOTIMER
; ===================================================================
Func _Func4 ()
ShellExecute($WorkingDir & 'WTP\finaltest\autotimer.exe')
EndFunc
; ===================================================================
; BUTTON: DELREPORT
; ===================================================================
Func _Func5 ()
ShellExecute($WorkingDir & 'WTP\finaltest\delReport.exe')
EndFunc
; ===================================================================
; BUTTON: KEYRESET
; ===================================================================
Func _Func6 ()
Switch MsgBox(3, 'Windows Aktivierung', "Möchtest du den Key für eine Windows Aktivierung löschen?")
Case 6 ; JA
ShellExecute($WorkingDir & 'WTP\finaltest\keyReset.bat')
Case 7 ; NEIN
Case 2 ; CANCEL
EndSwitch
EndFunc
; ===================================================================
; BUTTON: ASUS LIVE UPDATE
; ===================================================================
Func _Func7 ()
ShellExecute($WorkingDir & 'WTP\finaltest\AsusLiveUpdater.exe')
EndFunc
; ===================================================================
; BUTTON: WTP
; ===================================================================
Func _Func8 ()
ShellExecute($WorkingDir & 'WTP\finaltest\DiagEG.lnk')
EndFunc
; ===================================================================
; BUTTON: WINDOWS INJECTION
; ===================================================================
Func _Func9 ()
ShellExecute($WorkingDir & 'WTP\WindowsActive' & $WA & '\WindowsActive.exe')
EndFunc
; ===================================================================
; BUTTON: SYSPREP
; ===================================================================
Func _Func10 ()
ShellExecute($WorkingDir & 'WTP\finaltest\sysprep.bat')
EndFunc
; ===================================================================
; OPTION > ?
; ===================================================================
; INFO
Func _Info ()
ShellExecute($WorkingDir & 'WTP\finaltest\info.txt')
EndFunc
; CHANGELOG
Func _Changelog ()
ShellExecute($WorkingDir & 'WTP\finaltest\changelog.txt')
EndFunc
; ABOUT
Func _About ()
MsgBox(64, "About", "(c) by Benjamin Böhnke - 2016" & @CR & "" & @CR & "Dieses Tool wurde extra für den" & @CR & "Finaltest der," & @CR & "" & @CR & "PST" & @CR & "professional support technologies GmbH" & @CR & "" & @CR & "konzipiert.", 40)
EndFunc
; ===================================================================
; OPTION > FOLDER
; ===================================================================
; KEYDEF
Func _KeyDefFolder ()
;ShellExecute($WorkingDir & 'WTP\asus-wtp\bin\keydef\')
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
$Modelname = $objItem.Name
Next
Else
Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ComputerSystemProduct")
Endif
$keyDefUS = $WorkingDir & 'WTP\asus-wtp\bin\keydef\' & $Modelname & 'us.txt'
$keyDefEU = $WorkingDir & 'WTP\asus-wtp\bin\keydef\' & $Modelname & 'eu.txt'
$iFileExistsUS = FileExists($keyDefUS)
$iFileExistsEU = FileExists($keyDefEU)
; Display a message of whether the file exists or not.
If $iFileExistsUS Then
_WinAPI_ShellOpenFolderAndSelectItems($keyDefUS)
ElseIf $iFileExistsEU Then
_WinAPI_ShellOpenFolderAndSelectItems($keyDefEU)
Else
MsgBox($MB_SYSTEMMODAL, "", "Cant find US or EU keydef-File. Only JP or nothing.")
EndIf
EndFunc
; BIOSFOLDER
Func _BiosFileFolder ()
ShellExecute($WorkingDir & 'WTP\asus-wtp\bin\conf\')
EndFunc
; ===================================================================
; OPTION > EXTRAS
; ===================================================================
; BIOSFIX
Func _BiosFileFix ()
Switch MsgBox(3, 'BIOS-Fix', "Möchtest du das BIOS-File korrigieren?")
Case 6 ; JA
$rc = FileCopy($WorkingDir & 'WTP\finaltest\NB_BIOS.txt', $WorkingDir & 'WTP\asus-wtp\bin\conf\', 1)
If $rc > 0 Then
MsgBox(64,"OK!","BIOS-File erfolgreich korrigiert!")
Else
MsgBox(48,"Error","Konnte nicht korrigiert werden")
EndIf
Case 7 ; NEIN
Case 2 ; CANCEL
EndSwitch
EndFunc
; FIND WTP
Func _FindWtp ()
ShellExecute($WorkingDir & 'WTP\finaltest\findwtp\FindWTPresult.exe')
EndFunc
; KB BACKLIGHT FLASH
Func _KbBackLightFlash ()
ShellExecute($WorkingDir & 'WTP\finaltest\kbBacklightFlash.bat')
EndFunc
; ===================================================================
; SYSPREP WINDOWS POSITION
; ===================================================================
Func _DragSysprepWindow ()
Global $aLang[5][2]
$sText='(Sysprep)'
$iFound=_ArraySearch($aLang,@OSLang)
If $iFound<>-1 Then $sText=$aLang[$iFound][1]
$Hwnd = WinGetHandle('[CLASS:#32770]',$sText)
;MsgBox(64, 'Sysprep', 'Hwnd: ' & $Hwnd)
$aPos=WinGetPos($Hwnd)
WinMove($Hwnd,'',@DesktopWidth-$aPos[2]-5,@DesktopHeight-$aPos[3]-35)
EndFunc
Alles anzeigen