AutoHotKey overwriting SurfacePen not working - autohotkey

I want to overwrite my "rubber" button on the Surface Pen with AutoHotKey. My aim is to click my PDF presentation (Left and Right Arrow) with the SurfacePen
Described on many Websites:
https://www.reddit.com/r/Surface/comments/3rftuo/autohotkey_tip_f20_maps_the_single_click_f19_maps/
https://www.wpxbox.com/how-to-remap-surface-pen-button-actions/
I have already tried to use other keys like F1 to get the desired reaction and this is working. Just the keys #F18, #F19 and #F20 (for the rubber button) don't seem to work.
#F19:: Send, {Left}
#F20:: Send, {Right}
Thanks

It worked out this way. I am using FoxitReader as PDF Reader
#IfWinActive, ahk_exe FoxitReader.exe
#F18:: Send, {Left}
#F20:: Send, {Right}

Related

AHK Remapping Middle Mouse button to something else

After a month of trial and error, I've finally found a solution!
How to remap Middle mouse button something else?
If you don't have a three-button mouse, this is a must-have for blender (esp. Laptop)
I'm aware of "emulate 3 button mouse" in Preference>>Input.
But if you check that option then you won't be able to 'Select loop'
which uses ALT leftClick.
What if you could remap Mbutton to any other key you rarely use?
Yes you can!
Nice to see that you tried it yourself.
But here's how a context sensitive remap is actually done:
#IfWinActive ahk_class GHOST_WindowClass
LWin::MButton
#IfWinActive
This script will allow you to remap Mbutton with other key, such as LeftWin.
;~--------------------------------------------------------------------------------------
#IfWinActive ahk_class GHOST_WindowClass ; Blender's class
$LWin:: ; "$" this allows to send the trigger key in a working script***
loop
{
if getkeystate("LWin", "p") ; if a button is Physically held down by the user.
{
send, {MButton DOWN}
}
else
{
send, {MButton UP}
;~ MsgBox, Blender is active ; You dont need this.
return
}
}
#IfWinNotActive ahk_class GHOST_WindowClass ; Other than blender (I'm aware of other methods, but this works for me!)
Send, {LWin} ; *** like here I'm able to use Left Win again without triggering the script.
;~ MsgBox,Blender isnt active ;; You dont need this.
return
;~ --------------------------------------------------------------------------------------

Using Send doesn't always work in AutoHotKey?

I have a very simple script to try and remap my AppsKey (the one on the right hand side of the keyboard, between WinKey and Ctrl) to Shift + F2 for the Uplay overlay.
AppsKey::
Send, +{F2}
Return
As you can see, it's very basic, however, when I try to use it in-game (Far Cry 3 in this instance), it works erratically. Like sometimes when I press the AppsKey, the overlay opens. Sometimes it doesn't and I have to repeatedly tap the AppsKey for it to finally show up or close.
No, my AppsKey isn't broken. I tried mapping it to something else and it works without problems. I just want some lead as to why it's acting erratically in this case.
Per the comments, the solution should be akin to this:
AppsKey::
SendInput, {Shift down}{F2 down}
Sleep, 50
SendInput, {Shift up}{F2 up}
return

Bind one key to three modifier keys autohotkey

i wannna be able to press Alt+Middle Button for simulating Shift+Ctrl+Right Button with AutoHotkey. I did it for simulating two keys. And it worked but it is not working for three keys.
so i wrote that:
LAlt & MButton::Send {Ctrl Down}{Shift Down}{RButton Down}
keywait, LAlt
keywait, MButton
LAlt & MButton Up::Send {Ctrl Up}{Shift Up}{RButton Up}
return
where is the problem?
First thing is that the two keywait lines are never executed as you have your send action on the some line as the hotkey, this will make a one-line hotkey or remap
If you wish to execute multiple lines of code in one hotkey routine you will need to start the routine on the line below the hotkey definition label.
Also try taking a simpler approach be using Autohotkeys remapping capabilities
Can't say this will work for you but give it a shot
!MButton::^+RButton
Hope it helps

Autohotkey - multiple scripts and different language issues

I use autohotkey to simplify copying, using Alt+W instead of Ctrl+C. However, I often switch my keyboard to a Hebrew layout, so the w key is now the ' key. Then the autohotkey script for w doesn't work.
I tried to write a second script into the same file but it doesn't get activated when I press Alt+' when I'm in the Hebrew layout. I'm not sure whether it's my syntax or something else, any ideas?
This is my code:
!w::
Send, {ctrl down}{a down}{a up}{c down}{c up}{ctrl up}
return
!'::
Send, {ctrl down}{a down}{a up}{c down}{c up}{ctrl up}
return
Thanks!
Catching Alt-' with the code you used works in other keyboard layouts (like the German layout) so your syntax looks OK to me.
To solve your problem I'd start the autohotkey help file.
Read "List of Keys, Mouse Buttons, and Joystick Controls"
where the section on "Special Keys" explains how to attempt
to catch inrecognized keys via the "keyboard hook".
Basically it describes how to find out the !' scancode which
you then can use as a hotkey alternative.
It is worth to try to use the virtual/scan codes of keys, instead names, This example uses the virtual code (vkXX):
;~ SetKeyDelay, keyDelay:=25, pressDuration:=25 ; details for SendEvent mode.
!vk57:: ; w/'/я... (en/he/ru...)
Send, {CtrlDown}{vk41}{vk43}{CtrlUp}
KeyWait, vk57
;~ Do something by release this key, if necessary...
Return

remapping right click and drag as xbutton1 click and drag

I want to remap right click and drag as XButton1 click and drag. This is what I tried:
RButtonclickdrag::XButton1clickdrag
I think I don't have the correct commands but I have searched a lot and not found anything else. Could somebody please give me some help?
Thanks,
Ellen
Here is a way to do this. Let me know if this suits your needs. The time is set to 100 ms.
#SingleInstance Force
#installKeybdHook
#Persistent
#ifWinActive ahk_class CorelDRAW 15.2
$RButton::
Sleep, 100
GetKeyState, KeyState, RButton, p
if KeyState = U
{
;ToolTip, Short Press ; Activate to test behaviour
Send, {RButton}
Return
}
;ToolTip, Long Press Started ; Activate to test behaviour
sendmessage,0x111,0x1991d,0 ;pan one-shot
MouseClick,L,,,1,0,D
KeyWait, RButton
;ToolTip, Long Press Ended ; Activate to test behaviour
MouseClick,L,,,1,0,U
Return
#ifwinactive