Jump to content
Sign in to follow this  
alein_hunter

hotkeys help

Recommended Posts

alein_hunter

just got autoit been reading all day and i can't find nothin to help me

first off, i wanna make a prog that when i press left, or right it will press 'z' very fast, but i want it to stop pressing 'z' if im not holding down left or right which i can't find anywhere on forums

also, i wanted to enable/disable the functions left and right do and all i've come up with makes the prog close completly, i'd like f9 to turn it on AND off and was having some troubles with that.

sry if i shoulda read this somewhere but i been reading and i can't seem to find it thx for the help =p

edit: i been looking some more and i think i must combine ProcessWait ( "process" [, timeout] ) with the hotkey...not sure tho

Edited by alein_hunter

Share this post


Link to post
Share on other sites
alein_hunter

so far i have this :

HotKeySet("{F10}", "AutoLoot")

Func AutoLoot()

If ProcessExists("{RIGHT down}") Then

Send("z")

EndIf

If ProcessExists("{LEFT down}") Then

Send("z")

EndIf

EndFunc

WEnd

C:\Documents and Settings\Owner\Desktop\loottest.au3(11,1) : ERROR: syntax error

WEnd

^

C:\Documents and Settings\Owner\Desktop\loottest.au3 - 1 error(s), 0 warning(s)

I get an error about the WEnd tho... and im thinking to make these if processexist's into a fuction,then put a hotkey for the function, but im not sure if i can use it to turn on AND off

pretty plz reply with ur thoughts

Edited by alein_hunter

Share this post


Link to post
Share on other sites
theguy0000

almost right, but you've got a "WEnd" with no "while" :whistle:

(BTW, he wantred F9 not F11)

HotKeySet("{F}", "Terminate")
Func Terminate()
Exit
EndFunc

While 1
If ProcessExists("{RIGHT down}") Then
Send("z")
EndIf

If ProcessExists("{LEFT down") Then
Send("z")
EndIf
WEnd

(untested)


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
alein_hunter

hmm...i couldn't get this to work

btw, dont know if this matters but

im playing a game where z=pick up

when im walking (left or right) i want it to press 'z' to pick up. but when im not pressing right or left i want it to stop pressing so i can type/ do watever


Share this post


Link to post
Share on other sites
therks

...

If ProcessExists("{LEFT down") ???

You're looking for a process (you know that list of programs that's running, like explorer.exe, notepad.exe, etc.) for something named "{LEFT down" ???

Uh... not gonna work.

Okay, here's what you need to know.

1) There is no built in AutoIt function that can be used to monitor if a key is held down or not.

2) There is a user defined function called _IsPressed (there's a link to it in my signature) that will help with this.

3) Without using an AutoIt hotkey, I don't believe there's any way to "disable" the function of your left and right keys.

My suggestion, would be to write your script with:

A) F9 toggling the whole program.

:whistle: Left and Right as hotkeys that toggle the Z key being pressed.

Code would be something like this:

HotKeySet('{F9}', '_ProgramToggle')
HotKeySet('{Left}', '_PressZToggle')
HotKeySet('{Right}', '_PressZToggle')

Dim $b_ProgramToggle = 1
Dim $b_ZToggle

While 1
  If $b_ProgramToggle Then
    If $b_ZToggle Then
      Send('z')
    EndIf
  EndIf
  Sleep(10)
WEnd

Func _PressZToggle()
  If $b_ZToggle Then
    $b_ZToggle = 0
  Else
    $b_ZToggle = 1
  EndIf
EndFunc


Func _ProgramToggle()
  If $b_ProgramToggle Then
    $b_ProgramToggle = 0
    HotKeySet('{Left}')
    HotKeySet('{Right}')
  Else
    $b_ProgramToggle = 1
    HotKeySet('{Left}', '_PressZToggle')
    HotKeySet('{Right}', '_PressZToggle')
  EndIf
EndFunc

Upon testing, this seems to do exactly what I was thinking.

*Edit: Upon reading your last post there, I'm not sure if you can do what you want. Having it press Z while you're pressing Left/Right would require you to be pressing 2 keys at once, and I believe the script might choke on that. But take what I've given and have a go at it.

Edited by Saunders

Share this post


Link to post
Share on other sites
theguy0000

oh, missing the include :whistle:

#include <Process.au3>
HotKeySet("{F}", "Terminate")
Func Terminate()
Exit
EndFunc

While 1
If ProcessExists("{RIGHT down}") Then
Send("z")
EndIf

If ProcessExists("{LEFT down") Then
Send("z")
EndIf
WEnd

(untested)

edit: too late, Saunders answered :dance:

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
therks

@theguy

Did you not understand what I said? The Process* functions are for working with PROCESSES. That list of PROGRAMS running in the task manager. Looking your list of running PROCESSES for a PROGRAM called "{RIGHT down}" is most likely going to constantly yield a negative.

Share this post


Link to post
Share on other sites
alein_hunter

wow thx saunders ( thxthe guy for trying)

thx, i was hoping to learn from whoever figured it out and i got what i wanted :whistle:) i thought i was on the right track but you fixed me up thx :dance:

btw, toggling the prog on and off is what i meant, but i confuzed myself when i was typing :dance:

p.s. unicron owns

Edited by alein_hunter

Share this post


Link to post
Share on other sites
theguy0000

@theguy

Did you not understand what I said? The Process* functions are for working with PROCESSES. That list of PROGRAMS running in the task manager. Looking your list of running PROCESSES for a PROGRAM called "{RIGHT down}" is most likely going to constantly yield a negative.

<{POST_SNAPBACK}>

