alein_hunter Posted September 6, 2005 Share Posted September 6, 2005 (edited) 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 September 6, 2005 by alein_hunter Link to comment Share on other sites More sharing options...
alein_hunter Posted September 6, 2005 Author Share Posted September 6, 2005 (edited) so far i have this :HotKeySet("{F10}", "AutoLoot")Func AutoLoot()If ProcessExists("{RIGHT down}") Then Send("z")EndIfIf ProcessExists("{LEFT down}") Then Send("z")EndIfEndFuncWEndC:\Documents and Settings\Owner\Desktop\loottest.au3(11,1) : ERROR: syntax errorWEnd^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 offpretty plz reply with ur thoughts Edited September 6, 2005 by alein_hunter Link to comment Share on other sites More sharing options...
theguy0000 Posted September 6, 2005 Share Posted September 6, 2005 almost right, but you've got a "WEnd" with no "while" (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 Link to comment Share on other sites More sharing options...
alein_hunter Posted September 6, 2005 Author Share Posted September 6, 2005 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 Link to comment Share on other sites More sharing options...
therks Posted September 6, 2005 Share Posted September 6, 2005 (edited) ... 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. 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 September 6, 2005 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
theguy0000 Posted September 6, 2005 Share Posted September 6, 2005 (edited) oh, missing the include #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 Edited September 6, 2005 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
therks Posted September 6, 2005 Share Posted September 6, 2005 @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. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
alein_hunter Posted September 6, 2005 Author Share Posted September 6, 2005 (edited) wow thx saunders ( thxthe guy for trying) thx, i was hoping to learn from whoever figured it out and i got what i wanted ) i thought i was on the right track but you fixed me up thx btw, toggling the prog on and off is what i meant, but i confuzed myself when i was typing p.s. unicron owns Edited September 6, 2005 by alein_hunter Link to comment Share on other sites More sharing options...
theguy0000 Posted September 6, 2005 Share Posted September 6, 2005 @theguyDid 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 - Matt The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
alein_hunter Posted September 6, 2005 Author Share Posted September 6, 2005 (edited) 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 September 6, 2005 by alein_hunter Link to comment Share on other sites More sharing options...
alein_hunter Posted September 6, 2005 Author Share Posted September 6, 2005 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 Link to comment Share on other sites More sharing options...
seandisanti Posted September 6, 2005 Share Posted September 6, 2005 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 EndFuncwhen 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... Link to comment Share on other sites More sharing options...
seandisanti Posted September 6, 2005 Share Posted September 6, 2005 (edited) 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 EndFuncwhen 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 September 6, 2005 by cameronsdad Link to comment Share on other sites More sharing options...
GaryFrost Posted September 6, 2005 Share Posted September 6, 2005 FYI is now apart of the beta UDFS #Include <Misc.au3> _IsPressed($s_hexKey[, $v_dll = 'user32.dll']) SciTE for AutoItDirections for Submitting Standard UDFs  Don't argue with an idiot; people watching may not be able to tell the difference.  Link to comment Share on other sites More sharing options...
seandisanti Posted September 6, 2005 Share Posted September 6, 2005 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 Link to comment Share on other sites More sharing options...
alein_hunter Posted September 7, 2005 Author Share Posted September 7, 2005 (edited) 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 bitnot 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 herehttp://virusscan.jotti.org/ to scan w/e with like 10+ antivirus Edited May 20, 2006 by Jon Link to comment Share on other sites More sharing options...
seandisanti Posted September 7, 2005 Share Posted September 7, 2005 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 bitnot 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 herehttp://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.... Link to comment Share on other sites More sharing options...
alein_hunter Posted September 7, 2005 Author Share Posted September 7, 2005 (edited) 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 Edited September 7, 2005 by alein_hunter Link to comment Share on other sites More sharing options...
seandisanti Posted September 7, 2005 Share Posted September 7, 2005 oh, i guess i mis read what you put, sryi'll try it outedit: yessss your thing works and its simple enough for me to figure out how to do myself also thx thx thx <{POST_SNAPBACK}>no problem man, glad to help Link to comment Share on other sites More sharing options...
alein_hunter Posted September 7, 2005 Author Share Posted September 7, 2005 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? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now