Jump to content

Until Not _ispressed Help


Recommended Posts

Heres my beginning script. NO CREDITS ADDED YET, but i did take the beginning bit from another post.

What I am looking for is it to have a client be able to specifiy a hotkey to be used, then when they hold that hotkey, it will hit numpad1 and when they release, it will release numpad1

Also, later on i want to be able to have the hotkey to be set on a mouse1/2 or 3 :whistle:

:)

#include <Misc.au3>
$var = InputBox("","Hotkey : ", 1)
HotKeySet($var, "UP")
HotKeySet("{Esc}", "Quit")


Func UP()
If _IsPressed($var) Then
Do
Send("{numpad1 down}")
Until Not _IsPressed($var) then
Send ("{numpad1 up}")
Else
sleep(10)
Endif
EndFunc

Func Quit()
    Exit
EndFunc
Edited by eliteapu
Link to comment
Share on other sites

  • Moderators

Heres my beginning script. NO CREDITS ADDED YET, but i did take the beginning bit from another post.

What I am looking for is it to have a client be able to specifiy a hotkey to be used, then when they hold that hotkey, it will hit numpad1 and when they release, it will release numpad1

Also, later on i want to be able to have the hotkey to be set on a mouse1/2 or 3 :whistle:

:)

#include <Misc.au3>
$var = InputBox("","Hotkey : ", 1)
HotKeySet($var, "UP")
HotKeySet("{Esc}", "Quit")
Func UP()
If _IsPressed($var) Then
Do
Send("{numpad1 down}")
Until Not _IsPressed($var) then
Send ("{numpad1 up}")
Else
sleep(10)
Endif
EndFunc

Func Quit()
    Exit
EndFunc
Is there an issue here you need help with :lol: ?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Try this:

#include <Misc.au3>
$var = InputBox("","Hotkey : ", 1)
HotKeySet("{Esc}", "Quit")

While 1
   If _IsPressed($var) Then
      Do
         Send("{numpad1 down}")
      Until Not _IsPressed($var) then
      Send ("{numpad1 up}")
   Else
      sleep(100)
   Endif
WEnd

Func Quit()
    Exit
EndFunc

Edit: btw, you'll need to lookup _IsPressed in the help file and use the appropriate ID code for the key.

#)

Edited by nfwu
Link to comment
Share on other sites

Try it now.

Edit: btw, you'll need to lookup _IsPressed in the help file and use the appropriate ID code for the key.

Edit2: And next time state what the problem is first.

#)

Edited by nfwu
Link to comment
Share on other sites

  • Moderators

Two ways to intepret what you are doing I guess.

Global $sVarPressed
$var = InputBox("", "Hotkey : ", 1)
HotKeySet($var, "UP")
HotKeySet("{Esc}", "Quit")
While 1
    Sleep(100000)
WEnd

Func UP()
    $sVarPressed = Not $sVarPressed
    If $sVarPressed Then
        Send("{numpad1 down}")
    Else
        Send("{numpad1 up}")
    EndIf
    Return
EndFunc   ;==>UP
Func Quit()
    Exit
EndFunc   ;==>QuitoÝ÷ Ø  ݶ¨¶«jëh×6Global $sVarPressed
$var = InputBox("", "Hotkey : ", 1)
HotKeySet($var, "UP")
HotKeySet("{Esc}", "Quit")
While 1
    Sleep(100000)
WEnd

Func UP()
    $sVarPressed = Not $sVarPressed
    Do
        Send("{numpad1}")
    Until Not $sVarPressed
    Return
EndFunc   ;==>UP
Func Quit()
    Exit
EndFunc   ;==>Quit

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Thank you very much. the 2nd one is more what I am looking for, although it needs a bit of tweaking..thanks again..

Another question would be..is it possible to make it so in the input box it will recolonize mouse clicks to they can be hotkeys

Link to comment
Share on other sites

  • Moderators

Thank you very much. the 2nd one is more what I am looking for, although it needs a bit of tweaking..thanks again..

Another question would be..is it possible to make it so in the input box it will recolonize mouse clicks to they can be hotkeys

No...

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...