Jump to content

Hold down a key


pastak
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 10 years later...
  • Developers

Oh, and while you have my attention: Stick to posting in one topic instead of cross posting the same question at different places.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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