AutoHotKey

Identify Special key keycode

馋奶兔 提交于 2019-12-25 16:59:17
问题 I am using a windows 8 laptop. My old laptop had a key combo, fn+f5, which would make the computer go to sleep. My new laptop has a power button on the side that acts like the one on your phone, it puts the PC to standby/sleep. But i don't like hardware buttons because they wear out. I plugged in a logitech keyboard that has a dedicated key with the power button symbol and when you press it, it does the same thing. (i did not install any software or drivers btw, just plugged it in) My goal is

Why my StringReplace don't work?

梦想与她 提交于 2019-12-25 09:41:08
问题 I want to replace the comma character into another based on order Chr ^Numpad4:: StringReplace, clipboard, clipboard,%Chr(44),%Chr(45), All Return But why I cannot use it?Are any wrong in my code? 回答1: In a command's parameters you have to use expression syntax: ^Numpad4:: StringReplace, clipboard, clipboard, % Chr(44), % Chr(45), All ; MsgBox, %clipboard% Return Without the percent sign and the space , Chr(44) is a literal string. 来源: https://stackoverflow.com/questions/43331263/why-my

If Expressions Don't Work

谁说我不能喝 提交于 2019-12-25 07:43:15
问题 I'm having a problem with getting if expressions to work. The problem is that the first if statement is used, even if the expression beside should return a value of FALSE. For example, when I run this script, it should be that %X% would have a value of 10 by the time it has run twice. (First is 5, second is 10). %length% would then incidentally have a value of 2 on the second run. The message box that I get on the second run says "The length of InputVar is 2. - One - 2" all the way up through

SendEvent ^{ins} isn't copying content to the clipboard

最后都变了- 提交于 2019-12-25 07:42:29
问题 !c:: file_name = footnote.ini restore_original_clipBoard := clipboard clipboard = KeyWait, Alt KeyWait, c ;small c BlockInput, on SendEvent, ^{ins} ;^c doesn't work ClipWait, 2 ; Wait for the clipboard to contain text. if ErrorLevel { MsgBox Failed to save the selection: %clipboard% exit } BlockInput, off save_selection := clipboard Problem: Despite a selection being made, Sendevent ^{ins} does not save it to the clipboard. Sometimes I have to repeat my hotkey, alt + c several times before

How do I retrieve some information from HTML code in AHK?

好久不见. 提交于 2019-12-25 06:47:53
问题 I'd like to retrieve some information from HTML code. Let's consider the following: <ul class="article-additional-info"> <li><strong>Issue Year:</strong> 2011</li> <li><strong>Issue No:</strong> 1 (200)</li> <li><strong>Page Range:</strong> 65-80</li> <li><strong>Page Count:</strong> 15</li> <li><strong>Language:</strong> Polish</li> </ul> I can get all the information from article-additional-info class by using document.getElementsByClassName("article-additional-info")[0].innerText . But how

What is wrong with this StringReplace code?

你说的曾经没有我的故事 提交于 2019-12-25 06:37:57
问题 I have this string XXX:ABC . I want to remove XXX: so that the string becomes ABC . The variable Symbol contains the string XXX:ABC . The code as follows: MsgBox, Symbol %Symbol% SearchText := "XXX:" ReplaceText := "" StringReplace, newSymbol, Symbol, SearchText, ReplaceText, ALL MsgBox, newSymbol %newSymbol% From the message box output, newSymbol content is the same as Symbol . Can someone tell me what is wrong with my code? I am using Autohotkey v1.1.14.03. 回答1: For command parameters, you

Modifying a clipboard content to be treated as HTML

吃可爱长大的小学妹 提交于 2019-12-25 04:07:56
问题 When I “copy an image” on the web (by highlighting the image and ctrl+C) and then passed it into the text view of the HTML WYSIWYG editor (not the source code editor) the picture is displayed. Even though I paste in the text editor ( source code editor), the content of the clipboard is understood by the editor as an html code. For example, if I simply paste “<img src="someURL" /> in the text editor, it will be added in the source code as “<p><img src="someURL" /></p>” so this clipboard isn’t

How to add brackets using AutoHotKey

早过忘川 提交于 2019-12-25 02:52:25
问题 I want to create a hotkey Ctrl + ( that adds brackets to a phrase. I.e select x-1 to get (x-1) . How to program this function? I write a lot of phrases such as: x+1/(x-1)^2 so it would be helpful to have a hotkey to add brackets. 回答1: ^(:: SendInput, ^c Sleep 10 Clipboard = (%Clipboard%) SendInput, ^v return This implies that you are actually pressing CTRL+SHIFT+9 (since you don't have a ( key). I did a quick test and it will add round brackets to anything you highlight. I would recommend

Autohotkey: Remove window border

六月ゝ 毕业季﹏ 提交于 2019-12-25 01:44:59
问题 I would like to display just some text with a background. Despite my attempts, there is a lot of empty space around the text. Gui, +AlwaysOnTop -Border -SysMenu -Caption Gui, Add, Text, , Some text Gui, Show, AutoSize WinSet, Style, -0xC00000, A WinSet, Style, -0x40000, A WinSet, ExStyle, -0x00000200, A If, instead of AutoSize , I manually set the size, the text is cut. 回答1: If you add a border to the text, i.e., Gui Add, Text, Border, Some text you'll see it is indeed the window itself with

How do I suppress an unwanted 'return' character after very simple AHK (AutoHotKey) macro?

邮差的信 提交于 2019-12-25 01:44:38
问题 I've redefined all the keys on the numeric keypad to automate programming tasks, including 'cut, 'paste' and 'copy'. But this macro ('paste') fails: ;===== NumpadDot or NumpadDel paste NumpadDot:: NumpadDel:: Send,^v Return Surprisingly this sends a control-v but followed (slightly later) by a 'return/enter' keystroke. What causes AHK to send an extra keystroke and how do I prevent it ? – None of my other macros have any problems. 回答1: Finally discover the issue. I had comments before each