Program "calculator" button for ahk - autohotkey

what name can I use for the Logitech button that appears on their keyboard that I'm using. I want to reprogram it in Autohotkey. I see it opens the calculator if you did not install the the proprietary software. Thanks!
e.g.
Calculator:: ;then some commands
Logitech:: ;then some commands

Here is how I set my Calc key to launch Google Chrome with AHK:
Launch_App2::
Run, "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

You can use the keyboard hook along with viewing the keyboard history.
The process for finding these keys is specified in the documentation.

Related

How to add a shortcut for "Launch the selected target in terminal window" button?

I use Visual Studio Code and the CMake extension (twxs.cmake). The extension integrates CMake to vscode. There is a button which allows us to run a target in terminal window. It looks like a play button. .
My question is, how can I add a keyboard shortcut for this button? I cannot find the action name so I cannot link it. I wish to use keyboard shortcut instead of clicking that button every time.
I tried googling the action name of this button so I could bind it with any keyboard shortcut, but I couldn't find anything.
Any help will be appreciated.
Thank you in advance!
Shift+F5 appears to do the same thing as clicking that button.
I found the following here:
Running Targets Without a Debugger
Sometimes one will want to just run a target and see its output. This
can be done with the CMake: Execute the current target without a
debugger command, or the associated keybinding (the default is
Shift+F5).
The output of the target will be shown in an integrated terminal.

Autohotkey Key for hiding current window

I try to close a window with the below configuration when pressing Ctrl and h.
Unfortunately it does not work.
E.g. in Chrome it opens the little window as if you press alt+space, when I focus the address bar in Chrome it works.
What do I do wrong?
;Hide a window
^h:: Send !{Space}n
Return
I managed to get a solution which fixes my issue:
I now use Kinto, which itself uses AutoHotkey, and it has the key action I want right from the start using the Mac OS Layout from the Kinto Installation Options.
Kinto itself uses AutoHotkey, you can find the AutoHotkey-file on Github.

AutoHotkey script only works when this window is open

Autohotkey script only works when I have this window open (please see screenshot). If I minimise it, it does not work. I have the H visible in the tray. Any help would be appreciated, thanks.
My script to use with Windows Pen is simply:
#F20::Run OneNote ; Single click, Open OneNote
if your keyboard has a f20 key
#F20::Run C:\Windows\write.exe
Would run wordpad.
Supply the path where OneNote is located.
#F20::Run path\OneNote

How to run the select code in VScode?

I want to run the select code of python in VScode. Till now, I have to copy the code and paste it in the terminal below to run. The system is mac OS.
So is there any way to run the code directly after I selected the code? For example, like the shortcuts.
Thanks.
There is no default keybindings for command "Run Selected Text in Active Terminal", but you can create one.
Press Ctrl+K, Ctrl+S to open File → Preferences → Keyboard Shortcuts.
Search for workbench.action.terminal.runSelectedText in keybindings.
Press the icon on the left to open a windnow with this message "Press desired key combination..." and make your choice. (I've pressed Ctrl+Alt+R - as this combination was not used yet.)
Press Enter to store your keybinding.
Tested on VSCode 1.30.2 on Windows 10 Pro.
#yanachen, this is now possible in VS Code. All you need to do is:
1. Ensure python is running in the VS Code terminal window
2. Select the text you wish to execute in python
3. Invoke the command 'workbench.action.terminal.runSelectedText' as defined in the following link:
https://code.visualstudio.com/docs/editor/integrated-terminal#_key-bindings
Now it's supported by default shortcut "shift" + "enter".
select the proper code snippet
press "shift" + "enter"
Here is the setting for running selection in "interactive window."
In my VS Code (version 1.56.2), I do the following things: go to Settings, search for interactive window, in the resulting left panel choose Jupyter, and finally check the box next to Jupyter: Send selection to interactive window. That's it. One more step for some users (including me) is to modify the keybinding for running selection to your preference. For example, got to keyboard shortcuts, type run selection, you should see a list of keybindings and you may need to redefine them if conflicts exist.
Some language specific extensions have already an existing keybinding.
On Windows, for the PowerShell extension it is currently F8 to run the selected text.
Install the vscode extension Node.js Exec. then select the block of code you want to run and press f8. worked for me.

How to have program shortcut icon open script along with program?

I want to have a script that works with a specific program open when I open that program with the program's shortcut icon. I have tried pasting the path into the target line in the icon's properties, but that didn't work. What do I need to do?
I think that I read that you want to create an icon that looks like the original application launch icon, which will, when clicked, indeed launch the original application AND run some extra ahk code. You can create a Shortcut or Link to a ahk script that will launch your app (run, c:\path\yourapp.exe) and perform other tasks (WinWaitActive, your app) etc.. In the link to the ahk script (does not work on the real ahk script, ONLY with the lnk file) you can select the properties (right click) and change the icon to whatever you want (often you can use the icon of the original application, by pointing to the .exe (instead of selecting icons from the the standard shell32.dll). So by selecting the new icon to e.g. c:/program files/officexx/word.exe , your AHK script will get the icon as if it is the word launch icon. Hope that answers your question.
At the beginning of the script, but ater you execute the run command, you place the timer
Run, abc.exe
SetTitleMatchMode, 2
Sleep, 1000 ; Give the app some time to run before you start the test
SetTimer, CloseScript, 1000
Return
CloseScript:
IfWinExist, place the windows title here....
Return
ExitApp
This is one of the first things that I did with AutoHotKey. I wanted a 'wrapper' script for a program that I regularly used that lets me to chose different program options with a script GUI form when I press the F4 key while clicking the link. Just clicking the link starts the program normally. Eat your heart out Microsoft.
In the link's Start-In property I put the actual program's directory and my script gets the program name and other details from the script's command line arguments in the link's target property.