; 出展 ; http://www.donationcoder.com/Forums/bb/index.php?topic=5926.msg41894 ; 2ch AutoHotkey スレッド part4 >>629さん(http://pc11.2ch.net/test/read.cgi/software/1184556627/629) #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; DoubleKey関数 DoubleKey(RunCommand, timeout){ if(A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < timeout) Run, %RunCommand% } ; 書式 [ DoubleKey(コマンドライン、タイムアウトms) ] ; 1つの呼び出しキーで、現在アクティブなアプリケーションによってorchisのランチャを切り換える例。 ; "orchis.exe -d"に続く数字は、orchisの「ランチャの表示」メニューに書いてある番号。 ; orchisのヘルプによれば orchis -d "Launcher Name"でも動作する筈なんですが、少なくとも ; 家の環境では動作しなかった。-dと数字の間には半角{Space}必須。 ; orchisの設定でキー操作による呼び出しが設定されていれば、そちらが優先される。 ~LCtrl up:: IfWinActive, ahk_class gdkWindowToplevel { WinGet, exsecute_file, ProcessName, A if (exsecute_file == "inkscape.exe") { DoubleKey("C:\Progra~1\Orchis\orchis.exe -d 2", 400) } else if (exsecute_file == "gimp-2.2.exe") { DoubleKey("C:\Progra~1\Orchis\orchis.exe -d 5", 400) } return } else IfWinActive, ahk_class IrfanView { DoubleKey("C:\Progra~1\Orchis\orchis.exe -d 4", 400) return } else IfWinActive, ahk_class IrfanViewThumbnails { DoubleKey("C:\Progra~1\Orchis\orchis.exe -d 4", 400) return } else IfWinActive, ahk_class TTeraPadMainForm { DoubleKey("C:\Progra~1\Orchis\orchis.exe -d 3", 400) return } else IfWinActive, ahk_class MozillaUIWindowClass { DoubleKey("C:\Progra~1\Orchis\orchis.exe -d 6", 400) return } else IfWinActive, ahk_class IEFrame { DoubleKey("C:\Progra~1\Orchis\orchis.exe -d 7", 400) return } else IfWinActive, ahk_class CabinetWClass { ; explorerがアクティブならば、ドラッグ&&ドロップで動作するショートカット(*.lnk)や ; *.bat; *.ahkなどを詰め込んだフォルダをorchisのファイラでいったん常駐モードで表示。 ; そもそも、何故かランチャではコマンドラインで常駐モードが有効にならない。 ; 3秒後にファイラが非アクティブならファイラを閉じる。まだアクティブだった場合はもう3秒待つ。 ; ; DoubleKey関数の後にSleepを入れると動作しなかった。 ; "%USERPROFILE%\SendTo" のような特殊フォルダは、-f #フォルダ識別子で指定しないと動作しない。 ; フォルダ識別子はorchisのヘルプ参照 file:///C:/Program%20Files/Orchis/doc/cui.html if A_TickCount < %LCtrldouble% { ;Run, C:\Progra~1\Orchis\orchis.exe -f %A_ScriptDir%\_lnk -s, C:\Progra~1\Orchis Run, C:\Progra~1\Orchis\orchis.exe -f #9 -s, C:\Progra~1\Orchis ;Orchis_filere = Orchis [_lnk] Orchis_filere = Orchis [SendTo] ; [DirName] WinWait, %Orchis_filere% Loop{ Sleep, 3000 ; Orchisにファイルをドロップしている間はファイラを消さないが、ファイラの起動から ; 3秒以内にドロップしなければファイラは強制的に閉じる。 IfWinNotActive, %Orchis_filere% { WinClose, %Orchis_filere% break } } LCtrldouble = 0 } else { LCtrldouble =% A_TickCount% LCtrldouble += 400 } return } else { ; 上記以外のアプリケーション全て DoubleKey("C:\Progra~1\Orchis\orchis.exe -d 1", 400) return }