Sign in to follow this  
Followers 0
lopolop

_Ispressed

9 posts in this topic

i am trying to figure out _Ispressed some help with what _IsPressed does like what is the .dll i need(the user 32 or waht ever)

because i have a func that runs a loop when you press e(hotkey) and i want that loop to stop if e _IsPressed again...

While 1
    MouseClick("Right")
    Sleep(314)
    If _IsPressed("45") Then
        ExitLoop
    EndIf
WEnd

i am getting error... _IsPressed(): undefined function.

any help would be great

--Thanks


Share this post


Link to post
Share on other sites



#include <Misc.au3>


[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

ok thanks

but i got another problem see my hotkey is E and so is my way to stop..

is there a way for me to say when E _ispressed (1st time the hotkey will know longer work... and when it is hit the second time Activate it again other wise the loop wont stop because it will exit loop and run func again...


Share this post


Link to post
Share on other sites

ok thanks

but i got another problem see my hotkey is E and so is my way to stop..

is there a way for me to say when E _ispressed (1st time the hotkey will know longer work... and when it is hit the second time Activate it again other wise the loop wont stop because it will exit loop and run func again...

Why not just use HotKeySet. There is an example in the help file which pauses/unpauses a script.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

i dont want to pause my whole script... i just want my hotkey to be like a light switch cilck it.. turns func on... click it agian turns func off...


Share this post


Link to post
Share on other sites

Well you could make it easy on yourself and change your hotkey!!

Or, what about using upper and lower case "e" options, using:

#include <Misc.au3>
HotKeySet(Chr(101), "Test")

While 1
    If _IsPressed(45) Then
        MsgBox(0, "", "Loop")
    EndIf
WEnd


Func Test()
    MsgBox(0, "", "HotKey")
EndFunc

[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

well that makes it so i have to press Shift e... i guess ill just do it this way though... i just think it owuld be easier for the user to e to start e to end...


Share this post


Link to post
Share on other sites

here's a nice little toggle i wrote awhile back.

when the user presses capslock, it starts the script. because of the capslock light, you also get a visual indicator of when the script is running. because you don't want to accidently stART TYPING LIke this when the script is running, whenever you press enter the script also toggles the all caps off until you press enter again.

if you don't want to use capslock for the toggle, just modify this to whatever you need.

; set initial values
AutoItSetOption("SendAttachMode", 1)
AutoItSetOption("SendCapslockMode", 0)
Send("{CAPSLOCK off}")
HotKeySet("{CAPSLOCK}", "Toggle")
$bToggle = 0

; main loop
While 1
    If $bToggle = 1 Then

;
;code to toggle goes here
;

    EndIf
Wend

; called when user presses capslock
Func Toggle()
    If $bToggle = 0 Then
        $bToggle = 1
        HotKeySet("{CAPSLOCK}")
        Send("{CAPSLOCK on}")
        HotKeySet("{CAPSLOCK}", "Toggle")
        HotKeySet("{ENTER}", "Enter")
    Else
        $bToggle = 0
        HotKeySet("{CAPSLOCK}")
        Send("{CAPSLOCK off}")
        HotKeySet("{CAPSLOCK}", "Toggle")
    EndIf 
EndFunc

; called when enter is pressed, but only if toggle is on
Func Enter()
    $bToggle = 0
    HotKeySet("{CAPSLOCK}")
    Send("{CAPSLOCK off}")
    HotKeySet("{CAPSLOCK}", "Toggle")
    HotKeySet("{ENTER}")
    Send("{ENTER}")
EndFunc

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