i didnt realize you had replied until just now :dance:

- Matt :whistle:


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
alein_hunter

saunders, is there a way to make it only be on while im holding the arrow?

like this i have to press the arrow, then press it again to stop, i was wanting to press and hold it, and when i let go of it , it stops

Edited by alein_hunter

Share this post


Link to post
Share on other sites
alein_hunter

at school not doing any work and i was dazing off when it came to me in a vision that mabye if i put a hot key for left and right tyo triggle the button z as a hotkey and had it so that it cfdould set the hotkey off aver few fractions of a second that it would only work when the key is pressed down and not just pressing the key and let go and pressing z until you press left or right again? not sure, give comments


Share this post


Link to post
Share on other sites
seandisanti

at school not doing any work and i was dazing off when it came to me in a vision that mabye  if i put a hot key for left and right tyo triggle the button z as a hotkey and had it so that it cfdould set the hotkey off aver few fractions of a second that it would only work when the key is pressed down and not just pressing the key and let go and pressing z until you press left or right again? not sure, give comments

<{POST_SNAPBACK}>

why not just:

HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("+{PAUSE}", "ForTheLoveOfGodPleaseMakeItStopIBegYou")
While 1
    Send("z")
    Sleep(100)
WEnd
Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
    WEnd
EndFunc

Func ForTheLoveOfGodPleaseMakeItStopIBegYou()
Exit
EndFunc

when you press pause key it will pause the Z's, shift pause will exit completely.

you will still be able to use your arrows with the same effect as if you were pressing z while holding down arrows manually. you may need to pause before exiting though, because Shift + pause + z may not do anything...


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
seandisanti

why not just:

HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("+{PAUSE}", "ForTheLoveOfGodPleaseMakeItStopIBegYou")
While 1
    Send("z")
    Sleep(100)
WEnd
Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
    WEnd
EndFunc

Func ForTheLoveOfGodPleaseMakeItStopIBegYou()
Exit
EndFunc

when you press pause key it will pause the Z's, shift pause will exit completely.

you will still be able to use your arrows with the same effect as if you were pressing z while holding down arrows manually.  you may need to pause before exiting though, because Shift + pause + z may not do anything...

<{POST_SNAPBACK}>

here, this is the one that you actually wanted... using the _IsPressed() UDF that's helped all of us so many times...

right now i have it set to set a tooltip to paused or unpaused (because i don't need a bunch of z's on any of my screens) but just remove the paused tooltip, and change the unpaused tooltip to a Send("z") and you should be all set. Also, if you don't already have the IsPressed UDF, get it from Saunders' Sig as he suggested, so that it can be included and this will work correctly.

#include <IsPressed.au3>
HotKeySet("{PAUSE}","ImDone")
Global $Paused
Global $CHECK
While 1
        ToolTip("Unpaused")
$CHECK = 0
if _IsPressed(25)then $CHECK = 1
if _IsPressed(26)then $CHECK = 1
if _IsPressed(27)then $CHECK = 1
if _IsPressed(28)then $CHECK = 1
if $CHECK=0 then TogglePause()
WEnd
Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        ToolTip("Paused")
if _IsPressed(25)then ExitLoop
if _IsPressed(26)then ExitLoop
if _IsPressed(27)then ExitLoop
if _IsPressed(28)then ExitLoop
    WEnd
EndFunc
Func ImDone()
    Exit
EndFunc

***edit***

more of a PS... you probably want to tweak the sleep statement for the first loop, and add a sleep() in the function to cut processor usage. also this watches all 4 arrows, but you can remove the up and down if you don't want them, just by removing the lines with their numbers (get their numbers from the comments in the IsPressed() script)

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
seandisanti

FYI is now apart of the beta UDFS

#Include <Misc.au3>

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

<{POST_SNAPBACK}>

cool, glad to hear it... thanks for the heads up

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
alein_hunter

having to turn it off any other way than pressing and letting go of the arrow keys defeats my purpose of it being efficient and conveinent if you read what its being used for =p thx for help tho, i think i know how to do it now i'll just have to fool around with ti for a bit

not sure if this is allowed, but imma post the prog i want this to be like, yes this prog is already made, but i thought it wouldn't be this difficulte and it would just be good practice because i wanted to do some other stuff similar to this blah blah. anyways here

http://virusscan.jotti.org/ to scan w/e with like 10+ antivirus

Edited by Jon

Share this post


Link to post
Share on other sites
seandisanti

having to turn it off any other way than pressing and letting go of the arrow keys defeats my purpose of it being efficient and conveinent if you read what its being used for =p thx for help tho, i think i know how to do it now i'll just have to fool around with ti for a bit

not sure if this is allowed, but imma post the prog i want this to be like, yes this prog is already made, but i thought it wouldn't be this difficulte and it would just be good practice because i wanted to do some other stuff similar to this blah blah. anyways here

http://virusscan.jotti.org/ to scan w/e with like 10+ antivirus

<{POST_SNAPBACK}>

did you not see the code i posted? it does exactly what you want it to....

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
alein_hunter

oh, i guess i mis read what you put, sry

i'll try it out

edit: yessss your thing works and its simple enough for me to figure out how to do myself also thx thx thx :whistle:

Edited by alein_hunter

Share this post


Link to post
Share on other sites
seandisanti

oh, i guess i mis read what you put, sry

i'll try it out

edit: yessss your thing works and its simple enough for me to figure out how to do myself also thx thx thx :whistle:

<{POST_SNAPBACK}>

no problem man, glad to help

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
alein_hunter

hmm... when i run this a box saying "paused" or "1" follows my mouse around, any idea what this is and how to make it not do that?


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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.