2017-04-04 8 views
0

AutoIt 3.3.14.2を使用してEntrust etunprot.exeアプリケーションを起動します。 Entrustアプリケーションは起動しますが、フォーカスはありません。アプリケーションの起動後、AutoItスクリプトはパスワードを入力することになっていますが、フォーカスがないためではありません。フォーカスを与えるためにアプリケーションをクリックすると、パスワードが入力され、スクリプトは継続して正常に終了します。私はもともとWinWaitActiveを使用し、WinWaitとWinActivateを置き換えて問題を解決しました。ここでは、コードは次のとおりです。Autoitはフォーカスなしでアプリを起動します

; 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}") 

答えて

0

は、あなたのプロセスのWindowsのを取得するには、これを試してみてください

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

このアイデアは試しましたが、その動作は同じです。ありがとう。 –

0

を試してみてください。多分それがあなたを助けます。

#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 
関連する問題