2017-04-04 3 views
0

Mit AutoIt 3.3.14.2 starten Sie die Anwendung Entrust etunprot.exe. Die Anwendung "Entrust" wird gestartet, hat jedoch keinen Fokus. Nach dem Start der Anwendung soll das AutoIt-Skript das Passwort eingeben, dies jedoch nicht, weil kein Fokus vorhanden ist. Wenn ich auf die Anwendung klicke, um den Fokus festzulegen, wird das Kennwort eingegeben und das Skript wird fortgesetzt und erfolgreich beendet. Ich habe ursprünglich WinWaitActive verwendet und es durch WinWait und WinActivate ersetzt, um das Problem zu beheben. Hier ist der Code:Autoit startet App ohne Fokus

; Terminate script if no command-line arguments 
If $CmdLine[0] = 0 Then Exit (1) 

Run("C:\Program Files\Entrust\Password Unprotect\etunprot.exe " & $CmdLine[1]) 

WinWait("Entrust Password Unprotect", "OK") 
WinActivate("Entrust Password Unprotect", "OK") 

; Enter the password text 
Send("password") 
; Submit the password 
Send("{ENTER}") 

WinWait("Entrust Password Unprotect", "Enter name of output folder") 
WinActivate("Entrust Password Unprotect", "Enter name of output folder") 

; Enter the name of the output folder 
Send($CmdLine[2]) 
; Unprotect the enp file 
Send("{ENTER}") 

Antwort

0

Versuchen

WinWait("Entrust Password Unprotect", "") 
WinActivate("Entrust Password Unprotect", "") 
+0

Ich habe diese Idee versucht, aber das Verhalten ist das gleiche. Vielen Dank. –

0

diese versuchen, die Windows-Ihres Prozesses zu erhalten. Vielleicht hilft es dir.

#include <Array.au3> 
$re = ProcessGetWindow(ProcessExists('Greenshot.exe')) 
_ArrayDisplay($re) 


Func ProcessGetWindow($PId) 
    $PId = ProcessExists($PId) 
    If $PId = 0 Then 
     SetError(1) 
    Else 
     Local $WinList = WinList() 
     Local $WindowTitle[1][2] 
     Local $x = 0 
     For $i = 1 To $WinList[0][0] 
      If WinGetProcess($WinList[$i][1], "") = $PId And $WinList[$i][0] <> "" Then 
       ReDim $WindowTitle[$x + 1][2] 
       $WindowTitle[$x][0] = $WinList[$i][0] 
       $WindowTitle[$x][1] = $WinList[$i][1] 
       $x += 1 
      EndIf 
     Next 
     Return $WindowTitle 
    EndIf 
EndFunc ;==>ProcessGetWindow