Hab da jetzt lange nichts mehr gemacht, aber dennoch hier die letzte testversion:
script starten, installationsdatei auswählen und starten, ein tooltip zeigt, was man (vielleicht mal das script selber) machen soll...
keine angst - das script installiert noch nichts automatisch ![]()
viel spaß ![]()
Spoiler anzeigen
#include <WinAPI.au3>
#include<Array.au3>
#Include <GuiComboBox.au3>
#include <GuiListView.au3>
#Include <GuiListBox.au3>
$sNext="Next|Weiter|Install|OK|Annehmen|Akzeptieren|Ja|Yes|Fertig|Agree|stimme"
$sCompany="firm|compa"
$sUser="benutzer|name|user"
$sAccept="Accept|akzept|stimme|Lizenz|License"
$sNotInstall="Google|Yahoo|eMusic|ebay"
$sLanguage="english|german|deutsch"
Opt("TrayIconDebug",1)
[/autoit] [autoit][/autoit] [autoit]HotKeySet("^!e","_Exit")
[/autoit] [autoit][/autoit] [autoit]Global $aInfos, $iKI_Cnt=0, $iKI_Prg=0, $bKI=False, $bKI_Chk=False
[/autoit] [autoit][/autoit] [autoit]$hFile=FileOpenDialog("Installations-Exe",@ScriptDir & "\Installationen","(*.exe;*.msi)",3)
If @error Then Exit
If StringRight($hFile,4)=".exe" Then $sPID=Run($hFile)
If StringRight($hFile,4)=".msi" Then
If ShellExecute($hFile)=1 Then
$Child=_ProcessGetChildren(@AutoItPID)
If @error Then Exit
$sPID=$Child[1][0]
EndIf
EndIf
Do
Sleep(500)
$aInfos=_GetInfo($sPID)
;_ToolTip($aInfos)
Sleep(500)
_Install_KI($aInfos)
Until ProcessExists($sPID)=0
Func _Install_KI($aInfos)
Local $bProgress=False
If IsArray($aInfos)=0 Then Return
$iKI_Cnt+=1
For $i=1 To $aInfos[0][0]
If StringInStr($aInfos[$i][2],"progress") Then
$bProgress=True
If $aInfos[$i][3]=$iKI_Prg Then
If $iKI_Cnt>10 Then $bKI=True
Else
$iKI_Cnt=0
$bKI=False
EndIf
EndIf
If $bKI=False Then ContinueLoop
If (StringInStr($aInfos[$i][2],"Checkbox") Or StringInStr($aInfos[$i][1],"List") Or StringInStr($aInfos[$i][2],"Tree")) And $aInfos[$i][4]="Checked" And _StringInStr($aInfos[$i][5],$sNotInstall) Then
ToolTip("Deselect: " & $aInfos[$i][5])
If StringInStr($aInfos[$i][1],"ListBox") Then _GUICtrlListBox_DeleteString(ControlGetHandle($aInfos[$i][0],"",$aInfos[$i][1]), $aInfos[$i][2])
$bKI=False
EndIf
If StringInStr($aInfos[$i][2],"Combo") And _StringInStr($aInfos[$i][5],$sLanguage)And _StringInStrFirst($aInfos[$i][5],$sLanguage)=False Then
ToolTip("Wähle Sprache: Deutsch,German, oder English: " & $aInfos[$i][5])
$bKI=False
EndIf
If StringInStr($aInfos[$i][2],"Edit") And $aInfos[$i][5]="" And _StringInStr($aInfos[$i][6],$sUser) Then
ToolTip("Benutzernamen eingeben: " & $aInfos[$i][5])
$bKI=False
EndIf
If StringInStr($aInfos[$i][2],"Edit") And $aInfos[$i][5]="" And _StringInStr($aInfos[$i][6],$sCompany) Then
ToolTip("Firmennamen eingeben: " & $aInfos[$i][5])
$bKI=False
EndIf
If StringInStr($aInfos[$i][2],"Checkbox") And $aInfos[$i][4]<>"Checked" And _StringInStr($aInfos[$i][5],$sAccept) Then
ToolTip("Select: " & $aInfos[$i][5])
$bKI=False
EndIf
If $bKI And $aInfos[$i][3]="Enabled" And StringInStr($aInfos[$i][2],"Button") And _StringinStr($aInfos[$i][5],$sNext) Then
ToolTip("Klick auf: " & $aInfos[$i][5])
$bKI_Chk=False
ElseIf $bKI And $aInfos[$i][3]="Disabled" And StringInStr($aInfos[$i][2],"Button") And _StringinStr($aInfos[$i][5],$sNext) Then
$bKI_Chk=True
EndIf
If $bKI And $bKI_Chk And StringInStr($aInfos[$i][2],"Checkbox") Then
ToolTip("Klick auf: " & $aInfos[$i][5])
$bKI_Chk=False
EndIf
Next
If $bProgress=False Then $bKI=True
EndFunc
Func _StringInStr($sStr1,$sStr2)
Local $aStr2=StringSplit($sStr2,"|")
If IsArray($aStr2) Then
For $i=1 To $aStr2[0]
If StringInStr($sStr1,$aStr2[$i]) Then Return True
Next
Else
If StringInStr($sStr1,$sStr2) Then Return True
EndIf
Return False
EndFunc
Func _StringInStrFirst($sStr1,$sStr2)
Local $atmp=StringSplit($sStr1,"|")
Local $aStr2=StringSplit($sStr2,"|")
If IsArray($atmp)=True Then $sStr1=$atmp[1]
If IsArray($aStr2)Then
For $i=1 To $aStr2[0]
If StringInStr($sStr1,$aStr2[$i]) Then Return True
Next
Else
If StringInStr($sStr1,$sStr2) Then Return True
EndIf
Return False
EndFunc
Func _ToolTip($aInfos)
Local $sInfos=""
If IsArray($aInfos) Then
For $i=1 To $aInfos[0][0]
For $j=0 To 6
$sInfos&=StringFormat("%-20s",$aInfos[$i][$j])
Next
$sInfos&=@CRLF
Next
ToolTip($sInfos,0,0)
EndIf
EndFunc
Func _GetInfo($sPid)
Local $aRet
$Child=_ProcessGetChildren($sPID)
If IsArray($Child) Then
For $i= 1 To UBound($Child)-1
$aWin=_WinGetControls($Child[$i][0])
_ArrayConcatenate($aRet,$aWin)
$aRet=_GetInfo($Child[$i][0])
Next
Else
$aRet=_WinGetControls($sPID)
EndIf
Return $aRet
EndFunc
Func _WinGetControls($sPID)
Local $aPList = ProcessList(), $iPID
For $iiCount = 1 To $aPList[0][0]
If $aPList[$iiCount][1] = $sPID Then
If $sPID = 0 Then Return 0
$iPID &= $aPList[$iiCount][1] & Chr(01)
EndIf
Next
$iPID = StringSplit($iPID, Chr(01))
If $iPID = 0 Then Return SetError(1, 0, 0)
Local $aControlInfo[2][7], $nCount = 1
$OptWSC = Opt('WinSearchChildren', 0)
$OptWDHT = Opt('WinDetectHiddenText', 0)
Local $aWinList = WinList()
For $iCount = 1 To $aWinList[0][0]
For $xCount = 1 To $iPID[0]
If WinGetProcess($aWinList[$iCount][1]) = $iPID[$xCount] And $aWinList[$iCount][0] <> '' Then
;MsgBox(0,"",$aWinList[$iCount][0])
If BitAND(WinGetState($aWinList[$iCount][1]),4)=0 Or BitAND(WinGetState($aWinList[$iCount][1]),2)=0 Then ExitLoop
If BitAnd(_WinAPI_GetWindowLong($aWinList[$iCount][1],0xFFFFFFF0),0x08000000) Then ExitLoop
$sClass = WinGetClassList($aWinList[$iCount][1])
$Class=""
If StringInStr($sClass,"Button") Then $Class&=_GetCtrlClass($sClass,"Button") & @LF
If StringInStr($sClass,"Radio") Then $Class&=_GetCtrlClass($sClass,"Radio") & @LF
If StringInStr($sClass,"ComboBox") Then $Class&=_GetCtrlClass($sClass,"ComboBox") & @LF
If StringInStr($sClass,"Edit") Then $Class&=_GetCtrlClass($sClass,"Edit") & @LF
If StringInStr($sClass,"CheckBox") Then $Class&=_GetCtrlClass($sClass,"CheckBox") & @LF
If StringInStr($sClass,"Tree") Then $Class&=_GetCtrlClass($sClass,"Tree") & @LF
If StringInStr($sClass,"List") Then $Class&=_GetCtrlClass($sClass,"List") & @LF
If StringInStr($sClass,"Progress") Then $Class&=_GetCtrlClass($sClass,"Progress") & @LF
$class = StringSplit($class,@LF)
If Not IsArray($class) Then Return SetError(2,Default,0)
For $zCount= 1 To $class[0]
$Count = 1
While True
If IsHWnd(ControlGetHandle($aWinList[$iCount][1],"",$class[$zCount]&$count)) Then
If ControlCommand($aWinList[$iCount][1],"",$class[$zCount]&$count,"IsVisible", "") Then
If StringInStr($class[$zCount],"Tree") Then
$Temp=_GetTreeViewItems($aWinList[$iCount][1],$class[$zCount]&$count)
For $i=1 To $Temp[0]
If ControlTreeView($aWinList[$iCount][1],"",$class[$zCount]&$count,"Exists",$Temp[$i])=0 Then ContinueLoop
$nCount+=1
ReDim $aControlInfo[$nCount][7]
$aControlInfo[$nCount - 1][0] = $aWinList[$iCount][1]
$aControlInfo[$nCount - 1][1] = $class[$zCount]&$count
$aControlInfo[$nCount - 1][2] = $Temp[$i]
$aControlInfo[$nCount - 1][3] = "";
If ControlTreeView($aWinList[$iCount][1],"",$class[$zCount]&$count,"IsChecked",$Temp[$i]) Then
$aControlInfo[$nCount - 1][4] = "Checked"
Else
$aControlInfo[$nCount - 1][4] = ""
EndIf
$aControlInfo[$nCount - 1][5] = ControlTreeView($aWinList[$iCount][1],"",$class[$zCount]&$count,"GetText",$Temp[$i])
Next
ElseIf StringInStr($class[$zCount],"Listview") Then
$Temp=_GetListViewItems($aWinList[$iCount][1],$class[$zCount]&$count)
For $i=1 To $Temp[0][0]
$nCount+=1
ReDim $aControlInfo[$nCount][7]
$aControlInfo[$nCount - 1][0] = $aWinList[$iCount][1]
$aControlInfo[$nCount - 1][1] = $class[$zCount]&$count
$aControlInfo[$nCount - 1][2] = $Temp[$i][0]
$aControlInfo[$nCount - 1][3] = "";
If _GUICtrlListView_GetItemChecked(ControlGetHandle($aWinList[$iCount][1],"",$class[$zCount]&$count),$i-1) Then
$aControlInfo[$nCount - 1][4] = "Checked"
Else
$aControlInfo[$nCount - 1][4] = ""
EndIf
$aControlInfo[$nCount - 1][5] = $Temp[$i][1]
Next
ElseIf StringInStr($class[$zCount],"Listbox") Then
$Temp=_GetListBoxItems($aWinList[$iCount][1],ControlGetHandle($aWinList[$iCount][1],"",$class[$zCount]&$count))
For $i=1 To $Temp[0][0]
$nCount+=1
ReDim $aControlInfo[$nCount][7]
$aControlInfo[$nCount - 1][0] = $aWinList[$iCount][1]
$aControlInfo[$nCount - 1][1] = $class[$zCount]&$count
$aControlInfo[$nCount - 1][2] = $Temp[$i][0]
$aControlInfo[$nCount - 1][3] = "";
$aControlInfo[$nCount - 1][4] = "Checked"
$aControlInfo[$nCount - 1][5] = $Temp[$i][1]
Next
ElseIf StringInStr($class[$zCount],"Progress") Then
$nCount+=1
ReDim $aControlInfo[$nCount][7]
$aControlInfo[$nCount - 1][0] = $aWinList[$iCount][1]
$aControlInfo[$nCount - 1][1] = $class[$zCount]&$count
$Temp=DllCall("user32.dll", "int", "SendMessage", "hwnd", ControlGetHandle($aWinList[$iCount][1],"",$class[$zCount]&$count), "int", 0X400+8, "wparam", 0, "lparam", 0)
If Not @error Then $aControlInfo[$nCount - 1][2] = $Temp[0]
Else
$nCount+=1
ReDim $aControlInfo[$nCount][7]
$aControlInfo[$nCount - 1][0] = $aWinList[$iCount][1]
$aControlInfo[$nCount - 1][1] = ControlGetHandle($aWinList[$iCount][1],"",$class[$zCount]&$count)
$aControlInfo[$nCount - 1][2] = _GetCtrlType($aWinList[$iCount][1],$class[$zCount]&$count)
$aControlInfo[$nCount - 1][3] = _GetCtrlEnabled($aWinList[$iCount][1],$class[$zCount]&$count)
$aControlInfo[$nCount - 1][4] = _GetCtrlChecked($aWinList[$iCount][1],$class[$zCount]&$count)
$aControlInfo[$nCount - 1][5] = _GetCtrlText($aWinList[$iCount][1],$class[$zCount]&$count)
If StringInStr($aControlInfo[$nCount - 1][2],"Edit") Then $aControlInfo[$nCount - 1][6] = _GetNearestStaticText($aWinList[$iCount][1],$class[$zCount]&$count)
EndIf
EndIf
Else
ExitLoop
EndIf
$count = $count +1
WEnd
Next
EndIf
Next
Next
Opt('WinSearchChildren', $OptWSC)
Opt('WinDetectHiddenText', $OptWDHT)
If $nCount = 1 Then Return SetError(2, 0, 0)
$aControlInfo[0][0]=$nCount-1
Return $aControlInfo
EndFunc ;==>_WinGetInfoByPID
Func _GetNearestStaticText($hWnd,$sCtrl)
Local $iCnt=0,$aPos[1][2],$aTmp,$iNear,$iNumber=1
While 1
$iCnt+=1
If IsHWnd(ControlGetHandle($hWnd,"","Static"&$iCnt)) Then
ReDim $aPos[$iCnt+1][2]
$aTmp=ControlGetPos($hWnd,"","Static"&$iCnt)
$aPos[$iCnt][0]=$aTmp[0]
$aPos[$iCnt][1]=$aTmp[1]
Else
$iCnt-=1
ExitLoop
EndIf
WEnd
$aPos[0][0]=$iCnt
If $iCnt<1 Then Return ""
$aTmp=ControlGetPos($hWnd,"",$sCtrl)
If @error Then Return ""
$iNear=Abs($aTmp[1]-$aPos[1][1])
For $iCnt=2 To $aPos[0][0]
If Abs($aTmp[1]-$aPos[$iCnt][1])<$iNear Then
$iNear=Abs($aTmp[1]-$aPos[$iCnt][1])
$iNumber=$iCnt
EndIf
Next
Return ControlGetText($hWnd,"","Static" & $iNumber)
EndFunc
Func _GetListViewItems($hWnd,$hCtrl,$sRoot="")
Local $iCnt=ControlListView ($hWnd, "", $hCtrl, "GetItemCount")
Local $aRet[$iCnt+1][2]
For $i=1 To $iCnt
$aRet[$i][0]=$i
$aRet[$i][1]=ControlListView ($hWnd, "", $hCtrl, "GetText", $i-1)
Next
$aRet[0][0]=UBound($aRet)-1
Return $aRet
EndFunc
Func _GetListBoxItems($hWnd,$hCtrl,$sRoot="")
Local $iCnt=_GUICtrlListBox_GetCount($hCtrl)
Local $aRet[$iCnt+1][2]
For $i=1 To $iCnt
$aRet[$i][0]=$i
$aRet[$i][1]=_GUICtrlListBox_GetText($hCtrl, $i-1)
Next
$aRet[0][0]=UBound($aRet)-1
Return $aRet
EndFunc
Func _GetTreeViewItems($hWnd,$hCtrl,$sRoot="")
Local $iCnt=ControlTreeView ($hWnd, "", $hCtrl, "GetItemCount", $sRoot)
Local $aRet[$iCnt+1],$aTmp
For $i=1 To $iCnt
If $sRoot<>"" And StringRight($sRoot,1)<>"|" Then $sRoot&="|"
$aRet[$i]=$sRoot&"#" & String($i-1)
$aTmp=_GetTreeViewItems($hWnd,$hCtrl,$sRoot&"#" & String($i-1))
_ArrayConcatenate($aRet,$aTmp)
Next
$aRet[0]=UBound($aRet)-1
Return $aRet
EndFunc
Func _GetCtrlEnabled($hWnd,$sCtrl)
Local $sState=""
If ControlCommand($hWnd,"",$sCtrl,"IsEnabled", "") Then
$sState="Enabled"
Else
$sState="Disabled"
EndIf
Return $sState
EndFunc
Func _GetCtrlChecked($hWnd,$sCtrl)
Local $sState=""
If StringInStr($sCtrl,"Button")=0 And StringInStr($sCtrl,"CheckBox")=0 Then Return ""
If ControlCommand($hWnd,"",$sCtrl,"IsChecked", "") Then Return "Checked"
Return ""
EndFunc
Func _GetCtrlType($hWnd,$sCtrl)
If StringInStr($sCtrl,"Edit") Then Return "Edit"
If StringInStr($sCtrl,"ComboBox") Then Return "ComboBox"
If StringInStr($sCtrl,"CheckBox") Then Return "CheckBox"
If StringInStr($sCtrl,"Button") Then
Local Const $GWL_STYLE = 0xFFFFFFF0
Local $hCtrl = ControlGetHandle($hWnd, "", $sCtrl)
Local $style = _WinAPI_GetWindowLong($hCtrl, $GWL_STYLE)
If BitAND($style,0x0000000b)=0x0000000b Then
Return "Button"
ElseIf BitAND($style,2)=2 Then
Return "CheckBox"
ElseIf BitAND($style,4)=4 Then
Return "CheckBox"
ElseIf BitAND($style,9)=9 Then
Return "CheckBox"
Else
Return "Button"
EndIf
EndIf
;Return $sCtrl
EndFunc
Func _GetCtrlText($hWnd,$sCtrl)
Local $hCtrl = ControlGetHandle($hWnd, "", $sCtrl)
Local $sText=""
$sText=ControlGetText($hWnd,"",$hCtrl)
If @error Then Return ""
If StringInStr($sCtrl,"ComboBox") Then $sText&="|" & _GUICtrlComboBox_GetList($hCtrl)
If @error Then Return ""
Return StringLeft($sText,100)
EndFunc
Func _GetCtrlClass($sClasslist,$sClass)
Local $aSplit=StringSplit($sClasslist,@LF)
For $i=1 To $aSplit[0]
If StringInStr($aSplit[$i],$sClass) Then Return $aSplit[$i]
Next
EndFunc
Func _ProcessGetChildren($i_pid) ; First level children processes only
Local Const $TH32CS_SNAPPROCESS = 0x00000002
Local $a_tool_help = DllCall("Kernel32.dll", "long", "CreateToolhelp32Snapshot", "int", $TH32CS_SNAPPROCESS, "int", 0)
If IsArray($a_tool_help) = 0 Or $a_tool_help[0] = -1 Then Return SetError(1, 0, $i_pid)
Local $tagPROCESSENTRY32 = _
DllStructCreate _
( _
"dword dwsize;" & _
"dword cntUsage;" & _
"dword th32ProcessID;" & _
"uint th32DefaultHeapID;" & _
"dword th32ModuleID;" & _
"dword cntThreads;" & _
"dword th32ParentProcessID;" & _
"long pcPriClassBase;" & _
"dword dwFlags;" & _
"char szExeFile[260]" _
)
DllStructSetData($tagPROCESSENTRY32, 1, DllStructGetSize($tagPROCESSENTRY32))
Local $p_PROCESSENTRY32 = DllStructGetPtr($tagPROCESSENTRY32)
Local $a_pfirst = DllCall("Kernel32.dll", "int", "Process32First", "long", $a_tool_help[0], "ptr", $p_PROCESSENTRY32)
If IsArray($a_pfirst) = 0 Then Return SetError(2, 0, $i_pid)
Local $a_pnext, $a_children[11][2] = [[10]], $i_child_pid, $i_parent_pid, $i_add = 0
$i_child_pid = DllStructGetData($tagPROCESSENTRY32, "th32ProcessID")
If $i_child_pid <> $i_pid Then
$i_parent_pid = DllStructGetData($tagPROCESSENTRY32, "th32ParentProcessID")
If $i_parent_pid = $i_pid Then
$i_add += 1
$a_children[$i_add][0] = $i_child_pid
$a_children[$i_add][1] = DllStructGetData($tagPROCESSENTRY32, "szExeFile")
EndIf
EndIf
While 1
$a_pnext = DLLCall("Kernel32.dll", "int", "Process32Next", "long", $a_tool_help[0], "ptr", $p_PROCESSENTRY32)
If IsArray($a_pnext) And $a_pnext[0] = 0 Then ExitLoop
$i_child_pid = DllStructGetData($tagPROCESSENTRY32, "th32ProcessID")
If $i_child_pid <> $i_pid Then
$i_parent_pid = DllStructGetData($tagPROCESSENTRY32, "th32ParentProcessID")
If $i_parent_pid = $i_pid Then
If $i_add = $a_children[0][0] Then
ReDim $a_children[$a_children[0][0] + 11][2]
$a_children[0][0] = $a_children[0][0] + 10
EndIf
$i_add += 1
$a_children[$i_add][0] = $i_child_pid
$a_children[$i_add][1] = DllStructGetData($tagPROCESSENTRY32, "szExeFile")
EndIf
EndIf
WEnd
If $i_add <> 0 Then
ReDim $a_children[$i_add + 1][2]
$a_children[0][0] = $i_add
EndIf
DllCall("Kernel32.dll", "int", "CloseHandle", "long", $a_tool_help[0])
If $i_add Then Return $a_children
Return SetError(3, 0, 0)
EndFunc
Func _Exit()
Exit
EndFunc
lgE