Sign in to follow this  
Followers 0

Key Press Script

20 posts in this topic

Posted

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

Share this post


Link to post
Share on other sites



Posted

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.

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

....

.....

......

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

Can someone post an example script?

Share this post


Link to post
Share on other sites

Posted (edited)

....

.....

......

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

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted (edited)

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

Share this post


Link to post
Share on other sites

Posted

....

.....

......

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

Can someone post an example script?

You resemble that remark.

Share this post


Link to post
Share on other sites

Posted

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

At the HotKeySet("1","Main" and at While 1, how would I go setting it as the numpad key I wish to use? :)

Share this post


Link to post
Share on other sites

Posted (edited)

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

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted (edited)

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

Share this post


Link to post
Share on other sites

Posted

owned :)

Share this post


Link to post
Share on other sites

Posted

Krankios, do you realize you posted in a 4 year old thread?

Share this post


Link to post
Share on other sites

Posted (edited)

That explains why a topic with 15 posts, have 20,000 views ^^ I was scratching my head trying to figure it out lol

Edited by IanN1990

Share this post


Link to post
Share on other sites

Posted

Krankios, do you realize you posted in a 4 year old thread?

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

Share this post


Link to post
Share on other sites

Posted

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

Well I do read most new posts, but when they're from you, I just can't click fast enough.. :)

Share this post


Link to post
Share on other sites

Posted

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

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

  • Recently Browsing   0 members

    No registered users viewing this page.