AutoHotKey

Using GetKeyState() and loops

假如想象 提交于 2020-01-15 07:39:07
问题 I'm trying to write a script that has a loop in which the upper arrow key is pressed every two seconds. The loop must be activated when I press the spacebar and deactivated when I press it again. I'm now using this. $Space:: if GetKeyState("Space", "P") { Loop { Sleep 2000 Send {Up} if GetKeyState("Space", "P") { return } } } For some reason, the if condition inside the loop doesn't work, i.e. I can't get out of the loop. I hope anyone can help me out... 回答1: You wouldn't need the first if

AutoHotKey - how to send control and same key multiple times

喜夏-厌秋 提交于 2020-01-15 05:05:08
问题 Specifically I want to hold down the control key, and press the m key, let go of m but keep control held down, and then press m again, which will trigger the function. More generically I'd like to know the syntax for telling autohotkey to read the same key multiple times How do I do that? I can do it with a single m like this ^m:: Send, The text i want to send Return So far I have tried ^m m:: Send, The text i want to send Return ^m&m:: Send, The text i want to send Return ^mm:: Send, The

AutoHotKey入门使用

亡梦爱人 提交于 2020-01-14 13:44:13
一、资料来源 官网: AutoHotkey 善用佳软: AutoHotkey 学习指南 小众软件: AHK 快餐店 维基百科: AutoHotkey 论坛: AutoHotkey中文论坛 编辑工具推荐:SciTE4AutoHotkey 详情介绍及下载 二、AHK入门 AutoHotkey程序部件介绍: 檔案名稱 功能說明 AutoHotkey.exe、AutoHotkey.chm AutoHotkey的主程式與說明檔。AutoHotkey.chm具有搜尋功能,是很好的學習參考文件 AU3_Spy.exe Active Window Info,顯示視窗系統訊息的小工具,這些訊息對進階的腳本撰寫很有幫助 SmartGUI.exe 用拖拉的方法來定義視窗與其內的各種視覺元件,最後產生的腳本檔。這個工具可以說是一個程式產生器 AutoScriptWriter.exe 一樣是個產生AutoHotkey腳本檔的產生器,不過是採取錄製鍵盤與滑鼠操作過程的方法來產生腳本內容 Ahk2Exe.exe 把腳本檔產生成執行檔的工具,以方便沒有安裝AutoHotkey系統的環境能用執行檔直接執行。 Ahk2Exe.exe是命令列指令,語法如下: Ahk2exe.exe /in "test1.ahk" /icon "test1.ico" 1、运行程序或打开文件 运行程序 Run

How to convert a string to a numeric in autohotkey?

眉间皱痕 提交于 2020-01-13 16:29:31
问题 FormatTime, CurrentMinute , , m assigns the current minute to variable %CurrentMinute% , and its value is a string, not a numeric. I wanna do some calculations on the value of %CurrentMinute% , so how could I convert it to numeric? Thanks for any help in advance! 回答1: AutoHotkey automatically converts numbers and strings as needed. FormatTime, CurrentMinute,, m NextMinute := CurrentMinute + 1 来源: https://stackoverflow.com/questions/13106275/how-to-convert-a-string-to-a-numeric-in-autohotkey

Finding the scan code of FN Key

不羁岁月 提交于 2020-01-13 08:15:13
问题 I want to use Fn + S to emulate Ctrl + S , so far this is my code: #InstallKeybdHook #Persistent SC126 & s:: Send ^{s} return My problem is that I don't know the Fn key's scan code. How can I find it? 回答1: The Fn key does not have a scan code. The keyboard driver does not expose the Fn key to the operating system, so basically your operating system (and therefore AutoHotkey) does not know that it exists. When you press the Fn key in combination with a supported key, the keyboard driver

AutoHotKey: Calling one script from another script

本小妞迷上赌 提交于 2020-01-11 04:34:10
问题 I just discovered AutoHotKey and it seems like a dream come true. I have two .ahk scripts, A.ahk and B.ahk . I want to call script B from within script A. The AHK forums are strangely silent on the subject but I am sure this is possible. 回答1: It's the #Include directive you are looking for. You include ScriptB.ahk, then call its functions like you normally would. #include SomeFile.ahk http://www.autohotkey.com/docs/commands/_Include.htm 回答2: Using an #include directive is more common, but

Find and fill an input field with AutoHotKey

*爱你&永不变心* 提交于 2020-01-11 03:23:11
问题 A challenge to all you AutoHotKey masters: Give us a function that will Find and Move the Cursor to an Input Field (E.g. LoginName) and, alternatively send input text. For the old, lazy hackers like myself just fiddling with AHK, it would look like this: FindFillField(*elementid*,*sendtext*,*alt-text*) Where elementid is the HTML id for the field, e.g. USERNAME, where sendtext is the text to fill and where alt-text could be additional, specific text to help identify the fields. Additional,

Generate the Log information in .txt file when executing .AHK Script in Auto Hot Key

。_饼干妹妹 提交于 2020-01-07 04:35:06
问题 I need to display the execution process in seperate .txt file while im executing the .AHK File , So Like If any Error occurs while executing the script it should show it in .txt File. While running the script that script should append to new .txt File and in that new .txt file need to show log info (Execution Process). Here is my code Below : #SingleInstance force #Persistent Run, C:\Pangaea\Software\SVN\TortoiseSVN-1.8.8.25755-x64-svn-1.8.10.msi SetTimer, Check, 1000 return Check:

Autohotkey - Trigger script when a certain button was clicked in a window

江枫思渺然 提交于 2020-01-06 18:08:20
问题 I know the actual button's handle. What I would like to check if that button was clicked and if so that would trigger an autohotkey script. Thanks in advance! 回答1: You are right. You can use this instead of ImgSearch. ControlGetPos, x, y, w, h, button1, ahk_class CalcFrame MsgBox, %x% %y% %w% %h% return So you would have to run the ControlGetPos after each mouse click (only when the target window title is active) and then compare the actual mouse coordinates with the button click area. Here

Autohotkey - Trigger script when a certain button was clicked in a window

北战南征 提交于 2020-01-06 18:08:07
问题 I know the actual button's handle. What I would like to check if that button was clicked and if so that would trigger an autohotkey script. Thanks in advance! 回答1: You are right. You can use this instead of ImgSearch. ControlGetPos, x, y, w, h, button1, ahk_class CalcFrame MsgBox, %x% %y% %w% %h% return So you would have to run the ControlGetPos after each mouse click (only when the target window title is active) and then compare the actual mouse coordinates with the button click area. Here