2

{コードが完全に問題ないと思う「else」の前に抜けがあると AutoHotkey が教えてくれるという問題があります。(ウィンドウ関連のifをPidginからqutIMに変更するまではうまくいきました)

^!p::
   IfWinExist ahk_class QWidget, ,qutIM {  ;if there is a qutIM-window other than the buddy-list...
      IfWinNotActive ahk_class QWidget, , qutIM {  ;ans it is not active...
         WinActivate
      } else {  ;the closing bracket in front of the else here puts AHK off...
         WinMinimize
      } 
   } else {  ;do some stuff with the buddy-list
      ; [...]
   } 
return

私は愚かなことを見落としているのではないかと心配していますが、これを機能させることができないようです。

4

3 に答える 3

2

私が間違っていなければ、One True Brace スタイルは純粋な If ステートメントでのみ使用でき、IfWinExist のような化合物では使用できません。

if-expressions のドキュメントから:

One True Brace (OTB) スタイルは、オプションで、式である if ステートメントで使用できます (ただし、従来の if ステートメントでは使用できません)。

すなわち。IfWinExist ではなく、WinExist() フォームを使用する必要があります。

于 2009-12-01T22:12:00.300 に答える
-2

私はあなたがテストしているアプリを持っていないので、あなたが何をしようとしているのかよくわかりませんが、これは別の方法かもしれません:

^!p::
IfWinExist, ahk_class Notepad ; if there is a qutIM-window other than the buddy-list
    {
    WinActivate
    Exists=True
    }
else ;the closing bracket in front of the else here puts AHK off...
    {
    WinMinimize
    Exists=False
    }
If Exists=True 
    MsgBox, do some stuff with the buddy-list ; dummy code
Else
    {
    Msgbox, Exiting App ; dummy code
    ExitApp
    }
于 2009-12-09T23:36:58.150 に答える