Jump to content

HotKeySet w/ Shift ShiftDown ShiftUp


Recommended Posts

I want to create a function so that when I press shift, it holds shift down. And when I press shift again, it stops holding shift down. Any help would be appreciated.

Global $Shift

HotKeySet("{LSHIFT}", "Toggleshift")

Func Toggleshift()

$Shift = NOT $Shift

If $Shift = 0 Then

Send ("{SHIFTDOWN}")

Else

Send ("{SHIFTUP}")

EndIf

EndFunc

What am I doing wrong?

Link to comment
Share on other sites

Good catch, now the problem becomes Shift goes down and don't come up. I think the way I approached this was entirely wrong.

Maybe because now the un-set hotkey is being affected by the shift key being pressed?

Example. Let's say you use F10 as a hotkey. So, you press F10 and the shift key is held. Now when you want to unset this, you'll actually be pressing shift+F10.

Link to comment
Share on other sites

Maybe because now the un-set hotkey is being affected by the shift key being pressed?

Example. Let's say you use F10 as a hotkey. So, you press F10 and the shift key is held. Now when you want to unset this, you'll actually be pressing shift+F10.

CODE
#include<Misc.au3>

Global $Shift

;HotKeySet("{PAUSE}", "Toggleshift")

$dll = DllOpen("user32.dll")

While 1

if _IsPressed(0x09, $dll) then ;Tab

Toggleshift()

EndIf

WEnd

Func Toggleshift()

$Shift = NOT $Shift

If $Shift = 0 Then

Send ("{SHIFTDOWN}")

Else

Send ("{SHIFTUP}")

EndIf

EndFunc

Get the Hex keycodes here

http://www.kbdedit.com/manual/low_level_vk_list.html

Edited by ReaImDown
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
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...