Sign in to follow this  
Followers 0
TheRaZoR

Help with SetHotKey

13 posts in this topic

Hey ya!

I want 2 scripts for:

1. "Pressing J and doing until I press J again"

2. "Pressing N and do the script 1 time. If i press N again it should do it 1 time again... And so on!

I just need these Basics, i dont understand the structure.

I tried with:

If getInput"J" then $i = 1

While $i = 1

send ("hey")

If get Input"J" then $i = 0

WEnd

but i need the command for this "getInput"J""

Pls Help me! :P

Share this post


Link to post
Share on other sites



Hey ya!

I want 2 scripts for:

1. "Pressing J and doing until I press J again"

2. "Pressing N and do the script 1 time. If i press N again it should do it 1 time again... And so on!

I just need these Basics, i dont understand the structure.

I tried with:

If getInput"J" then $i = 1

While $i = 1

send ("hey")

If get Input"J" then $i = 0

WEnd

but i need the command for this "getInput"J""

Pls Help me! :P

If you look at the example in the helpfile for HotKeySet you will see how to toggle a function, run a function whenever a key is pressed and how to exit the 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 can't make heads or tails of what exactly you are trying to accomplish. Can you post your script and tell us what it is for 'In complete detail'?

Also: http://www.autoitscript.com/forum/index.ph...topic=19439&hl= You've already posted a topic on this subject hadn't you?


[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

Although I feel that HotKeySet() would be better for this, if you used keys like F1 / F2, here is an example of how I'm interpreting your request.

While 1
    If _IsPressed("4A") Then
        While 1
            Sleep(100)
            If _IsPressed("4E") Then
                _GoToMainScript()
                ExitLoop
            EndIf
            If _IsPressed("4A") Then
                ExitLoop
            EndIf
        WEnd
    EndIf
    
    If _IsPressed("4E") Then _GoToMainScript()
    Sleep(10)
WEnd

Func _GoToMainScript()
;Do once script
EndFunc

Func _IsPressed($s_hexKey, $v_dll = 'user32.dll')
    Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey)
    If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1
    Return 0
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

@smoke old topic was for general question

i thought to make it clearer just to look on the command "sethotkey" and "hotkeyset"

i think iam too stupid, could someone make me this basic? where i just have to fill my password in?

its for a chatroom, its sometimes full and i want to write a login bot what to toogle on/off

and for N i want specifie a sentense "Hey XXXXXX" and so on. thats where i need it for.

could someone tell me, how to insert "Pressing2 keys at the same time --> for example: ALT+F4

pls i know some basics of scripting but i dont understand the example in help file =(

Share this post


Link to post
Share on other sites

Hmmm, I did exactly as you requested in your first post, if you press 'J' it will send you to the next loop, where you can put in whatever you want to do., and while there, you can put whatever send commands you want, and if you Press 'N' while there you can go to your do once script. All you have to do is fill in the blanks.

Now, the help file again explains doing things like Alt+F4, look at the 'Send Commands' in help.

HotKeySet("!{F4}", "Testing")

While 1
    Sleep(1000)
Wend

Func Testing()
    MsgBox(48, "Success!", "You made it to your function")
EndFunc

These things can be found here: http://www.autoitscript.com/autoit3/docs/a...ix/SendKeys.htm


[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

@smoke old topic was for general question

i thought to make it clearer just to look on the command "sethotkey" and "hotkeyset"

i think iam too stupid, could someone make me this basic? where i just have to fill my password in?

its for a chatroom, its sometimes full and i want to write a login bot what to toogle on/off

and for N i want specifie a sentense "Hey XXXXXX" and so on. thats where i need it for.

could someone tell me, how to insert "Pressing2 keys at the same time --> for example: ALT+F4

pls i know some basics of scripting but i dont understand the example in help file =(

mk:@MSITStore:C:\Program%20Files\AutoIt3\beta\AutoIt3.chm::/html/functions/Send.htm

does that link do anything for you?


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

$i = 0

Global $Paused
HotKeySet("{PAUSE}", "TooglePause")
HotKeySet("n", "Hi")  
Func TooglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
    WEnd
EndFunc
Func Hi()
    send ("hi")
    send ("{ENTER}")
EndFunc

Do
    send ("{TAB}")
    send ("XXXXXX")
    send ("{ENTER}")
    sleep("1500")
    send ("{ENTER}{ENTER}{ENTER}{ENTER}")
Until $i = 10

ok thats working now, but how to start it "paused" that i have to start it with {PAUSE} first?

and: what is the command for Alt+F4 ?

send ("{Alt"},"F4") ???

Edited by TheRaZoR

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

$i = 0

Global $Paused
HotKeySet("{PAUSE}", "TooglePause")
HotKeySet("n", "Hi")  
Func TooglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
    WEnd
EndFunc
Func Hi()
    send ("hi")
    send ("{ENTER}")
EndFunc

Do
    send ("{TAB}")
    send ("XXXXXX")
    send ("{ENTER}")
    sleep("1500")
    send ("{ENTER}{ENTER}{ENTER}{ENTER}")
Until $i = 10

ok thats working now, but how to start it "paused" that i have to start it with {PAUSE} first?

and: what is the command for Alt+F4 ?

send ("{Alt"},"F4") ???

try

Send("!{F4}")
it's explained in the helpfile.... Edited by cameronsdad

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

how to start this script "paused"? that i have to start it with "{PAUSE}" first?

Share this post


Link to post
Share on other sites

Try Send("{PAUSE}") right under the HotkeySets.

HotKeySet("{PAUSE}", "TooglePause")
HotKeySet("n", "Hi")
Send("{PAUSE}")

Does that work?


[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

#12 ·  Posted (edited)

i forgot to write in here ^^ i did that already xD

pls could someone give me the shortcut for mouse 3,4,5 keys?

Edited by TheRaZoR

Share this post


Link to post
Share on other sites

Afraid to post an answer in here, everytime I post what you want, you find a way to shoot holes in it...

What do you want to do with those buttons, make them do something or if they are pressed do something? You're not very specific.

_IsPressed

--------------------------------------------------------------------------------

Check if key has been pressed

#Include <Misc.au3>

_IsPressed($s_hexKey[, $v_dll = 'user32.dll'])

Parameters

$s_hexKey key to check for

$v_dll Optional: Handle to dll or default to user32.dll

Return Value

Success: Returns 1 if true.

Failure: Returns 0 if false.

Remarks

01 Left mouse button

02 Right mouse button

04 Middle mouse button (three-button mouse)


[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

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