1

方法:

  1. 読み取り (待機して記録) を 1 回押す (つまり、 Shift-Alt-F5 )
  2. ホットキーとして実行せずに、この記録されたキーの組み合わせをプログラム (つまり、Photoshop) に渡します。

これを試しましたが、ASCII 以外のホットキーでは機能しませんでした。t ホットキーで機能します。

F6::
Suspend, On
Input, OutputVar, L1 M
Send, %OutputVar% 
Suspend, Off
return


F5::Run explorer
t::Run notepad
!+5::Run cmd
  • F5 は、プログラム エクスプローラーを実行するホット キーです。
  • F6 は、すべてのホットキーを 1 回押すと一時停止するホット キーです。非ホット キーとしてキー コンボを通過します。
  • Firefox で F6 F5 を押すと、Firefox のページ更新アクションに失敗します。
  • F5 を押すと、前に F6 を入力せずにエクスプローラーが開きます
4

6 に答える 6

1

2 つのソリューション。

  1. 次のように、キャプチャするホットキーを入力に追加します。

    Input, OutputVar, L1, {LControl}{RControl}{LAlt}{RAlt}{LShift}{RShift}{LWin}{RWin}{AppsKey}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}{BS}{Capslock}{Numlock}{PrintScreen}{Pause}
    

それ以外の場合、これらの非 ASCII キーは入力によって無視されます。

または、F5 キーの動作をアプリケーション固有にします。

SetTitleMatchMode, 2
#IfWinNotActive, Firefox
    F5::Run explorer
#IfWinNotActive

このように、F5Firefox 内で作業している場合を除き、キーは常に IE を起動しF5F5ページをリロードします。

于 2012-07-17T20:03:43.677 に答える
1

あなたのメモに基づいて、私はあなたが次のことをしたいと思います。#r を使用して入力をブロックし、スクリプトを開始します。次に #r をもう一度押すと、スクリプトが停止し、入力が復元されます。その場合は、これを試すことができます:

#Singleinstance force
$#r::
If (MyToggle := !MyToggle) ; Toggle the value MyToggle True/False
    {
        ToolTip,Input  blocked [Win]+r,A_ScreenWidth/2-50,0
        BlockInput, on ; In Vista and above, you need to run AHK as admin or run AHK in compatility mode with Windows XP SP 3
        SetTimer RunMyScript, 500 ; Start the actual script in 500 ms outside of this script, so you can toggle
        Return
    }
Else
    {
        Tooltip
        BlockInput, off
        ;Reload ; This will KILL the "RunMyScript" IMMEDIATELY at an unpredictable location.
        Return
    }
return

RunMyScript: ; This script runs independently from the script above. The script stops after 10 loops and resets the input. [Ctrl]+[Alt]+[Del] still kills any script.
SetTimer RunMyScript, Off ; Turn the 500 ms timer off
loop, 10
{
    if (!MyToggle) ; Check the MyToggle variable to see if you need to stop the script. This will Exit the script at a predictable location.
        Exit

    SoundBeep, 600,600
    Sleep, 1000
}
BlockInput, off ; Allow keyboard & mouse input again. Warning the [Win] key key may be left activated, causing keyboard actions to start applications
Tooltip
Return

これがあなたが探していたものかどうか教えてください。

于 2012-07-25T11:29:51.467 に答える
0

ログファイルへの書き込みは、この方法で実行できます。ここでは、毎日新しいログファイルを作成します。エントリごとに、最後の2行を(実際の時間を取得するために)削除する必要があります。

FormatTime, DateRef, %TimeNow%, yyyyMMdd ; Store current date in variable DateRef
MyLogFile = %A_ScriptDir%\LogFiles\LogFile-%DateRef%.txt ; Define the name of the log file.
FormatTime, TimeAbsolute, %TimeNow%, HH:mm:ss ; Use the current time to set the timestamp variable called TimeAbsolute used inside the Log File
FileAppend, `n`r| %TimeAbsolute% | Your hotkey and possibly in which application`n`r,%MyLogFile% ; Write logfile
于 2012-07-28T08:09:29.293 に答える
0

私はまだこれをチェックしていませんが、これはあなたが探しているものだと思います...

FormatTime, DateRef, %TimeNow%, yyyyMMdd ; Store current date in variable DateRef
MyLogFile = %A_ScriptDir%\LogFiles\LogFile-%DateRef%.txt ; Define the name of the log file.
FileAppend, `n`r| %TimeAbsolute% | Your hotkey and possibly in which application`n`r,%MyLogFile% ; Write logfile
Suspend, on ; Start with hotkeys disabled
Return

