Jump to content

AutoHotkey v2 knowhow?

Ok, this is for work. We have customized version of MapInfo Pro as main tool. The software received update for production use earlier this year, from 2015 to 2019. Apparently, this caused several hotkeys needing to be changed. I have only used the newer version and learned the hotkeys for that (and napped them to MX Master). But for those who have used previous version for longer, adjusting is harder. The solution is to remap hotkeys with AutoHotkey.

 

The main solution is already working. But with remote work, most of the staff is using virtual machines and connecting remotely to those. We can't install AutoHotkey to VMs and using AutoHotkey effectively from host is not the  perfect solution. There's already working scripts for v1. The question here is, why/how same script after required modifications doesn't work on V2.

 

So I have tried with most basic stuff which is close to remapping on full script.


u::
{
Send "testing" 
} 

This works. However, adding the modifier which would solve the biggest problem breaks it;


if WinActive("ahk_class Notepad")

u::
{
Send "testing
} 

This informs me that it runs into issue on first {.

 

To note that I haven't had time to test this natively, just using portable addon on the VM. So I don't quite know if the issue is with the addon (https://www.autohotkey.com/boards/viewtopic.php?t=73056) or not.

^^^^ That's my post ^^^^
<-- This is me --- That's your scrollbar -->
vvvv Who's there? vvvv

Link to comment
Share on other sites

Link to post
Share on other sites

~u::
if WinActive("ahk_class Notepad")
{
Send "testing
} 

Use ~ so key can be used for regular typing too outside target program.

and type all of the script that hotkey should rely on after the hotkey.

Link to comment
Share on other sites

Link to post
Share on other sites

7 minutes ago, RageTester said:

~u::
if WinActive("ahk_class Notepad")
{
Send "testing
} 

Use ~ so key can be used for regular typing too outside target program.

and type all of the script that hotkey should rely on after the hotkey.

Ok, so function of that has changed between versions. In v1 its opposite. Keys work regularly unless in the specified window. The modifier is required as there needs to be typing normally in popups within main window.
(as example, main Notepad window and Save as... popup)

^^^^ That's my post ^^^^
<-- This is me --- That's your scrollbar -->
vvvv Who's there? vvvv

Link to comment
Share on other sites

Link to post
Share on other sites

Maybe add another hotkey to suspend the whole autohotkey script for times you just need to type regular text. Divide hotkeys with Return, or else it will keep executing the code...

LShift::Suspend
Return
u::
if WinActive("ahk_class Notepad")
{
Send "testing
}
Return

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, RageTester said:

Maybe add another hotkey to suspend the whole autohotkey script for times you just need to type regular text. Divide hotkeys with Return, or else it will keep executing the code...


LShift::Suspend
Return
u::
if WinActive("ahk_class Notepad")
{
Send "testing
}
Return

 

That's actually already with the working script we have. But maybe it is the " return " causing the issue.

 

I'll get back to this tomorrow with some testing.

^^^^ That's my post ^^^^
<-- This is me --- That's your scrollbar -->
vvvv Who's there? vvvv

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×