Sign in to follow this  
Followers 0
jackhammer_bob

HotKeySet w/ Shift ShiftDown ShiftUp

7 posts in this topic

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?

Share this post


Link to post
Share on other sites

Help File:

The following hotkeys cannot be set:

Alt, Ctrl, Shift, Win These are the modifier keys themselves!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Edited by jackhammer_bob

Share this post


Link to post
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.

Share this post


Link to post
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.

hmmm what was the point for this again? you can try and use _Ispressed()


[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Do everyone a favor and remove the key logger info from your signature.

Never mind, removed it myself

Edited by GaryFrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


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
Sign in to follow this  
Followers 0