Jump to content

Key Press Script


XxSunxX
 Share

Recommended Posts

Its me again, I can't get the key macro to work. Could someone please give me a full example script instead of telling to look myself, I found the help file but its not what I want because the example is mixed up with a GUI window create, and isn't the kind of key press I want, its just a hotkey for pause script or something. So could someone please give me an example script that does the following:

Press key "1" to activate the loop of Z.

Key Z is looped (pressed over and over till otherwise..)

Press key "1" a second time to stop the loop of Z

Link to comment
Share on other sites

  • Moderators

Its me again, I can't get the key macro to work. Could someone please give me a full example script instead of telling to look myself, I found the help file but its not what I want because the example is mixed up with a GUI window create, and isn't the kind of key press I want, its just a hotkey for pause script or something. So could someone please give me an example script that does the following:

Press key "1" to activate the loop of Z.

Key Z is looped (pressed over and over till otherwise..)

Press key "1" a second time to stop the loop of Z

http://www.autoitscript.com/autoit3/docs/f...s/HotKeySet.htm

Has the only example you need.

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

Its me again, I can't get the key macro to work. Could someone please give me a full example script instead of telling to look myself, I found the help file but its not what I want because the example is mixed up with a GUI window create, and isn't the kind of key press I want, its just a hotkey for pause script or something. So could someone please give me an example script that does the following:

Press key "1" to activate the loop of Z.

Key Z is looped (pressed over and over till otherwise..)

Press key "1" a second time to stop the loop of Z

http://www.autoitscript.com/forum/index.php?showtopic=40326

Is the only topic you need for this subject.

Link to comment
Share on other sites

....

.....

......

..........*Ignores the posts above seeming they didn't read*....

Can someone post an example script?

Not to sound insulting but you only need to add two example scripts together that were provided in that previous thread.

HotKeySet("1", "Main")

Func Main()
    while 1
        If _IsPressed(31) Then ; If 1 key is pressed
            ExitLoop ; Exit Loop
        EndIf
        send("z")
        Sleep(5)
    Wend
EndFunc
Edited by BALA
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Link to comment
Share on other sites

Not to sound insulting but you only need to add two example scripts together that were provided in that previous thread.

HotKeySet("1", "Main")

Func Main()
    while 1
        If _IsPressed(31) Then ; If 1 key is pressed
            ExitLoop ; Exit Loop
        EndIf
        send("z")
        Sleep(5)
    Wend
EndFunc
If_IsPressed(31)<-----How is that 1?

Oh, and what would the keys be for numpad 1-9, insert, home, page up, delete, end, page down

Link to comment
Share on other sites

the 31 is a hexkey for the key "1"

From help file under _IsPressed:

60 Numeric keypad 0 key
61 Numeric keypad 1 key
62 Numeric keypad 2 key
63 Numeric keypad 3 key
64 Numeric keypad 4 key
65 Numeric keypad 5 key
66 Numeric keypad 6 key
67 Numeric keypad 7 key
68 Numeric keypad 8 key
69 Numeric keypad 9 key
Edited by BALA
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Link to comment
Share on other sites

  • Moderators

....

.....

......

..........*Ignores the posts above seeming they didn't read*....

Can someone post an example script?

You resemble that remark.

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

the 31 is a hexkey for the key "1"

From help file under _IsPressed:

60 Numeric keypad 0 key
61 Numeric keypad 1 key
62 Numeric keypad 2 key
63 Numeric keypad 3 key
64 Numeric keypad 4 key
65 Numeric keypad 5 key
66 Numeric keypad 6 key
67 Numeric keypad 7 key
68 Numeric keypad 8 key
69 Numeric keypad 9 key
Did you even read my post....

If you want numerical 0 for example, you would replace 31 with 60. 61 if you want numerical 1, 62 for numerical 2, etc.

Edited by BALA
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Link to comment
Share on other sites

*Ignores the posts above seeming they didn't read*....

Oh, damn...you're totally right. Me referring you to your previous topic makes it perfectly clear that I didn't read...

Eehm, I don't see the logic in that. Also, please do explain how it's needed to create another topic one hour after

the last post in your previous topic on the very same subject.

Link to comment
Share on other sites

Did you even read my post? Re-read it... :)

Stop getting people to work for you. All the necessary information has been given to you, they referred IsPressed and HotkeySet, which are the two functions you are looking for. Open up the damn helpfile, read the information, attempt a "test", experiment, then, if all fails, come back for a little more advice.

Kurt

Awaiting Diablo III..

Link to comment
Share on other sites

Where do you think you get off? XxSunxX

You reject the statements of 2 regulars(Smoke_N and Helge) on the forum without reading their posts? And then have the intestinal fortitude to actually accuse them of not reading?

Do you have a brain defect?

And why would you used "_IsPressed" for this script? This problem is much quicker and easier to solve with "Hotkeyset" as mentioned above.

Copied straight from smokes link with minor alterations:

; Press Esc to terminate script

Global $UnPaused
HotKeySet("1", "TogglePause")
HotKeySet("{ESC}", "Terminate")

While 1
    Sleep(100)
    ToolTip("Script is Paused",0,0)
WEnd

Func TogglePause()
    $UnPaused = NOT $UnPaused
    While $UnPaused
        ToolTip("Sending...",0,0)
        Send("z")
    WEnd
EndFunc

Func Terminate()
    Exit 0
EndFunc

I wanna hear some apologies from you mouth.

Edited by Paulie
Link to comment
Share on other sites

  • 4 years later...
  • Developers

Yeah i do and i must be pretty "interesting" to you considering you are watching what i post :)

Not interesting and please don't do this unless there is a real use for it.

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

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