Hallo,
hab ein Problem das _Processclose () das komplette script killt, vielleicht kann mir einer auf die Sprünge helfen...
Code zum probieren:
Hallo,
hab ein Problem das _Processclose () das komplette script killt, vielleicht kann mir einer auf die Sprünge helfen...
Code zum probieren:
MsgBox(0,"","Angabe aus der Inputbox : " & GuiCtrlRead ($sinputboxanswer))
[/autoit]mit _GuiCtrlListView_SetExtendedStyle () den Stil auf einen button oder eine andere abfrage zuweisen.
Dann sollten Checkboxen bei jedem Item auftauche welche geklickt werden können die du wiederum in einer neuen Abfrage mit _GuiCtrlListView_GetItemChecked () abfragen kannst und dann wenn zutrifft in deine löschen func übernimmst.
(_GuiCtrlListView_DeleteItem () )
Schreibe jetzt nur mal so aus dem kopf, weiß nicht ob der genaue wortlaut der befehle stimmt ? Steht aber ansonsten alles in der Hilfe auch nochmal.
Oder du machst eine Abfrage mit _guiCtrlListView_GetItemSelected () und übergibst diese dann an deine löschen func.
MfG
Stinger2k
mit dem Extended Stil Checkboxes ich glaube LV_CHECKBOX oder so?
So einfach wird das nicht gehen, wenn wie bei mir, der 2. Bildschirm mit einer anderen Auflösung arbeitet.
Deine Erklärungen sind etwas unverständlich, Was meinst du mit Label (ein GuiCtrlCreateLabel ?)
Vielleicht wäre ein Array mit deinen Werten das richtige? (ein Array welche du bei bestimmter Auswahl in deiner Combox neu anordnen lässt)
Damit dir hier jemand weiterhelfen kann und möchte, wäre vielleicht ein screenshot mit beschreibungen was du erreichen willst um einiges hilfreicher als nur dein script mit einer mini-gui.
Vielleicht hilft dir das weiter gibt dir so alle möglichen Informationen zurück welche man gebrauchen könnte um Fenster zu identifizieren...
inkl. Beispiel:
#include <Array.au3>
#include <Inet.au3>
#include <Misc.au3>
#include <Process.au3>
$PID = Run(@WindowsDir & "\notepad.exe")
msgbox(0,"",PIdGetWindow($PID,2,2))
;============================================================================================
;
; Function Name: _PIdGetWindow
; Description: Returns the Windowhandle(s) owned by the specified process (PId only !).
;
; Parameter(s): $iPid - the owner-PID.
;
; $iWndState - WindowState´s (default = active Windows) Option´s as shown
; by Helpfile for WinGetState()
;
; $iOption - Optional : return/search methods :
; 0 - returns Processname for the window declared at $iWndState.
; 1 - returns new PID for the Process.
; 2 - returns WindowTitle for matches in $iWndState(default).
; 3 - returns WindowHandle for matches in $iWndState.
; 4 - returns WindowState for specified PId.
; 5 - returns an Array with all Data can found for Processes and Windows.
;
;
; Return Value(s): On Success - returns an Array (see below for $iOption method 5).
; $array[0][0] - number of Processes
; $array[x][0] - Processname
; $array[x][1] - ProcessId (if Process already exists, a new PId is given by this function)
; $array[x][2] - WindowTitle
; $array[x][3] - Windowhandle
; $array[x][4] - Windowstate
;
; On Failure - returns 0 and sets @error to 1.
;
; Note´s: For this Function, <Array.au3> & <Process.au3> must be included.
;
; Author(s): Stinger2K
;
;============================================================================================
Func _PIdGetWindow($iPId,$iWndState=2,$iOption=2)
Local $aResult[1]
Local $var = _ProcessGetName($iPId)
Local $test = ProcessExists($var)
If $test <> $iPId Then ; make sure that process exits once
ProcessClose($var)
EndIf
ProcessWait($var)
Local $handle_name = WinList()
[/autoit] [autoit][/autoit] [autoit]For $i = 1 To $handle_name[0][0]
ReDim $aResult[UBound($aResult) + 1][5]
$aResult[UBound($aResult) - 1][0] = _ProcessGetName(WinGetProcess($handle_name[$i][1]))
$aResult[UBound($aResult) - 1][1] = WinGetProcess($handle_name[$i][1])
$aResult[UBound($aResult) - 1][2] = $handle_name[$i][0]
$aResult[UBound($aResult) - 1][3] = $handle_name[$i][1]
$aResult[UBound($aResult) - 1][4] = WinGetState($handle_name[$i][1])
If $aResult[$i][1] = $iPId and BitAND (WinGetState ($aResult[$i][3]),$iWndState) Then
If $iOption=0 Then
Return $aResult[$i][0] ; Processname
ElseIf $iOption=1 Then
Return $aResult[$i][1] ; new PID
ElseIf $iOption=2 Then
Return $aResult[$i][2] ; WindowTitle
ElseIf $iOption=3 Then
Return $aResult[$i][3] ; Windowhandle
ElseIf $iOption=4 Then
Return $aResult[$i][4] ; Windowstate
EndIf
Else
EndIf
Next
If $iOption =5 Then
_ArraySort($aResult)
Return $aResult
EndIf
If $iOption >5 or $iOption <0 Then
SetError(2)
Return -2
EndIf
SetError(1)
Return -1
EndFunc ;==>PID2Window
Hallo Leute,
Komme bei einem kleinem Problem nicht mehr weiter:
Habe ein kleines script welches ich mit parametern über die dos-konsole versorge (Bsp: test.exe -?)
Nun wollte ich damit eine Ausgabe im Dos-Fenster erreichen in der Form: -? show´s this screen etc.
Hab aber leider keinen Plan wie ich in die bereits-geöffnete Dos-Konsole schreiben kann.
Das Programm sollte bei normalen Aufruf eine GUI starten und bei Aufruf über die Kommandozeile eine CUI.
Wie kann ich das bewerkstelligen? (es sollte jedoch alles in diesem einen script ablaufen...) ????
Sinnvoll ist es wenn man aus der Registry Standardprogramme ausliest (z.B. _INetMail () macht das um den Standard-Mail-Client zu starten...).
z.B.: möchte ich warten bis ein Fenster existiert (wobei ich den Titel oder Text des Fensters nicht wissen kann), um dann per Send("^v") eine Dateianlage zu übergeben.
Bei mir funktioniert die Func nur dann einwandfrei, wenn die übergebene PID stimmt, was jedoch nicht der Fall ist wenn z.B. Outlook schon in einer Instanz offen ist... Dadurch wird auch kein passender Fensterhandle gefunden da die PID die mir bei Run() übergeben wird nicht existiert( kannst du probieren indem du die PId´s im Taskmanager vergleichst...)
mit ProcessClose() möchte ich nur sicherstellen das keine Instanz mehr offen ist wenn das Programm startet - damit ich die richtige PId bekomme.
PS: Danke, für deine Statement´s...
Das hatten wir erst gestern besprochen...
Weil bei bestimmten Programmen es vorkommt das sie zwar mit einer neuen PId starten, jedoch den gestarteten Prozess gleich wieder killen und nur ein neues Fenster unter der selben PId starten (Outlook, Explorer, etc...)
Hallo Leute,
Das ist sozusagen der 1. Versuch einer Sinnvollen UDF. Bitte teilt mir eure Meinungen und ERfahrungen mit, auch wenn Sie nicht so schön sind...
Danke an alle...
Hier die Func:
;============================================================================================
;
; Function Name: _PIdGetWindow
; Description: Returns the Windowhandle(s) owned by the specified process (PId only !).
;
; Parameter(s): $iPid - the owner-PID.
;
; $iWndState - WindowState´s (default = active Windows) Option´s as shown
; by Helpfile for WinGetState()
;
; $iOption - Optional : return/search methods :
; 0 - returns Processname for the window declared at $iWndState.
; 1 - returns new PID for the Process.
; 2 - returns WindowTitle for matches in $iWndState(default).
; 3 - returns WindowHandle for matches in $iWndState.
; 4 - returns WindowState for specified PId.
; 5 - returns an Array with all Data can found for Processes and Windows.
;
;
; Return Value(s): On Success - returns an Array (see below for $iOption method 5).
; $array[0][0] - number of Processes
; $array[x][0] - Processname
; $array[x][1] - ProcessId (if Process already exists, a new PId is given by this function)
; $array[x][2] - WindowTitle
; $array[x][3] - Windowhandle
; $array[x][4] - Windowstate
;
; On Failure - returns 0 and sets @error to 1.
;
; Note´s: For this Function, <Array.au3> & <Process.au3> must be included.
;
; Author(s): Stinger2K
;
;============================================================================================
Func _PIdGetWindow($iPId, $iWndState = 2, $iOption = 2)
Local $aResult[1]
Local $var = _ProcessGetName($iPId)
Local $test = ProcessExists($var)
Local $handle_name = WinList()
If $test <> $iPId Then ; make sure that process exits once
ProcessClose($var)
Sleep(1000)
EndIf
ProcessWait($var)
For $i = 1 To $handle_name[0][0]
ReDim $aResult[UBound($aResult) + 1][5]
$aResult[UBound($aResult) - 1][0] = _ProcessGetName(WinGetProcess($handle_name[$i][1]))
$aResult[UBound($aResult) - 1][1] = WinGetProcess($handle_name[$i][1])
$aResult[UBound($aResult) - 1][2] = $handle_name[$i][0]
$aResult[UBound($aResult) - 1][3] = $handle_name[$i][1]
$aResult[UBound($aResult) - 1][4] = WinGetState($handle_name[$i][1])
If $aResult[$i][1] = $iPId And BitAND(WinGetState($aResult[$i][3]), $iWndState) Then
If $iOption = 0 Then
Return $aResult[$i][0] ; Processname
ElseIf $iOption = 1 Then
Return $aResult[$i][1] ; new PID
ElseIf $iOption = 2 Then
Return $aResult[$i][2] ; WindowTitle
ElseIf $iOption = 3 Then
Return $aResult[$i][3] ; Windowhandle
ElseIf $iOption = 4 Then
Return $aResult[$i][4] ; Windowstate
EndIf
Else
EndIf
Next
If $iOption = 5 Then
_ArraySort($aResult)
Return $aResult
EndIf
If $iOption > 5 Or $iOption < 0 Then
Return -2
EndIf
SetError(1)
Return -1
EndFunc ;==>_PIdGetWindow
TaDaa ==> meins:
[autoit]
#include <Array.au3>
#include <Process.au3>
Global $aResult[1]
$handle_name = WinList()
For $i = 1 To $handle_name[0][0]
ReDim $aResult[UBound($aResult) + 1][5]
$aResult[UBound($aResult) - 1][0] = _ProcessGetName(WinGetProcess($handle_name[$i][1]))
$aResult[UBound($aResult) - 1][1] = WinGetProcess($handle_name[$i][1])
$aResult[UBound($aResult) - 1][2] = $handle_name[$i][0]
$aResult[UBound($aResult) - 1][3] = $handle_name[$i][1]
Next
_ArraySort($aResult)
_ArrayDisplay($aResult)
damit ich über die PID den WindowTitle und gleichzeitig das Handle ausfindig machen kann... Soll vielleicht mal eine UDF mit Sinn ergeben.
ZitatLern lesen....
Und nun ein beispielscript, damit du mich verstehst auf was ich hinaus will.
#include <Inet.au3>
#include <Array.au3>
Global $aResult[1]
$var =_INetMail("", "", "")
$pid_name = ProcessList ()
$handle_name = WinList ()
For $i = 1 to $pid_name[0][0]
ReDim $aResult[UBound($aResult) + 1][4]
$aResult[Ubound($aResult) - 1][0] = $handle_name[$i][0]
$aResult[UBound($aResult) - 1][1] = $pid_name[$i][0]
$aResult[UBound($aResult) - 1][2] = $handle_name[$i][1]
$aResult[UBound($aResult) - 1][3] = $pid_name[$i][1]
Next
_ArrayDisplay($aResult)
Nun möchte ich aber noch das die bezüge zu den einzelnen Fenstertiteln und Prozessen inkl. hWnd und PId im Array stimmen....
Ich hoffe das war nun verständlich...
Ich brauche den Titel um mit WinWaitActive () darauf zuzugreifen...
Hat jemand eine Idee, den in der Hilfe gibt es keine fertigen Funktionen um über die PId oder Hwnd an den Fenstertitel zu kommen...?
oh mir leider aucg nicht. Na dann....
Jetzt muss ich nur noch zum Fenstertitel kommen damit ich überprüfen kann ob der gestartete Prozess aktiv und im Vordergrund ist...
Warum taucht die PID in dem von ProcessList() erstelltem Array nicht auf?