AutoHotKey

How to minimize a window by closing it?

余生长醉 提交于 2019-12-13 05:49:38
问题 I want to make a window only be minimized when any act of closing it is initiated (click the close button, Alt+F4 ). For AutoHotKey I think WinMinimize is needed, but I don't know how to detect a closing event. If you know a solution for PowerShell, please share too. Related: Is it possible to catch the close button and minimize the window instead? 回答1: #NoEnv #SingleInstance Force ; Add the ahk_class of the windows you want minimize by clicking on the close button in this array: Classes :=

AutoHotKey if statement not working

痴心易碎 提交于 2019-12-13 05:19:30
问题 What is wrong with this? if A_OSVersion = WIN_7 or A_OSVersion = WIN_XP { MsgBox, Win7 or XP } else { if WinActive("ahk_exe Explorer") { !f::!h } } The goal is to replace Alt+F with Alt+H in Explorer when I'm running Windows 8, 8.1, or 10, and I am testing on a Windows 7 machine, so the code shouldn't run at all, but the hotkey does and the MsgBox doesn't. Do I need to reorder things for it to work? The syntax looks right to me, but I've been having a hard time with syntax for AHKscript. Kind

Parse numerical values with space as delimiter while ignoring digit grouping (i.e. 1 020 vs 1020)

南笙酒味 提交于 2019-12-13 03:36:08
问题 Need some ideas here. I have a string that may look like "542.12 18.02 1 020.00 2.34" that I want to parse into seperate vars (with A_Space as delimiter). The problem is that the value 1020.00 is written on the form 1 020.00 so I get the vars 1 and 020.00. I can't come up with anything with RegExReplace cause as far as can understand from the documentation I have to replace the whole NeedleRegEx. Else I could have used " \d+( replaceonlythisspace)" as the "real" values always have a dot in it

autohotkey Media_Play_Pause not mapped to Pause but mapped to ^Space

拜拜、爱过 提交于 2019-12-13 01:08:32
问题 Since Spotify changed to their latest version the old Play/Pause through ControlSend, ahk_parent, {space}, ahk_class SpotifyMainWindow stopped working. It seems Spotify can now capture the Media keys and as suggested by other members the following works: ^Space::Media_Play_Pause HOWEVER mapping to the Pause key doesn't work. Pause::Media_Play_Pause Any idea why??? FYI here is the scan of the keys: Working (^Space): VK SC Type Up/Dn Elapsed Key Window ------------------------------------------

Is there a way to assign a multi-line string to a object property?

独自空忆成欢 提交于 2019-12-12 14:42:32
问题 I know that you can assign a multi-line string to a variable like this: MyVar = ( this is a string with multiple lines ) But is there a way to assign the above string to an object property? I tried doing it like this but I received an error: Array := {} Array["key"] = ( this is a string with multiple lines ) The error says: The following variable name contains an illegal character "this is a string" I just want to be able to open my script in a text editor and copy and paste multiple-line

Change autohotkey tray icon from within script

巧了我就是萌 提交于 2019-12-12 13:18:59
问题 How can I change the tray icon to my.ico from within an Autohotkey script for example when the script is paused. For this I have come up with my own Pause Script menu item in the tray menu. #SingleInstance ignore Menu, Tray, Tip, AutoCase 0.11 Menu, Tray, Icon,,,1 Menu, Tray, Icon, D:\\Utilities\\AutoCase\\AutoCase-Icon-32x32.ico,1,1 Menu, Tray, Icon, D:\Utilities\AutoCase\AutoCase-Icon-(Paused)-32x32.ico,2,1 Menu, Tray, NoStandard Menu, Tray, Add, &Pause Script, PauseHandler Menu, Tray, Add,

Can AutoHotKey toggle keymapping?

自闭症网瘾萝莉.ら 提交于 2019-12-12 11:21:57
问题 So I'm trying to write a simple script in AutoHotKey that will use NumLock (which I have mapped to the capslock in my registry) as a toggle to turn my directional keys into the numpad nab keys. My script is as follows: GetKeyState, state, NumLock, T if state = D { Up::Numpad8 Down::Numpad2 Left::Numpad4 Right::Numpad6 Enter::Numpad5 } if state = U { $Up::Up $Down::Down $Left::Left $Right::Right $Enter::Enter } Return However, I get an error saying Up is repeated in line 15. How do I tell

How to map a global key to refresh?

匆匆过客 提交于 2019-12-12 09:16:37
问题 Winamp has a neat feature. Global keys. That way I can change the playing song even if Winamp GUI doesn't have focus. I am looking for a similar solution to Firefox or Chrome . I use Eclipse to code PHP. It auto SSH's and saves to another machine (testing) I could use something like XRefresh with a mapped virtual drive but I cant install Samba on the testing machine. Right now I have to: CTRL + S (save and auto-update) ALT + TAB (switch to Firefox GUI) F5 (refresh current Firefox page) ALT +

How to detect if any video is being played now? [closed]

拥有回忆 提交于 2019-12-12 09:09:51
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . How to detect if any video is being played now using autohotkey, autoit, vbscript, c#, or c? Video could be being played/streamed in any local player, web based player, or html5 player. We do not know the name of player also player may not be in the full screen. PS. Detecting CPU

How do I return from inside an if/else block in Autohotkey?

若如初见. 提交于 2019-12-12 06:25:10
问题 Below is the code snippet I used. If you are doing something in a browser, it should detect that you are currently in a browser and copy the URL to the clipboard. If you are not in a browser, then since there is no URL there is no question of doing that. Regardless what browser I am in, the first MessageBox is always outputting the value 0. However, the MessageBox inside the function never gets activated, that is "No browser detected" message is never displayed. The value therefore can't be