Raizeno Posted October 6, 2014 Posted October 6, 2014 Hello everyone ! So i am trying to do a simple script composed of a few mouse clicks and mouse drag. The script is supposed to help me automize some apps on the android emulator Bluestacks. The script is working fine in windows background but once the Bluestacks window is active the script stops , if i Alt+Tab and go back into Windows it continues to run as normal can someone tell me why this is happening ? I know for sure in the past i had some scripts working in this program with no problem at all but now after i reinstalled Windows and Bluestacks i can't seem to make it work again. I had an older version of Bluestacks in the past , maybe the new version doesn't allow scripts, if so can i do something to make it work?
JohnOne Posted October 6, 2014 Posted October 6, 2014 Your mouse actions work on the bluestacks window in the background you say? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
13lack13lade Posted October 7, 2014 Posted October 7, 2014 (edited) I think he means the script is running it just won't perform the script actions in the targeted window 'Bluestacks' What exactly are you trying to automate? my understanding that Bluestacks is an app player, is this a game application? Edited October 7, 2014 by 13lack13lade
Raizeno Posted October 7, 2014 Author Posted October 7, 2014 (edited) JhonOne, while BlueStacks window is active the script won't run at all even if the mouse event is outside the target window . but if i alt+tab and go to desktop for example the script starts working , only to stop again if i alt+tab into bluestacks again. But this is only with the new version is it posible that they have some sort of script protection that stops mouse events coming from another application ? For example i made another script similar to the autoITinfo tool that shows me the mouse coords and color and that work fine even if BlueStacks is active at the moment . So my question is : If the aplication is protected somehow against mouse events from outside applications is it possible to bypass that ? BlackBlade: yes since is an OS emulator it runs games besides many other applications but my question isn't game related . It's as if i'm asking you to help me run a script in Windows but you won't help me because Windows runs games also . Edited October 7, 2014 by Raizeno
JohnOne Posted October 7, 2014 Posted October 7, 2014 Yes, it's possible, and probable going by what you say. But it's a bit shitty if mouse automation is totally blocked, they should only block it if the mouse actions are within the bluestacks window. oops I see that mouse is only blocked when bluestacks window is active. That implies it does not want to be automated. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted October 7, 2014 Posted October 7, 2014 Also, is bluestacks not a virtual machine of sorts, might have something to do with that. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Raizeno Posted October 7, 2014 Author Posted October 7, 2014 yes some sort of virtual machine but you have no control over it. i know it can be rooted with some programs just like you would root an android device but that won't help me in any way .
Raizeno Posted October 7, 2014 Author Posted October 7, 2014 (edited) I also run an older version of bluestacks and scripts run on it but i have another problem with that one . after i finished the script last night i tested the script for about an hour and it worked fine but today it won't run properly it will skip steps randomly on each run . any ideea why this is happening ? It's like it jumps over some lines of code and never in the same place . Edited October 7, 2014 by Raizeno
Raizeno Posted October 7, 2014 Author Posted October 7, 2014 nevermind that i figured out what the problem was this old version of blue stacks has massive freezes that's why it jumps steps the script does the steps but blue stacks is not responding
JohnOne Posted October 7, 2014 Posted October 7, 2014 It seems clear that it is simply blocking automation. I think there are other Android emulators out there, for example one comes with Android Studio, you can determine which android device it emulates. Might be worth trying another, because it's unlikely you will get help overcoming an intentional automation block. Another thing you can try is contacting the bluestack developers and asking if it's a bug. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Raizeno Posted October 7, 2014 Author Posted October 7, 2014 (edited) well the best android emulator at the moment is Andy but i can't run it i have too low spec computer for it . Andy lets u have a full android experience plus a very good VM and after Andy comes bluestacks , what bluestacks lacks in performance and versatility gains in ease of use and simplicity . That's why i go with bluestacks because it's a far more easy task to automize it . Anyway i have another question regarding my script i have already runing on my old version of bluestacks So because this version isn't that good i get alot of lag spikes and then an mesage pops up telling me "Waiting for server" that brakes my script . my question is : can i make like a function that runs in paralel with my main script and constantly checks for that mesage to popup and pause my main script while it's waiting for server ? Edited October 7, 2014 by Raizeno
JohnOne Posted October 7, 2014 Posted October 7, 2014 Don't see why you can't check for it in your main script loop. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Raizeno Posted October 7, 2014 Author Posted October 7, 2014 i can check for it but that will only happen once per loop i want it to be checked at all time in a constant manner and pause my main loop until it goes away.
JohnOne Posted October 7, 2014 Posted October 7, 2014 Unfortunately another script would be the same, you'd still only be able to check it once per loop. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Raizeno Posted October 7, 2014 Author Posted October 7, 2014 can't i make a function run in paralel with the main loop something like this for example Func waiting() PixelSearch(0,430,125,550,0xfefcce) If not @error then ""something to pause main script here"" sleep(100) waiting() Else ""something to resume main script here" EndIf EndFunc but i need it to run in paralel with my main script. Something like remembering the line my main script was when window appears and then exiting loop and resume from that line when it's gone .
JohnOne Posted October 7, 2014 Posted October 7, 2014 Try looking at AdlibRegister. It will run a function every n milliseconds while your script is running. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Raizeno Posted October 7, 2014 Author Posted October 7, 2014 (edited) ok i've tried using the AdlibRegister in a different manner rather than stoping te script i'm using the adlibRegister to restart the script and bring it to my startup position once again and start over . but it only works the first time it won't start again after that AdlibRegister("RESET",60000) Func RESET() $c=PixelSearch(800,650,860,700,0x8a0506,3) if not @error Then MouseClick("left",$c[0],$c[1]) sleep(5000) MAIN() Else MouseClick("left",45,890) Sleep(2000) MouseClick("left",625,560) sleep(2000) MouseClick("left",840,700) sleep(5000) MAIN() EndIf EndFunc i think the problem might be that the RESET() function isn't ending since MAIN() function is a loop so now i'm stuck with a loop inside a loop how can i acces my MAIN() from AdlibRegister without ending up with a loop inside a loop ? Edited October 8, 2014 by Raizeno
JohnOne Posted October 8, 2014 Posted October 8, 2014 There is no loop in your reset function, you do know it's checking every 60 seconds? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted October 8, 2014 Posted October 8, 2014 (edited) See if you understand what's going on here and adapt. AdlibRegister("waiting", 50000) While 3 ; your main stuff WEnd Func waiting() PixelSearch(0, 430, 125, 550, 0xfefcce) If Not @error Then AdlibUnRegister("waiting") ; un register Beep(700, 200) ; wait Do Sleep(100) PixelSearch(0, 430, 125, 550, 0xfefcce) Until @error Beep(400, 200); ok AdlibRegister("waiting", 50000); re register EndIf EndFunc ;==>waiting Edited October 8, 2014 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Raizeno Posted October 8, 2014 Author Posted October 8, 2014 (edited) No i meant adlibregister is a loop by itself and yes it's working every 60 sec but not with my reset function because my reset function calls out my main() and that is a loop and the first adlibregister never ends. That's why it didn't run more than once i will put your script in practice when i get back home from work and i'll let you know Edited October 8, 2014 by Raizeno
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