1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. eukalyptus

Beiträge von eukalyptus

  • UniversalInstaller

    • eukalyptus
    • 3. November 2008 um 19:26

    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
    [autoit]

    #include <WinAPI.au3>
    #include<Array.au3>
    #Include <GuiComboBox.au3>
    #include <GuiListView.au3>
    #Include <GuiListBox.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $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"

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    Do
    Sleep(500)
    $aInfos=_GetInfo($sPID)
    ;_ToolTip($aInfos)
    Sleep(500)
    _Install_KI($aInfos)
    Until ProcessExists($sPID)=0

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GetCtrlEnabled($hWnd,$sCtrl)
    Local $sState=""
    If ControlCommand($hWnd,"",$sCtrl,"IsEnabled", "") Then
    $sState="Enabled"
    Else
    $sState="Disabled"
    EndIf
    Return $sState
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    lgE

  • BigInteger UDF

    • eukalyptus
    • 30. Oktober 2008 um 17:33

    Wurzeln müßen noch etwas warten...zuerst will ich mal alles andere gescheit getestet wissen ;)

    Hab einen Bug bei der Division entfernt und eine Debugfunktion eingebaut.
    Wenn man die Global Const $BigNum_Debug = True setzt, dann wird ein TXT-File mit den einzelnen Rechenschritten erstellt.

    Dann seht ihr mal, wie die Algorithmen eigentlich funktionieren ;)

    [autoit]

    _BigNum_Add("1000000000000000000000000000","12345678901234567890")
    Run('notepad.exe "' & @ScriptDir & '\BigNum_Debug.txt"')

    [/autoit]

    lgE

  • Array für Beginner

    • eukalyptus
    • 28. Oktober 2008 um 22:44

    Nochn Beispiel:

    Du hast einen Kasten Bier (1D-Array):
    $Bier[1]=1 Flasche
    $Bier[2]=2 Flasche
    ...
    $Bier[20]=20 Flasche


    Nun hast du einen Kühlschrank mit 5 Fächern, auf die jeweils 20 Flaschen Bier passen (2D-Array):
    $Bier[1][1]=1 Fach, 1 Flasche
    $Bier[2][1]=2 Fach, 1 Flasche
    $Bier[5][20]=5 Fach, 20 Flasche


    Auf Grund deines enormen Bierkonsums, besorgst du dir noch 2 Kühlschränke (3D-Array):
    $Bier[1][1][1]=1 Kühlschrank, 1 Fach, 1 Flasche
    $Bier[2][3][15]=2 Kühlschrank, 3 Fach, 15 Flasche
    $Bier[3][5][20]=3 Kühlschrank, 5 Fach, 20 Flasche


    So, nun wollen wir die Kühlschränke mal befüllen:
    In den ersten Kühlschrank gebe ich ins 2 Fach an 7 Stelle ein Paulaner $Bier[1][2][7]="Paulaner"
    2 Kühlschrank, 4 Fach an 12 Stelle kommt ein Becks $Bier[2][4][12]="Becks" usw...

    Wenn ich nun das Paulaner trinken will, nehme ich das $Bier[1][2][7]
    MsgBox(0,"1 Kühlschrank 2 Fach 7 Flasche",$Bier[1][2][7])
    Alles klar? ;)

    lgE

    Edit: In Wirklichkeit trinke ich aber grad ein Wieselburger - Bin ja Österreicher :D

  • BigInteger UDF

    • eukalyptus
    • 28. Oktober 2008 um 11:14

    So, nun ist Version 1 mal fertig.

    Hinzugekommen ist _BigNum_Mod (Rest einer Division)
    Durch eigene Add,Sub,Compare-Functions ist die Division nun fast doppelt so schnell.

    Bugs oder Erweiterungsvorschläge bitte sogleich posten ;)

    lgE

  • Array für Beginner

    • eukalyptus
    • 28. Oktober 2008 um 05:40

    Vielleicht hilft dir diese Erklärung:

    Stell dir ein Array als Adresse vor. (und jedes Haus als Variable)


    Spoiler anzeigen


    Angenommen, es gibt auf der Welt nur 5 Häuser, dann reicht ein 1D Array ;)
    $Adresse[1]=Hausnummer 1
    $Adresse[2]=Hausnummer 2
    $Adresse[3]=Hausnummer 3
    $Adresse[4]=Hausnummer 4
    $Adresse[5]=Hausnummer 5


    Nun gbt es 3 Dörfer mit jeweils 5 Häusern - 2D Array
    $Adresse[1][1]=Dorf1-Hausnummer 1
    $Adresse[1][2]=Dorf1-Hausnummer 2
    $Adresse[1][3]=Dorf1-Hausnummer 3
    $Adresse[1][4]=Dorf1-Hausnummer 4
    $Adresse[1][5]=Dorf1-Hausnummer 5

    $Adresse[2][1]=Dorf2-Hausnummer 1
    $Adresse[2][2]=Dorf2-Hausnummer 2
    $Adresse[2][3]=Dorf2-Hausnummer 3
    $Adresse[2][4]=Dorf2-Hausnummer 4
    $Adresse[2][5]=Dorf2-Hausnummer 5

    $Adresse[3][1]=Dorf3-Hausnummer 1
    $Adresse[3][2]=Dorf3-Hausnummer 2
    $Adresse[3][3]=Dorf3-Hausnummer 3
    $Adresse[3][4]=Dorf3-Hausnummer 4
    $Adresse[3][5]=Dorf3-Hausnummer 5


    Und schließlich haben wir 2 Kontinente mit jeweils 3 Dörfern/5 Häuser:
    $Adresse[1][1][1]=Kontinent1-Dorf1-Hausnummer 1
    $Adresse[1][1][2]=Kontinent1-Dorf1-Hausnummer 2
    $Adresse[1][1][3]=Kontinent1-Dorf1-Hausnummer 3
    $Adresse[1][1][4]=Kontinent1-Dorf1-Hausnummer 4
    $Adresse[1][1][5]=Kontinent1-Dorf1-Hausnummer 5

    $Adresse[1][2][1]=Kontinent1-Dorf2-Hausnummer 1
    $Adresse[1][2][2]=Kontinent1-Dorf2-Hausnummer 2
    $Adresse[1][2][3]=Kontinent1-Dorf2-Hausnummer 3
    $Adresse[1][2][4]=Kontinent1-Dorf2-Hausnummer 4
    $Adresse[1][2][5]=Kontinent1-Dorf2-Hausnummer 5

    $Adresse[1][3][1]=Kontinent1-Dorf3-Hausnummer 1
    $Adresse[1][3][2]=Kontinent1-Dorf3-Hausnummer 2
    $Adresse[1][3][3]=Kontinent1-Dorf3-Hausnummer 3
    $Adresse[1][3][4]=Kontinent1-Dorf3-Hausnummer 4
    $Adresse[1][3][5]=Kontinent1-Dorf3-Hausnummer 5


    $Adresse[2][1][1]=Kontinent2-Dorf1-Hausnummer 1
    $Adresse[2][1][2]=Kontinent2-Dorf1-Hausnummer 2
    $Adresse[2][1][3]=Kontinent2-Dorf1-Hausnummer 3
    $Adresse[2][1][4]=Kontinent2-Dorf1-Hausnummer 4
    $Adresse[2][1][5]=Kontinent2-Dorf1-Hausnummer 5

    $Adresse[2][2][1]=Kontinent2-Dorf2-Hausnummer 1
    $Adresse[2][2][2]=Kontinent2-Dorf2-Hausnummer 2
    $Adresse[2][2][3]=Kontinent2-Dorf2-Hausnummer 3
    $Adresse[2][2][4]=Kontinent2-Dorf2-Hausnummer 4
    $Adresse[2][2][5]=Kontinent2-Dorf2-Hausnummer 5

    $Adresse[2][3][1]=Kontinent2-Dorf3-Hausnummer 1
    $Adresse[2][3][2]=Kontinent2-Dorf3-Hausnummer 2
    $Adresse[2][3][3]=Kontinent2-Dorf3-Hausnummer 3
    $Adresse[2][3][4]=Kontinent2-Dorf3-Hausnummer 4
    $Adresse[2][3][5]=Kontinent2-Dorf3-Hausnummer 5

    lgE

  • rekursivität :(

    • eukalyptus
    • 27. Oktober 2008 um 23:37

    na so:

    [autoit]

    Global $K0 = 1000
    Global $p = 2.5
    Global $n = 5

    [/autoit][autoit][/autoit][autoit]

    MsgBox(0, 'Gesamtkapital', Round(_Kapital($K0, $p, $n), 2) & ' €')

    [/autoit][autoit][/autoit][autoit]

    Func _Kapital($K0, $p, $n)
    If $n = 0 Then Return $K0
    $n -= 1
    $K0=_Kapital($K0 + ($K0 * $p / 100), $p, $n)
    Return $K0
    EndFunc

    [/autoit]

    lgE

  • BigInteger UDF

    • eukalyptus
    • 24. Oktober 2008 um 16:35

    Na dann immer her mit der Wurzel! ;)
    Die UDF soll ja nicht nur auf die Grundrechenarten beschränkt bleiben...

    Soll ich die Funktionen eigentlich jetzt umbenennen? z.b. auf BigNum_

    lgE

  • Welcher Style unterdrückt Größenänderung per Klick auf Titlebar?

    • eukalyptus
    • 23. Oktober 2008 um 00:43

    Und wärst du ein Mädel, würd ich mich darauf freuen! ;)

  • Welcher Style unterdrückt Größenänderung per Klick auf Titlebar?

    • eukalyptus
    • 22. Oktober 2008 um 16:28

    Hi

    versuch mal: Opt("GUIEventOptions",1)

    lgE

  • BigInteger UDF

    • eukalyptus
    • 18. Oktober 2008 um 00:16

    Ich habe mal die besten Elemente des Wettbewerbs kombiniert und konnte nochmals 10% schneller werden :)
    dann hab ich die UDF gleich mal auf alle 4 Grundrechenarten ausgebaut.
    und heute noch auf Dezimalstellen erweitert.
    (Ist noch nicht gründlich getestet, und ich hab auch noch keine Errorcodes usw. eingebaut... Beta halt;))

    Dadurch ist die Performance wieder etwas schlechter geworden (0.0557 beim µit-Benchmark), aber immer noch ganz flink!

    Kann jemand das Script gründlich testen? mein BigInt-Rechner schafft leider keine Dezimalzahlen.

    Erklärung zu den Algo´s folgt irgendwann nach...
    Wär schön, wenn die UDF langsam wachsen und immer mehr Funktionen bekommen würde...bzw. noch bessere Algo´s...

    EDIT: Neue Version: Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.

    lgE


    BigInt BigDec BigNum BigNumber BigDecimal BigInteger _BigNum_Add _BigNum_Sub _BigNum_Mul _BigNum_Div _BigNum_Mod _BigNum_Round _BigNum_Compare

    Dateien

    BigNum.au3 28,77 kB – 753 Downloads
  • Programm.exe in einem AutoIt fenster ausführen

    • eukalyptus
    • 14. Oktober 2008 um 20:36

    Lol - und ich dachte, bei Notepad und SndRec32 habe ich 2 Programme gewählt, die auf jedem WindowsPC vorhanden sind...
    Und die Class hab ich verwendet, weil ich dachte, so unabhängig von der Betriebssystem-Sprache zu sein (Untitled vs. Unbenannt ;))

    Tja, ich wollte das damals auch tatsächlich posten, hab aber leider vergessen - sorry!

    lgE

  • Programm.exe in einem AutoIt fenster ausführen

    • eukalyptus
    • 14. Oktober 2008 um 19:27

    Hoffe daß es das ist, was du gesucht hast:

    1) einfaches Beispiel mit Notepad.exe

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    Opt("TrayIconDebug",1)

    [/autoit] [autoit][/autoit] [autoit]

    $hGui = GUICreate("Test GUI", 320, 240)
    GUISetState(@SW_HIDE, $hGui)

    [/autoit] [autoit][/autoit] [autoit]

    $hPid=Run(@SystemDir & '\notepad.exe',"", @SW_HIDE)
    WinWait("[CLASS:Notepad]", "", 5)
    $hChild = WinGetHandle("[CLASS:Notepad]", "")
    $NEXSTYLE = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hChild, "int", 236)
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hChild, "int", 236, "int", BitOR($NEXSTYLE[0], $WS_EX_MDICHILD))
    DllCall("user32.dll", "int", "SetParent", "hwnd", $hChild, "hwnd", $hGui)
    WinMove($hChild, "", 0, 0,320,240)
    GUISetState(@SW_SHOW, $hGui)
    WinSetState($hChild,"",@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    While GUIGetMsg()<>-3
    Sleep(1)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func OnAutoItExit()
    ProcessClose($hPid)
    EndFunc

    [/autoit]

    2) Beispiel mit SndRec32.exe, wobei teilweise Controls ausgeblendet bzw. verschoben wurden

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    Opt("TrayIconDebug",1)

    [/autoit] [autoit][/autoit] [autoit]

    $hGui = GUICreate("Test GUI", 380, 380)
    GUISetState(@SW_HIDE, $hGui)

    [/autoit] [autoit][/autoit] [autoit]

    $hPid=Run(@SystemDir & '\sndrec32.exe /play "' & @WindowsDir & '\Media\tada.wav"',"", @SW_HIDE)
    WinWait("[CLASS:SoundRec]", "", 5)
    $hChild = WinGetHandle("[CLASS:SoundRec]", "")
    $NEXSTYLE = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hChild, "int", 236)
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hChild, "int", 236, "int", BitOR($NEXSTYLE[0], $WS_EX_MDICHILD))
    DllCall("user32.dll", "int", "SetParent", "hwnd", $hChild, "hwnd", $hGui)

    [/autoit] [autoit][/autoit] [autoit]

    WinMove($hChild, "", -6, -40 ,400,450)
    ControlHide($hChild,"","shadowframe1")
    ControlHide($hChild,"","noflickertext1")
    ControlHide($hChild,"","noflickertext2")
    ControlHide($hChild,"","shadowframe2")
    ControlHide($hChild,"","noflickertext3")
    ControlHide($hChild,"","noflickertext4")
    ControlHide($hChild,"","msctls_trackbar321")
    ControlMove($hChild,"","wavedisplay1",150,150)
    ControlMove($hChild,"","Button1",10,10,50,50)
    ControlMove($hChild,"","Button2",70,10,50,50)
    ControlMove($hChild,"","Button3",130,10,50,50)
    ControlMove($hChild,"","Button4",190,10,50,50)
    ControlMove($hChild,"","Button5",250,10,50,50)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW, $hGui)
    WinSetState($hChild,"",@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    While GUIGetMsg()<>-3
    Sleep(1)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func OnAutoItExit()
    ProcessClose($hPid)
    EndFunc

    [/autoit]

    Ich habe das z.b. mit VirtualDub gemacht, damit ich das VirtualDub-Fenster während einer Videoaufnahme disablen kann, man das Fenster aber trotzdem verschieben kann...

    lgE

  • Programm.exe in einem AutoIt fenster ausführen

    • eukalyptus
    • 14. Oktober 2008 um 17:01

    Es geht!

    ich hab das in einem meiner Projekte gemacht.

    Du mußt dich nur etwas gedulden, bis ich von der Arbeit daheim bin, dann kann ich das posten!

    lgE

  • UniversalInstaller

    • eukalyptus
    • 9. Oktober 2008 um 17:56

    Wie kann man folgendes Problem lösen?

    z.b.: Bei der Installation von Vista_XP_Virtual_Desktop_Manager kommt auf der 2 Seite eine Checkbox
    Diese trägt den Classname "Button1"

    Wie erkennt man nun, daß es sich um eine Checkbox handelt, und nicht um einen normalen Button?

    //Edit: Problem gelöst ;)

    Spoiler anzeigen
    [autoit]

    #include <WinAPI.au3>
    Global Const $GWL_STYLE = 0xFFFFFFF0
    $hWnd = ControlGetHandle("Vista/XP Virtual Desktops Setup", "", "Button1")
    $style = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE)
    If BitAND($style, 2) Then
    MsgBox(0, "", "CheckBox")
    ElseIf BitAND($style, 1) Then
    MsgBox(0, "", "Button")
    EndIf

    [/autoit]
  • CPU Auslastung Auslesen

    • eukalyptus
    • 9. Oktober 2008 um 16:52

    ist schon etwas alt, k.a. woher ich die hab!?

    cpuusage.au3:

    Spoiler anzeigen
    [autoit]

    Global $liOldIdleTime = 0
    Global $liOldSystemTime = 0
    ; \/\/\/ Should do this \/\/\/ to initialize CPU time calculations, but not necessary. First call will, with a delay.
    ; CurrentCPU(1)

    [/autoit] [autoit][/autoit] [autoit]

    ;For $n = 1 to 20
    ; $a = CurrentCPU()
    ; ToolTip(@error & @LF & $a)
    ; Sleep(500)
    ;Next

    [/autoit] [autoit][/autoit] [autoit]

    Func CurrentCPU($init = 0)
    Local $SYS_BASIC_INFO = 0
    Local $SYS_PERFORMANCE_INFO = 2
    Local $SYS_TIME_INFO = 3

    [/autoit] [autoit][/autoit] [autoit]

    $SYSTEM_BASIC_INFORMATION = DllStructCreate("int;uint;uint;uint;uint;uint;uint;ptr;ptr;uint;byte;byte;short")
    $status = DllCall("ntdll.dll", "int", "NtQuerySystemInformation", "int", $SYS_BASIC_INFO, _
    "ptr", DllStructGetPtr($SYSTEM_BASIC_INFORMATION), _
    "int", DllStructGetSize($SYSTEM_BASIC_INFORMATION), _
    "int", 0)

    If $status[0] Then Return -1

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $SYSTEM_PERFORMANCE_INFORMATION = DllStructCreate("int64;int[76]")
    $SYSTEM_TIME_INFORMATION = DllStructCreate("int64;int64;int64;uint;int")

    $status = DllCall("ntdll.dll", "int", "NtQuerySystemInformation", "int", $SYS_TIME_INFO, _
    "ptr", DllStructGetPtr($SYSTEM_TIME_INFORMATION), _
    "int", DllStructGetSize($SYSTEM_TIME_INFORMATION), _
    "int", 0)

    If $status[0] Then Return -2

    [/autoit] [autoit][/autoit] [autoit]

    $status = DllCall("ntdll.dll", "int", "NtQuerySystemInformation", "int", $SYS_PERFORMANCE_INFO, _
    "ptr", DllStructGetPtr($SYSTEM_PERFORMANCE_INFORMATION), _
    "int", DllStructGetSize($SYSTEM_PERFORMANCE_INFORMATION), _
    "int", 0)

    [/autoit] [autoit][/autoit] [autoit]

    If $status[0] Then Return -3

    If $init = 1 Or $liOldIdleTime = 0 Then
    $liOldIdleTime = DLLStructGetData($SYSTEM_PERFORMANCE_INFORMATION,1)
    $liOldSystemTime = DLLStructGetData($SYSTEM_TIME_INFORMATION,2)
    Sleep(1000)
    If $init = 1 Then Return -99
    Else
    $dbIdleTime = DLLStructGetData($SYSTEM_PERFORMANCE_INFORMATION,1) - $liOldIdleTime
    $dbSystemTime = DLLStructGetData($SYSTEM_TIME_INFORMATION,2) - $liOldSystemTime
    $liOldIdleTime = DLLStructGetData($SYSTEM_PERFORMANCE_INFORMATION,1)
    $liOldSystemTime = DLLStructGetData($SYSTEM_TIME_INFORMATION,2)

    [/autoit] [autoit][/autoit] [autoit]

    $dbIdleTime = $dbIdleTime / $dbSystemTime

    [/autoit] [autoit][/autoit] [autoit]

    $dbIdleTime = 100.0 - $dbIdleTime * 100.0 / DLLStructGetData($SYSTEM_BASIC_INFORMATION,11) + 0.5

    Return $dbIdleTime
    EndIf
    $SYSTEM_PERFORMANCE_INFORMATION = 0
    $SYSTEM_TIME_INFORMATION = 0
    WEnd
    EndFunc

    [/autoit]

    beispiel:

    Spoiler anzeigen
    [autoit]

    #include "Cpuusage.au3"

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    ToolTip(Round(CurrentCpu(),0) & "%")
    Sleep(100)
    WEnd

    [/autoit]

    lgE

  • UniversalInstaller

    • eukalyptus
    • 7. Oktober 2008 um 15:14

    Hab mal versucht obiges Script so zu erweitern, daß nur alle relevanten Controls angezeigt werden:

    Spoiler anzeigen
    [autoit]

    #include<Array.au3>
    ;#include<ArrayMore.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("TrayIconDebug",1)

    [/autoit] [autoit][/autoit] [autoit]

    HotKeySet("^!e","_Exit")

    [/autoit] [autoit][/autoit] [autoit]

    Global $Infos="", $Controls

    [/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

    [/autoit] [autoit][/autoit] [autoit]

    Do
    Sleep(500)
    $Infos=""
    $Controls=""
    _GetInfo($sPID)
    ;_ToolTip($Infos)
    ToolTip($Controls,0,0)
    Until ProcessExists($sPID)=0

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GetInfo($sPid)
    $Child=_ProcessGetChildren($sPID)
    If IsArray($Child) Then
    For $i= 1 To UBound($Child)-1
    $aWin=_WinGetInfoByPID($Child[$i][0])
    If Not @error Then
    _AddInfos($aWin)
    _GetInfo($Child[$i][0])
    EndIf
    Next
    Else
    $aWin=_WinGetInfoByPID($sPID)
    If Not @error Then _AddInfos($aWin)
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _AddInfos($Array)
    Local $String=""
    For $i=1 To UBound($Array,1)-1
    For $j=1 To UBound($Array,2)-1
    If $j=2 Then _AddControls(_listcontrols($Array[$i][2]))
    $String&=$Array[$i][$j]
    Next
    $String&=@CRLF & "------------" & @CRLF
    Next
    $Infos&=$String
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _AddControls($Array)
    Local $String="", $Temp
    For $i=1 To UBound($Array,1)-1
    If StringInStr($Array[$i][0],"Button") Or StringInStr($Array[$i][0],"Edit") Or StringInStr($Array[$i][0],"Combobox") Or StringInStr($Array[$i][0],"Checkbox") Then
    $Temp=$Array[$i][3] & "_" & $Array[$i][0] & ": " & $Array[$i][1]
    If StringLen($Temp)>100 Then $Temp=StringLeft($Temp,100)
    If StringInStr($Controls,$Temp)=0 Then
    $String=@CRLF&WinGetTitle($Array[1][2])&@CRLF&"--------------------------------------------"&@CRLF
    ExitLoop
    EndIf
    EndIf
    Next
    For $i=1 To UBound($Array,1)-1
    If StringInStr($Array[$i][0],"Button") Or StringInStr($Array[$i][0],"Edit") Or StringInStr($Array[$i][0],"Combobox") Or StringInStr($Array[$i][0],"Checkbox") Then
    $Temp=$Array[$i][3] & "_" & $Array[$i][0] & ": " & $Array[$i][1]
    If StringLen($Temp)>100 Then $Temp=StringLeft($Temp,100)
    If StringInStr($Controls,$Temp)=0 Then $String&=$Temp & @CRLF
    EndIf
    Next
    If $String<>"" Then $Controls&=$String&"--------------------------------------------"&@CRLF
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _WinGetInfoByPID($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 $aStoreHwndAndText[2][9], $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
    Local $aWinPos = WinGetPos($aWinList[$iCount][1])
    Local $aWinClient = WinGetClientSize($aWinList[$iCount][1])
    $nCount += 1
    ReDim $aStoreHwndAndText[$nCount][9]
    $aStoreHwndAndText[$nCount - 1][1] = $aWinList[$iCount][0]
    $aStoreHwndAndText[$nCount - 1][2] = $aWinList[$iCount][1]
    $aStoreHwndAndText[$nCount - 1][3] = WinGetText($aWinList[$iCount][1])
    $aStoreHwndAndText[$nCount - 1][4] = $aWinPos[0]
    $aStoreHwndAndText[$nCount - 1][5] = $aWinPos[1]
    $aStoreHwndAndText[$nCount - 1][6] = $aWinClient[0]
    $aStoreHwndAndText[$nCount - 1][7] = $aWinClient[1]
    $aStoreHwndAndText[$nCount - 1][8] = WinGetClassList($aWinList[$iCount][1])
    EndIf
    Next
    Next
    Opt('WinSearchChildren', $OptWSC)
    Opt('WinDetectHiddenText', $OptWDHT)
    If $nCount = 1 Then Return SetError(2, 0, 0)
    Return $aStoreHwndAndText
    EndFunc ;==>_WinGetInfoByPID

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _listcontrols($HWND)
    If Not WinExists($HWND) Then Return SetError(1,Default,0)
    $class = WinGetClassList($HWND)
    $class = StringSplit($class,@LF)
    If Not IsArray($class) Then Return SetError(2,Default,0)
    _Array2DDblDel($class)
    Local $ret[1][4]
    For $i = 1 To UBound($class)-1
    $count = 1
    While True
    If IsHWnd(ControlGetHandle($HWND,"",$class[$i]&$count)) Then
    If ControlCommand($HWND,"",$class[$i]&$count,"IsVisible", "") And ControlCommand($HWND,"",$class[$i]&$count,"IsEnabled", "") Then
    ReDim $ret[UBound($ret)+1][4]
    $ret[UBound($ret)-1][0]=$class[$i]&$count
    $ret[UBound($ret)-1][1]=ControlGetText($HWND,"",$class[$i]&$count)
    $ret[UBound($ret)-1][2]=$HWND
    If ControlCommand($HWND,"",$class[$i]&$count,"IsChecked", "")=1 Then
    $ret[UBound($ret)-1][3]="Checked"
    Else
    $ret[UBound($ret)-1][3]="-"
    EndIf
    EndIf
    Else
    ExitLoop
    EndIf
    $count = $count +1
    WEnd
    Next
    $ret[0][0] = UBound($ret) -1
    ;_ArrayDisplay($ret)
    Return $ret
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Array2DDblDel(ByRef $ARRAY, $CASESENS=0)
    Local $arTmp[1] = [''], $dbl = 0, $count = 0, $x, $l, $val, $valTmp, $i, $k
    If ( Not IsArray($ARRAY) ) Then
    SetError(1)
    Return 0
    EndIf
    Local $Ubound2nd = UBound($ARRAY,2)
    If @error = 2 Then
    For $i = 0 To UBound($ARRAY)-1
    $dbl = 0
    For $k = 0 To UBound($arTmp)-1
    Switch $CASESENS
    Case 0
    If $arTmp[$k] = $ARRAY[$i] Then
    $dbl = 1
    $count += 1
    EndIf
    Case 1
    If $arTmp[$k] == $ARRAY[$i] Then
    $dbl = 1
    $count += 1
    EndIf
    EndSwitch
    Next
    If $dbl = 0 Then
    If $arTmp[0] = "" Then
    $arTmp[0] = $ARRAY[$i]
    Else
    ReDim $arTmp[UBound($arTmp)+1]
    $arTmp[UBound($arTmp)-1] = $ARRAY[$i]
    EndIf
    Else
    $dbl = 0
    EndIf
    Next
    Else
    ReDim $arTmp[1][$Ubound2nd]
    $arTmp[0][0] = ''
    $x = 0
    For $i = 0 To UBound($ARRAY)-1
    $dbl = 0
    $val = ''
    $valTmp = ''
    For $l = 0 To $Ubound2nd-1
    $val &= $ARRAY[$i][$l]
    Next
    For $k = 0 To UBound($arTmp)-1
    For $l = 0 To $Ubound2nd-1
    $valTmp &= $arTmp[$k][$l]
    Next
    Switch $CASESENS
    Case 0
    If $valTmp = $val Then
    $dbl = 1
    $count += 1
    EndIf
    Case 1
    If $valTmp == $val Then
    $dbl = 1
    $count += 1
    EndIf
    EndSwitch
    $valTmp = ''
    Next
    If $dbl = 0 Then
    If $x = 1 Then ReDim $arTmp[UBound($arTmp)+1][$Ubound2nd]
    For $l = 0 To $Ubound2nd-1
    If $arTmp[0][0] = '' Or $x = 0 Then
    $arTmp[0][$l] = $ARRAY[0][$l]
    If $l = $Ubound2nd-1 Then $x = 1
    Else
    $arTmp[UBound($arTmp)-1][$l] = $ARRAY[$i][$l]
    $x = 2
    If $l = $Ubound2nd-1 Then $x = 1
    EndIf
    Next
    Else
    $dbl = 0
    EndIf
    Next
    EndIf
    $ARRAY = $arTmp
    Return $count
    EndFunc ; ==>_ArrayDblDel

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    Damit kann man mal überprüfen, welche Install-versionen damit noch nicht abgedeckt sind...
    zu Testzwecken solls mal reichen ;)

    lgE

  • UniversalInstaller

    • eukalyptus
    • 7. Oktober 2008 um 12:54

    *.msi lassen sich nur mit Shellexecute starten...
    da brauchen wir noch eine Lösung, um an die richtige PID der msiexec.exe zu kommen...

    //Edit: gelöst, Siehe oben: PID von msi wird als Child von Autoit ermittelt :D

    Welche Dateien kann man noch installieren? *.inf?

    lgE

  • UniversalInstaller

    • eukalyptus
    • 7. Oktober 2008 um 12:12

    Also hier mal ein Ansatz:

    Dieses Testscript ermittelt alle Window-Infos der gestarteten EXE, sowie die Daten aller Child-Prozesse (Adobe Reader Setup startet nach ein paar Sekunden z.b. msiexec.exe)
    Also sollten alle Fenster, die während der Installation aufpoppen und zur Installation gehören ermittelt werden.

    Diese Script ist nur mal zum Testen; man muß sich manuell durch die Installation klicken und die Infos werden im Tooltip angezeigt...

    Die _WinGetInfoByPID hab ich aus einem Script von GtaSpider
    (leicht verändert, da versteckte Fenster nicht gefunden werden sollen)
    _ProcessGetChildren ist aus dem englischen Forum.

    nur probehalber mit 7zip und Adobe Reader von IOM4 getestet...

    Spoiler anzeigen
    [autoit]

    HotKeySet("^!e","_Exit")

    [/autoit] [autoit][/autoit] [autoit]

    Global $Infos=""
    Global Const $WM_USER = 0x400
    Global Const $TTM_SETTIPBKCOLOR = ($WM_USER + 19)
    Global Const $TTM_SETTIPTEXTCOLOR = ($WM_USER + 20)

    [/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

    [/autoit] [autoit][/autoit] [autoit]

    Do
    Sleep(500)
    $Infos=""
    _GetInfo($sPID)
    _ToolTip($Infos)
    Until ProcessExists($sPID)=0

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GetInfo($sPid)
    $Child=_ProcessGetChildren($sPID)
    If IsArray($Child) Then
    For $i= 1 To UBound($Child)-1
    $aWin=_WinGetInfoByPID($Child[$i][0])
    If Not @error Then
    _AddInfos($aWin)
    _GetInfo($Child[$i][0])
    EndIf
    Next
    Else
    $aWin=_WinGetInfoByPID($sPID)
    If Not @error Then _AddInfos($aWin)
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _AddInfos($Array)
    Local $String=""
    For $i=1 To UBound($Array,1)-1
    For $j=1 To UBound($Array,2)-1
    $String&=$Array[$i][$j]
    Next
    $String&=@CRLF & "------------" & @CRLF
    Next
    $Infos&=$String
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _WinGetInfoByPID($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 $aStoreHwndAndText[2][9], $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
    Local $aWinPos = WinGetPos($aWinList[$iCount][1])
    Local $aWinClient = WinGetClientSize($aWinList[$iCount][1])
    $nCount += 1
    ReDim $aStoreHwndAndText[$nCount][9]
    $aStoreHwndAndText[$nCount - 1][1] = $aWinList[$iCount][0]
    $aStoreHwndAndText[$nCount - 1][2] = $aWinList[$iCount][1]
    $aStoreHwndAndText[$nCount - 1][3] = WinGetText($aWinList[$iCount][1])
    $aStoreHwndAndText[$nCount - 1][4] = $aWinPos[0]
    $aStoreHwndAndText[$nCount - 1][5] = $aWinPos[1]
    $aStoreHwndAndText[$nCount - 1][6] = $aWinClient[0]
    $aStoreHwndAndText[$nCount - 1][7] = $aWinClient[1]
    $aStoreHwndAndText[$nCount - 1][8] = WinGetClassList($aWinList[$iCount][1])
    EndIf
    Next
    Next
    Opt('WinSearchChildren', $OptWSC)
    Opt('WinDetectHiddenText', $OptWDHT)
    If $nCount = 1 Then Return SetError(2, 0, 0)
    Return $aStoreHwndAndText
    EndFunc ;==>_WinGetInfoByPID

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _ToolTip($sText)
    ToolTip($sText,0,0)
    Local $h_tooltip = WinGetHandle ($sText)
    DllCall("user32.dll","int","SendMessage","hwnd",$h_tooltip,"int",$TTM_SETTIPBKCOLOR,"int",0xcd0000,"int",0)
    DllCall("user32.dll","int","SendMessage","hwnd",$h_tooltip,"int",$TTM_SETTIPTEXTCOLOR,"int",0xFFFFFF,"int",0)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    ach ja, beim Tooltip hab ich die Schriftgröße verändert, damit mehr Zeilen reinpassen ;)

    lgE

    //Edit: Hab noch den HotKey Ctrl-Alt-e zum Beenden eingefügt, da bei der Thunderbirdinstallation der Tooltip den gesammten Bildschirm ausfüllt
    und man dann nicht mal in den Taskmanager reinkommt :rolleyes:

  • AutoIt Skript Version Info verändern--- WIE?

    • eukalyptus
    • 6. Oktober 2008 um 07:53

    Hi

    [autoit]

    #AutoIt3Wrapper_Res_Fileversion=1.0.0.0

    [/autoit]

    Dazu benötigst du SciTE4Autoit, der Link ist links auf dieser Seite, gleich unter "Übersetzungsstatus"

    lgE

  • Problem mit HardDisk - Defekt nach Format

    • eukalyptus
    • 5. Oktober 2008 um 23:04

    Scheint wirklich ein Hardwaredefekt zu sein.

    Hab die Partition nun so verändert, daß die defekten Stellen "vorne" nicht benutzt werden.
    Die Platte ist zwar nun etwas kleiner, aber sie funktioniert wieder! :)

    thx
    lgE

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™