Pause:: ; Use pause key to 'activate' the hotkeys
Suspend, Off ; Activate the hotkeys
SetTimer, Stop, 10000 ; If no hotkey is pressed within 10 seconds, deactivate the hotkeys aagain
Return

Stop: ; Deactivate the hotkeys
Suspend, on ; Deactivate the hotkeys
SetTimer, Stop, Off ; turn the stop timer off
Return

q:: ; use a key (q) as a hotkey
Soundbeep, 600,600 ; sound a short beep to show that it works
HotKeyType = "q key"
WinGet, ApplicationType, ProcessName, A
GoSub, Write
Return

Write:
SetTimer, Stop, Off ; Make sure that the stop timer is turned off
FormatTime, TimeAbsolute, %TimeNow%, HH:mm:ss ; Use the current time to set  the timestamp variable called TimeAbsolute used inside the Log File
FileAppend, `n`r| %TimeAbsolute% | %HotKeyType% used in %ApplicationType%`n`r,%MyLogFile% ; Write logfile
Suspend, On ; Disable the hotkeys again
Exit
于 2012-07-28T10:25:25.963 に答える
0

キーのログ記録に関しては、ログ ファイルにテキスト文字列として出力されるキータイプを具体的に定義しました。このようにして、出力できないキーごとに独自のテキストを定義できます。

スクリプトを次のように書き直しました。F6 を 1 回押してから別のキー (この場合は F5) を押すと、ビープ音が鳴ります (ホットキーとして機能します)。F6 を 2 回押すと、ホットキーが設定されていないかのように F6 が送信されます。最初に F6 を押さずに F5 を押すと、アクティブなホットキーがなかったかのように F5 が送信されます。これがあなたが望んでいたものであることを願っています....

$F6::
If (MySuspend := !MySuspend) ; Toggle the value MySuspend True/False
{
        ToolTip Hotkeys On (F6),A_ScreenWidth/2-50,0
}
Else
{
    Tooltip
    Send, {F6}
}
return

$F5::
If MySuspend
{
    SoundBeep, 600, 600
    MySuspend := 0
    ToolTip
}
else
{
    Send, {F5}
}
Return
于 2012-07-28T16:11:06.203 に答える
0

さて、これが最終的なスクリプトだと思います....

通常、F6 を押さない限り、すべてのキーは通常どおりに動作し、その後 3 秒間ホットキーを使用できます。ホットキーを使用するとすぐに、動作は再び通常に戻ります (3 秒間は、ホットキーを押さない場合のみです)。F6 を 2 回押すと、F6 が送信されます。これは比較的複雑なため、より簡単な解決策を見つけた場合はお知らせください。

FormatTime, DateRef, %TimeNow%, yyyyMMdd ; Store current date in variable DateRef
MyLogFile = %A_ScriptDir%\LogFile-%DateRef%.txt ; Define the name of the log file for today.
FormatTime, TimeAbsolute, %TimeNow%, HH:mm:ss
FileAppend, | %TimeAbsolute% | Your hotkey and possibly in which application`n`r,%MyLogFile% ; Write logfile
SpecialF6:=1
Suspend, On
Return

$F6::
Suspend, Permit
If SpecialF6
{
Suspend, Off
ToolTip Hotkeys On for 3 seconds,A_ScreenWidth/2-50,0
SpecialF6:=0
SetTimer, SuspendOn, 3000
Return
}
else
{
    Send, {F6}
    MyText = F6
    Gosub, WriteClose
}
Return

SuspendOn:
Suspend, On
SetTimer, SuspendOn, Off
ToolTip
SpecialF6:=1
return

F5::
Run explorer
MyText = F5 Run Explorer
Gosub, WriteClose
Return

t::
Run notepad
MyText = t Run Notepad
Gosub, WriteClose
Return

!+5::
Run cmd
MyText = Alt Shift 5 Run Command
Gosub, WriteClose
return

WriteClose:
Suspend, On
SetTimer, SuspendOn, Off
FormatTime, TimeAbsolute, %TimeNow%, HH:mm:ss
ToolTip
SpecialF6:=1
FileAppend, | %TimeAbsolute% | %MyText%`n`r,%MyLogFile% ; Write logfile
Exit
于 2012-07-28T19:19:15.213 に答える