Jump to content
Sign in to follow this  
pastak

Hold down a key

Recommended Posts

pastak

Is there a function to hold down a key ?

Like the MouseDown

Share this post


Link to post
Share on other sites
LarryDalooza

doesnt seem to be working

You know what? ...until you give some background on what you are wanting to accomplish your answers will be as poor as your questions...

So, here is my answer...

try it again... but harder this time.

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites
pastak

You know what? ...until you give some background on what you are wanting to accomplish your answers will be as poor as your questions...

So, here is my answer...

try it again... but harder this time.

Lar.

I looking for a plain script that will hold the shift key down untill i send a cmd to release it.

Share this post


Link to post
Share on other sites
Pain

Try with {SHIFTDOWN} instead, without space.

{SHIFTUP} to release the key.

Share this post


Link to post
Share on other sites
LarryDalooza

I looking for a plain script that will hold the shift key down untill i send a cmd to release it.

There may be a bug in "SHIFT DOWN" ... try "SHIFTDOWN". I think AutoIt has some special doings for modifier keys...

Send("{SHIFTDOWN}")

SHIFTUP later

Lar.

buggerfugginmuggerfudder...bleepbleep

Edited by LarryDalooza

f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites
pastak

Im having some trouble release the keys again now :mellow:

; Hotkeys
HotKeySet("{F11}", "hammer_toggle")
$autohammer = 0
Func hammer_toggle()
        If $autohammer = 0 Then 
        Sleep(100)
        MouseUp("left")
        Send("{ShiftUp}")
        Sleep(100)
        $autohammer = 1
    Else 
        Sleep(100)
        MouseDown("left")
        Send("{ShiftDown}")
        Sleep(100)
        $autohammer = 0
        EndIf
    EndFunc 


; Idle
While 1
    Sleep(10)
Wend

Getting it to hold down the mouse + shift key is working fine now, but I cant get it to release it after pressing F11 the second time.

Share this post


Link to post
Share on other sites
youknowwho4eva

could it be because shift is down :mellow: . your hot key would need to be shift F11. If I'm not mistaken


Giggity

Share this post


Link to post
Share on other sites
pastak

could it be because shift is down :mellow: . your hot key would need to be shift F11. If I'm not mistaken

Tried changing it to some numpad keys and even a simple "P".

Didnt change anything :(

Share this post


Link to post
Share on other sites
youknowwho4eva

if you as in there for a msgbox to come up, does that work? what about setting a timer to auto shiftup after 5 seconds, does that work? I personally have never used hotkeys.


Giggity

Share this post


Link to post
Share on other sites
senthor

Shouldn't it be:

; Hotkeys
HotKeySet("{F11}", "hammer_toggle")
global $autohammer = 0
Func hammer_toggle()
   If $autohammer = 0 Then
      Sleep(100)
      MouseDown("left")
      Send("{ShiftDown}")
      Sleep(100)
      $autohammer = 1
      HotKeySet("{F11}")
      HotKeySet("+{F11}", "hammer_toggle")
   Else
      Sleep(100)
      MouseUp("left")
      Send("{ShiftUp}")
      Sleep(100)
      $autohammer = 0
      HotKeySet("+{F11}")
      HotKeySet("{F11}", "hammer_toggle")
   EndIf
EndFunc   
; Idle
While 1
   Sleep(10)
Wend
Edited by senthor

Share this post


Link to post
Share on other sites
pastak

Shouldn't it be:

; Hotkeys
HotKeySet("{F11}", "hammer_toggle")
global $autohammer = 0
Func hammer_toggle()
   If $autohammer = 0 Then
      Sleep(100)
      MouseDown("left")
      Send("{ShiftDown}")
      Sleep(100)
      $autohammer = 1
      HotKeySet("{F11}")
      HotKeySet("+{F11}", "hammer_toggle")
   Else
      Sleep(100)
      MouseUp("left")
      Send("{ShiftUp}")
      Sleep(100)
      $autohammer = 0
      HotKeySet("+{F11}")
      HotKeySet("{F11}", "hammer_toggle")
   EndIf
EndFunc   
; Idle
While 1
   Sleep(10)
Wend
Seems to be working :mellow:

thanks alot

Edited by pastak

Share this post


Link to post
Share on other sites
youknowwho4eva

:-P like I said. Only I haven't needed to use hotkeys yet, so I couldn't make an example and know it works


Giggity

Share this post


Link to post
Share on other sites
pastak

you know what the problem was?

When Shift-Key is down, the hotkey must be shift+f11.

not f11.

:mellow:

ah and the "+" is instead of shift :(?

Share this post


Link to post
Share on other sites
youknowwho4eva

yes, look up send in the help file, it will give you loads of valuables like that one.


Giggity

Share this post


Link to post
Share on other sites
pastak

yes, look up send in the help file, it will give you loads of valuables like that one.

thank you both :mellow:

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.