AutoHotKey

how to toggle keyboard mapping in AutoHotKey

北城余情 提交于 2019-12-11 03:12:35
问题 I would like to map part of my keyboard as a number pad:(my laptop keyboard has no number pad) j->1 k->2 l->3 u->4 i->5 o->6 I would like to toggle the mapping with a short cut, let's say Control + Alt + M , my code is below, however, I don't know how to reset the mapping: mode = 0 ^!m:: if (mode = 1) { mode = 0 j->1 k->2 l->3 u->4 i->5 o->6 } else { mode = 1 u::u ;got error here: duplicate hotkey } return I got duplicate hotkey error with u::u , seems AHK does not allow mapping more than one

Find the size of retrieved binary data with WinHttp.WinHttpRequest

半世苍凉 提交于 2019-12-11 03:06:28
问题 I've recently realized that URLDownloadToFile uses the IE proxy setting. So I'm looking for an alternative and found WinHttp.WinHttpRequest may work. It seems the ResponseBody property contains the fetched data and I need to write it to a file. The problem is that I cannot find the byte size of it. http://msdn.microsoft.com/en-us/library/windows/desktop/aa384106%28v=vs.85%29.aspx has the information for the object but I don't find relevant properties for it. Can somebody tell how? strURL :=

Read filenames in a directory with AutoHotkey

↘锁芯ラ 提交于 2019-12-11 02:48:50
问题 I am looking for a way to read a folder and save each filename to a variable. So far this is what I have Loop,C:\My Documents\Notes\* In my notes directory I have pdf files. I want to read the directory and save the filename "Homework1.pdf" to a variable then move the file itself to another directory. On the next loop it will pick up the next pdf document "Test.pdf" etc. This should loop until every pdf has been moved. I know I could use FileMove but the samples show that you have to provide

AutoHotkey choking on same-line curly brace for compound if statements

别来无恙 提交于 2019-12-11 02:44:42
问题 I have a problem where AutoHotkey tells me there is a missing { in front of an 'else' where I think my Code is perfectly fine. (It worked up until I changed the window-related if's from Pidgin to 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

Autohotkey: Conflict between functions using the same key

我是研究僧i 提交于 2019-12-11 02:19:00
问题 I using a lot the "$" lately, and in my (Spanish) keyboard I must press Shift+4 every time, so I decided to use AutoHotkey to make it faster. The idea make it faster by using the "ç" key as I don't use it very often. ç:: Send $; new use of the key Return This works well but sometimes I do need to write "ç" and "Ç", so I tried to add this !ç:: Send ç ; to get the "ç" back in game Return +ç:: Send Ç ;original use of the "ç" key Return But it's not working (keep sending $, as "ç" is now "$"). I

Autohotkey 3 clicks = volume mute

谁说胖子不能爱 提交于 2019-12-11 01:49:50
问题 In autohotkey im trying to make it so that when I press the left mouse button 3 times with a delay of +/- 10 ms it becomes a volume mute LButton:: if (?) { Send, Volume_Mute } else { Send, LButton } Return 回答1: Use A_TickCount to read current time in milliseconds and then calculate the delay between clicks. See Date and Time ms := A_TickCount N := 3 ; number of clicks T := 500 ; max delay between clicks, ms clicks := 0 ~lbutton:: msx := A_TickCount ; get current time d := msx - ms ; get time

Collision with two lines of code make code does not work the way it is meant by me, what could I do different to get this work(?)

大兔子大兔子 提交于 2019-12-11 00:21:45
问题 Try running the following code yourself, and you would notice that "can't" changes to "CAN't", but I want it to change it to "CAN NOT". On the other hand, I want to keep the 1.st line of code, which changes "can" to "CAN". How could I achieve this(?) ::can::CAN ::can't::CAN NOT 回答1: You must remove ' from defaults ending characters #Hotstring EndChars -()[]{}:;"/\,.?!`n `t ::can::CAN ::can't::CAN NOT 来源: https://stackoverflow.com/questions/56533561/collision-with-two-lines-of-code-make-code

How to check if string is contained in an array in AutoHotKey

瘦欲@ 提交于 2019-12-10 14:23:08
问题 I have following code: ignored := [ "Rainmeter.exe", "Nimi Places.exe", "mumble.exe" ] a := ignored.HasKey("mumble.exe") MsgBox,,, %a% It returns 0 even though the string is clearly present in the array. How do I test if a string value is present in an array? PS: I also tried if var in which gives same results. 回答1: You can't, using just one command. Such functionality is not implemented in AHK_L as of 1.1.22.3. You'll have to either define your own function hasValue(haystack, needle) { if(

Rename file, remove unnecessary character from file name using Autohotkey

百般思念 提交于 2019-12-10 12:26:42
问题 I'm trying to rename files (usually downloaded subtitle) using Autohotkey/RegEx to discard the unnecessary character, remove “.” to space in a way that the final renamed file will contain only name and the four digit year. An example as follows Original file name/path D:\Folder\Sub Folder\Hamburger.Hill.1987.BluRay.720p.x264.srt Renamed file should be like this D:\Folder\Sub Folder\Hamburger Hill 1987.srt Initially I was intended only to remove the “.”. With contribution of “Ro Yo Mi” the AHK

Global keyboard function in Autohotkey?

醉酒当歌 提交于 2019-12-10 11:54:12
问题 This script "auto-presses" E while holding it down. $e:: While GetKeyState("e","P") { Random, r, 50, 250 sleep r Send e } return Is there a way to globally call this function for any key? For example: Holding A, will auto-press A and Z will auto-press Z, etc. Without manually assigning every possible key on the code. 回答1: I am not aware of a way to catch all keys. But you can simplify your code by combining hotkeys this way: $a:: $b:: $c:: ; and so on... $z:: RandomSendCurrentKey() ; all the