AchterlijkeVleugel Posted February 18, 2015 Share Posted February 18, 2015 (edited) sleep(random(350,500,1)) send ("{s down}") sleep(random(350,500,1)) send ("{s down}") sleep(random(350,500,1)) send ("{s down}") sleep(random(350,500,1)) send ("{s down}") sleep(random(350,500,1)) send ("{s down}") sleep(random(350,500,1)) send ("{s down}") sleep(random(350,500,1)) send ("{s down}") sleep(random(350,500,1)) send ("{s down}") sleep(random(350,500,1)) send ("{s down}") So im trying to get this script done, but it only sends s one time. Also how do i terminate a script with a hotkey? Edited February 18, 2015 by AchterlijkeVleugel Link to comment Share on other sites More sharing options...
jdelaney Posted February 18, 2015 Share Posted February 18, 2015 you can't press the s, when it's already 'down'. Either just send "s", or send it back 'up'. AchterlijkeVleugel 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
AchterlijkeVleugel Posted February 18, 2015 Author Share Posted February 18, 2015 sleep(random(350,500,1)) send ("{s down}") Sleep(50) send ("{s up}") sleep(random(350,500,1)) send ("{s down}") Sleep(50) send ("{s up}") sleep(random(350,500,1)) send ("{s down}") Sleep(50) send ("{s up}") sleep(random(350,500,1)) Now i got this, and it only repeats 2 send s rotations(s up and down) Link to comment Share on other sites More sharing options...
Developers Jos Posted February 18, 2015 Developers Share Posted February 18, 2015 No it does type 3 times an s. 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 More sharing options...
jdelaney Posted February 18, 2015 Share Posted February 18, 2015 (edited) Who knows what the app accepting the sends is doing...send is one of the most unreliable functions you can use, but your script is certainly sending s 3 times to some application, or whatever. Edited February 18, 2015 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
AchterlijkeVleugel Posted February 18, 2015 Author Share Posted February 18, 2015 Is there an alternative for send then? Link to comment Share on other sites More sharing options...
jdelaney Posted February 18, 2015 Share Posted February 18, 2015 ControlSetText IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Developers Jos Posted February 18, 2015 Developers Share Posted February 18, 2015 Is there an alternative for send then? Sure, so what is it you are trying to automate? 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 More sharing options...
AchterlijkeVleugel Posted February 18, 2015 Author Share Posted February 18, 2015 (edited) Sure, so what is it you are trying to automate? Honestly im just trying to understand the au3 language better, im sending to a word document atm. But i would also like to navigate in map folders, with arrow keys for example. Edited February 18, 2015 by AchterlijkeVleugel Link to comment Share on other sites More sharing options...
Developers Jos Posted February 18, 2015 Developers Share Posted February 18, 2015 Honestly im just trying to understand the au3 language better, im sending to a word document atm. Sure... jchd and Melba23 2 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 More sharing options...
AchterlijkeVleugel Posted February 18, 2015 Author Share Posted February 18, 2015 Sure... ? Link to comment Share on other sites More sharing options...
jdelaney Posted February 18, 2015 Share Posted February 18, 2015 (edited) Note: this won't work on game automation, so don't even waste your time: Run("notepad.exe") $w = WinWait("[CLASS:Notepad]","",10) $c = ControlGetHandle($w,"",15) ControlSetText($w,"",$c,ControlGetText($w,"",$c) & "s") ControlSetText($w,"",$c,ControlGetText($w,"",$c) & "s") ControlSetText($w,"",$c,ControlGetText($w,"",$c) & "s") Edited February 18, 2015 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
AchterlijkeVleugel Posted February 19, 2015 Author Share Posted February 19, 2015 Note: this won't work on game automation, so don't even waste your time: Run("notepad.exe") $w = WinWait("[CLASS:Notepad]","",10) $c = ControlGetHandle($w,"",15) ControlSetText($w,"",$c,ControlGetText($w,"",$c) & "s") ControlSetText($w,"",$c,ControlGetText($w,"",$c) & "s") ControlSetText($w,"",$c,ControlGetText($w,"",$c) & "s") Oh you guys think im trying to bot, haha now Jos' comment makes sense to me. Well im really not trying to bot a game. What is the difference between winwait/winactive/winwaitactive Also doesnt the repeating of winwait cause the script to be slower? Why didnt u make a variable for controlgettext? Link to comment Share on other sites More sharing options...
SadBunny Posted February 19, 2015 Share Posted February 19, 2015 (edited) Oh you guys think im trying to bot, haha now Jos' comment makes sense to me. Well im really not trying to bot a game. What is the difference between winwait/winactive/winwaitactive Also doesnt the repeating of winwait cause the script to be slower? Why didnt u make a variable for controlgettext? Answering in order: 1) Well, given your other questions on the forum (waiting for a pixel to disappear, stressing on repeating the "s" key, etc.), I kind of understand the apprehension 2) Difference between winwait and winwaitactive is that the former waits till a window exists, and the latter waits till a window is active. (You can read that in the first sentences in the respective help files.) WinActive is a function that checks whether a window is active (and WinExists checks if a window exists). So you could say winwait is to winexists as winwaitactive is to winactive. 3) So where is that code repeating winwait? 4) Laziness leading to copypaste, I guess, but I'll leave that to jdelaney Edited February 19, 2015 by SadBunny Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted February 19, 2015 Share Posted February 19, 2015 Hi I would simply use send ("{s}") (for the first question) and see how that works out I personally had some problem with ControlSetText, more so then with Send. ControlSend is a third option and ControlCommand with "EditPaste" option is yet another. I dont yet have the experience to say which is better and where, I would leave that to, well anyone else in this thread to tell I personaly usually just go through the possibilities, and while I work on it, it turns out which one is the most reliable in said envierment. PS.: If he wants to automate a game or something, and he is doing it since 2013 october, I say help him with it, just because his willpower to stick with it should be rewarded Link to comment Share on other sites More sharing options...
AchterlijkeVleugel Posted February 19, 2015 Author Share Posted February 19, 2015 Answering in order: 1) Well, given your other questions on the forum (waiting for a pixel to disappear, stressing on repeating the "s" key, etc.), I kind of understand the apprehension 3) So where is that code repeating winwait? Lol, if u look at it that way i understand it too. Well the code has 3 excuting lines right? all of them got the variable for winwait in them. PS.: If he wants to automate a game or something, and he is doing it since 2013 october, I say help him with it, just because his willpower to stick with it should be rewarded Lmfao Link to comment Share on other sites More sharing options...
SadBunny Posted February 19, 2015 Share Posted February 19, 2015 (edited) Well the code has 3 excuting lines right? all of them got the variable for winwait in them. Ah, that's what you mean. No, that's not how it works. Referring to the variable does not re-execute the WinWait. The WinWait is executed 1 time and 1 time only, in that second line. The script halts there until the window in question exists, meaning potentially forever if the window never comes to life. The only other way that function can stop is if the timeout expires, but that's optional, so by default the function will sit there waiting forever until the window exists. Now then, when the WinWait function is done, it returns a value (see the helpfile: in case of success, it's the handle to the window, the only other option is that the timeout expired and then it returns 0). That result value, returned from the function, is then stored in that variable. So when you refer to the variable, you're not re-executing the WinWait, you're merely looking up the result value ("remembered" in that variable) of that earlier execution. Edited February 19, 2015 by SadBunny Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
AchterlijkeVleugel Posted February 19, 2015 Author Share Posted February 19, 2015 (edited) Okay so i got these hotkeys atm HotKeySet("z", "Main") HotKeySet("PAUSE", "TogglePause") HotKeySet("ESC", "Terminate") But only z works, Main is the function for the script. But only z works, Main is the function for the script. Nothing happens when i press pause or esc Edited February 19, 2015 by AchterlijkeVleugel Link to comment Share on other sites More sharing options...
bogQ Posted February 19, 2015 Share Posted February 19, 2015 (edited) its HotKeySet("{ESC}", "Terminate") if its not with {} = youl need to press E on keyboard (3 button combination dont know it itl work) for second question just add if your looking for a loop While 1 Sleep(10) Wend as how to pause i'm pretty sure autoit help file have it nicely explained on HotKeySet example together with {} so open that help file Edited February 19, 2015 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
AchterlijkeVleugel Posted February 19, 2015 Author Share Posted February 19, 2015 It still doesnt work, does the position of the hotkeyset matter? Also i got the while loop in the function, is that bad? 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