Sign in to follow this  
Followers 0
Raizeno

Mouse events don't work inside the target application.

26 posts in this topic

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?

 

Share this post


Link to post
Share on other sites



#3 ·  Posted (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 by 13lack13lade

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by Raizeno

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 .

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 by Raizeno

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#11 ·  Posted (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 by Raizeno

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 .  

Share this post


Link to post
Share on other sites

#17 ·  Posted (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 by Raizeno

Share this post


Link to post
Share on other sites

#19 ·  Posted (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 by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#20 ·  Posted (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 by Raizeno

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  
Followers 0