Jump to content

_Ispressed


lopolop
 Share

Recommended Posts

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

Link to comment
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...

Link to comment
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.


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

Link to comment
Share on other sites

  • Moderators

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

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

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