Dequalityy Posted August 1, 2016 Share Posted August 1, 2016 Hello this is my very first topic on this forum just created my account because i couldnt find my answer no where (probably overseen it!) My problem is this. In the While (1) i have the pixelsearch, yea hurray it works etc! BUT , the Call("StayOnline") are supposed to sleep for somewhere between 720000MS To 1080000MS and that seems to be working great BUT! while that sleep timer is ongoing it should keep pixel searching constant.. i can't seem to find anything about it =( any help appreciatet! Thx in advance! While (1) $blah = PixelSearch(686, 118, 1102, 487, 0xFFD166, 0) ; Search for OK button. If NOT(@error) Then ; If okay button pop's up this will execute a click on the OK button. MouseMove($blah[0]+5, $blah[1]+5, 0) Sleep(2000) MouseClick("left", $blah[0]+5, $blah[1]+5, 2, 0) Sleep(1000) EndIf If (@error) Then Call("StayOnline") EndIf WEnd Func StayOnline() ; Keeps you online. Send("{UP}", 0) Sleep(Random(50, 250, 0) Send("{DOWN}", 0) Sleep(Random(720000, 1080000, 0)) EndFunc Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted August 1, 2016 Share Posted August 1, 2016 Sleep is a blocking function, it will do just what it says. Put the entire script to sleep until the wait is over. For what you want to do, you may look to use timers instead or rebuild the script to work differently such as AdLibRegister() for your StayOnline portion of the script. Link to comment Share on other sites More sharing options...
Dequalityy Posted August 1, 2016 Author Share Posted August 1, 2016 ViciousXUSMC 15 minutes ago, ViciousXUSMC said: Sleep is a blocking function, it will do just what it says. Put the entire script to sleep until the wait is over. For what you want to do, you may look to use timers instead or rebuild the script to work differently such as AdLibRegister() for your StayOnline portion of the script. I'm just getting started with AutoIT, how would i do that ? can u make me a example? it still needs to be a random amount of time between 720000 MS to 1080000 MS Dequality. Link to comment Share on other sites More sharing options...
Dequalityy Posted August 1, 2016 Author Share Posted August 1, 2016 4 minutes ago, Dequalityy said: ViciousXUSMC I'm just getting started with AutoIT, how would i do that ? can u make me a example? it still needs to be a random amount of time between 720000 MS to 1080000 MS Dequality. Might have it lol.. Can i really do it just like this? Dequalityy. Func StayOnline() ; Keeps you online. Send("{UP}", 0) Sleep(Random(50, 250, 0) Send("{DOWN}", 0) AdlibRegister(Random(720000, 1080000, 0)) EndFunc Link to comment Share on other sites More sharing options...
Dequalityy Posted August 1, 2016 Author Share Posted August 1, 2016 Okay, well that didnt work it spammed it like if there wasnt a sleep/timer :/ Link to comment Share on other sites More sharing options...
kcvinu Posted August 1, 2016 Share Posted August 1, 2016 Why go for mouse move and click ? Why don't you use ControlClick ?. And don't call the StayOnline function in a separate if statement. Use an else statement in first if statement. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
Dequalityy Posted August 1, 2016 Author Share Posted August 1, 2016 Just now, kcvinu said: Why go for mouse move and click ? Why don't you use ControlClick ?. And don't call the StayOnline function in a separate if statement. Use an else statement in first if statement. As mentioned kcvinu i just started using AutoIT im not very familiar with coding at ALL. So, would it be like this instead? While (1) $blah = PixelSearch(686, 118, 1102, 487, 0xFFD166, 0) ; Search for OK button. If NOT(@error) Then ; If okay button pop's up this will execute a click on the OK button. MouseMove($blah[0]+5, $blah[1]+5, 0) Sleep(2000) MouseClick("left", $blah[0]+5, $blah[1]+5, 2, 0) Sleep(1000) Else If (@error) Then Call("StayOnline") EndIf WEnd Or did i misunderstand ? =) & how exactly does ControlClick work? Dequality. Link to comment Share on other sites More sharing options...
Dequalityy Posted August 1, 2016 Author Share Posted August 1, 2016 kcinvu, it's somewhat still spamming up & down even with (AdlibRegister(Random, 720000, 1080000, 0)) :| Link to comment Share on other sites More sharing options...
AutoBert Posted August 1, 2016 Share Posted August 1, 2016 What's the online app you want to automate? Mostly there are better way's than mouseclick etc. Try IE.au3 or one of the other browser udf's Link to comment Share on other sites More sharing options...
kcvinu Posted August 1, 2016 Share Posted August 1, 2016 If you use control click function, then you don't need to tell the mouse position. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
Dequalityy Posted August 1, 2016 Author Share Posted August 1, 2016 1 minute ago, kcvinu said: If you use control click function, then you don't need to tell the mouse position. How does it know where to click then? <.< The Pixelsearch is a button it needs to click? =) And could anyone answer my question on why it doesnt "pause" / times out for the time i set it to ? it's annoying Dequality. Link to comment Share on other sites More sharing options...
Dequalityy Posted August 1, 2016 Author Share Posted August 1, 2016 Just now, Dequalityy said: How does it know where to click then? <.< The Pixelsearch is a button it needs to click? =) And could anyone answer my question on why it doesnt "pause" / times out for the time i set it to ? it's annoying Dequality. Oh and the button i want it to click isnt always showing up at the same position, thats why i used this function Dequalityy. Link to comment Share on other sites More sharing options...
Dequalityy Posted August 1, 2016 Author Share Posted August 1, 2016 Okay, i figured out it needs to be used to call the function i want it used with i see, BUT the timing should still be random could i do it this way AdlibRegister(StayOnline(Random(720000, 1080000, 0,))) ? or cant u do it that way? ^^ Link to comment Share on other sites More sharing options...
kcvinu Posted August 1, 2016 Share Posted August 1, 2016 Have you read the help file for ControlClick function ? Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
Dequalityy Posted August 1, 2016 Author Share Posted August 1, 2016 kcivnu yea, just did but i doubt it got any name, well the window itself for the client got a name true, but don't think the window inside (the one that pops up with the OK button) doesnt have a name? Link to comment Share on other sites More sharing options...
Dequalityy Posted August 1, 2016 Author Share Posted August 1, 2016 Anyways, the way i make it click isnt the problem honestly, the problem is i can't seem to figure out how to make AdlibRegister use a random timer? is it even possible if not is there another function that works just like adlibregister but with a random timer between 2 numbers? =) The numbers i need is pretty high as seen in the topic itself (720000 -> 1080000) it should a number randomly between those .. -Dequality. Link to comment Share on other sites More sharing options...
Dequalityy Posted August 1, 2016 Author Share Posted August 1, 2016 Really no option like AdlibRegister? just where u can put in a min & max (randomized) can't figure out a way to get this working grrr.. Dequalityy. Link to comment Share on other sites More sharing options...
kcvinu Posted August 1, 2016 Share Posted August 1, 2016 (edited) Random will return a floating point number if you give 0 as flag. So give 1 as flag. You will get a complete number. And mind it - AdlibRegister will work regardless sleep Edited August 1, 2016 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
SadBunny Posted August 1, 2016 Share Posted August 1, 2016 AdlibRegister("beeper", Random(0, 2000, 1)) While True Sleep(1000) WEnd Func beeper() AdlibUnRegister("beeper") Beep(1500, 200) AdlibRegister("beeper", Random(0, 2000, 1)) EndFunc ;==>beeper Dequalityy 1 Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
Dequalityy Posted August 1, 2016 Author Share Posted August 1, 2016 13 minutes ago, SadBunny said: AdlibRegister("beeper", Random(0, 2000, 1)) While True Sleep(1000) WEnd Func beeper() AdlibUnRegister("beeper") Beep(1500, 200) AdlibRegister("beeper", Random(0, 2000, 1)) EndFunc ;==>beeper Bunny thank you very much for an example, now my next problem is it doesnt sent the message it should can you tell me if i'm missing something? expandcollapse popupWinActivate("Netstationen Client – Google Chrome") HotKeySet("{F4}", "ExitProg") MouseClick("left", 1078, 120, 1, 0) While (1) $blah = PixelSearch(686, 118, 1102, 487, 0xFFD166, 0) ; Search for OK button. If NOT(@error) Then ; If okay button pop's up this will execute a click on the OK button. MouseMove($blah[0]+5, $blah[1]+5, 0) Sleep(2000) MouseClick("left", $blah[0]+5, $blah[1]+5, 2, 0) Sleep(1000) ElseIf (@error) Then AdlibRegister("StayOnline", Random(720000, 1080000, 1)) EndIf WEnd Func StayOnline() ; Keeps you online. AdlibRegister("StayOnline") Send("/goto 0", 1) Sleep(3000) Send("{ENTER}", 0) AdlibRegister("StayOnline", Random(2000, 2500, 1)) EndFunc Func ExitProg() ; Exits Auto Exit EndFunc ;==>ExitProg 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