Jump to content

HotKeySet: Any way to return a modifier back on?


 Share

Recommended Posts

Hi, just found out about AutoIt today, and I'm having some fun adding application-specific support to the hardware buttons on my TabletPC (something that should have been there in the first place, IMO). I've managed to work my way through the syntax, and I've gotten everything working more or less the way I need it to, but one last thing that would really make my day is someway of returning a modifier key to its "on" status after a HotKeySet operation. To expand a little:

Right now I've got the side button on the stylus set to "ALT". I've set up my rocker switch to change the brush size in photoshop, and also to Undo and Redo with the ALT modifier (on the stylus). This works great, except for the fact that after an Undo/Redo, I lose my ALT status (ie, I'm still holding down the side button). This means that to continuously undo/redo, I have to release and repress the sideswitch/ALT key. Is there any way to revert the ALT status?

Here's part of my code (I've left out the remaining 4 functions, since they're basically repeats of the first 2):

; reassign tablet buttons for application-specific functions

AutoItSetOption("WinTitleMatchMode",4);allow matching of classname

HotKeySet("{DOWN}","RockerDown")
HotKeySet("{UP}","RockerUp")
HotKeySet("{ENTER}","RockerIn")
HotkeySet("!{DOWN}","RockerAltDown")
HotKeySet("!{UP}","RockerAltUp")
HotKeySet("!{ENTER}","RockerAltIn")

_ReduceMemory()

While 1
  Sleep(500)
WEnd

Func _ReduceMemory($i_PID = -1)
    
    If $i_PID <> -1 Then
        Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
        Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
        DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
    Else
        Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
    EndIf
    
    Return $ai_Return[0]
EndFunc;==> _ReduceMemory()

Func RockerDown();Rocker Switch Down
  Select
  Case WinActive("classname=Photoshop")
    Send("[")
  Case WinActive("classname=PSDocC")
    Send("[")
  Case WinActive("Alias SketchBook Pro")
    Send("^z")
  Case WinActive("classname=Ink Art")
    Send("z")
  Case WinActive("Corel Painter IX")
    Send("^z")
  Case Else
    HotKeySet("{DOWN}")
    Send("{DOWN}")
    HotKeySet("{DOWN}","RockerDown")
  EndSelect
EndFunc

Func RockerAltDown();Rocker Switch Down+Alt Modifier
  Select
  Case WinActive("classname=Photoshop")
    Send("^-")
  Case WinActive("classname=PSDocC")
    Send("^-")
  Case WinActive("Alias SketchBook Pro")
    Send("^0")
  Case WinActive("Corel Painter IX")
    Send("^-")
  Case Else
    HotKeySet("!{DOWN}")
    Send("!{DOWN}")
    HotKeySet("!{DOWN}","RockerAltDown")
  EndSelect
EndFunc
Edited by LoTekK
Link to comment
Share on other sites

Don't mean to be a pest and all, but I was wondering if anyone had any input? Gotta hit the sack now. :whistle:

<{POST_SNAPBACK}>

maybe....could just do like a
Send("{ALT up}")
at the end of your case that uses the alt key, same for ctrl... that way the modifier up is sent even though you're still holding the button
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...