Sign in to follow this  
Followers 0
eliteapu

Until Not _ispressed Help

11 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



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: ?

[center]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.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

That compiles fine, but it wont work. I run it and it does not seem to be pressing numpad1 :whistle:

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Same result...

EDIT: yeah sorry for not posting correctly. And thank you for your quick responses.

Edited by eliteapu

Share this post


Link to post
Share on other sites

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

[center]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.[/center]

Share this post


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

Share this post


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

No...

[center]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.[/center]

Share this post


Link to post
Share on other sites

Okay, well thanks alot man

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