Yuu

Script have been "not responding" several time.

21 posts in this topic

Firstly I'm so sorry for my very bad English.

This is my script.

Local $time, $test = "test.bmp"
Func _imagesearch($picname)
    Local $aRet, $picresult, $result[2]
    $aRet = DllCall("ImageSearch.dll", "ptr", "ImageSearchInactiveWindow", "str", "BlueStacks App Player", "str", $picname, "boolean", False, "double", 0.0)
    $picresult = DllStructCreate("int array[4]", $aRet[0])
    $result[0] = DllStructGetData($picresult, 1, 1)
    $result[1] = DllStructGetData($picresult, 1, 2)
    If $result[0] = 0 And $result[1] = 0 Then Return 0
    Return $result
EndFunc   ;==>_imagesearch


While 1
    $time = TimerInit()
    Sleep(3000)
    $picresult = _imagesearch($test)
    If $picresult <> 0 Then ExitLoop
    If TimerDiff($time) = 15000 Then ExitLoop
WEnd

The problem is got is if I put _imagesearch() function out of the loop, it worked very smooth. But if I put it into the loop, it made my script been "not responding" for most of the time. (8/10 times I run).
So is there anything I can do to improve it ? Please give me some advice.
Tks guys so much for reading this. Love u.

Share this post


Link to post
Share on other sites



Post the image and the name off app you want to automate. Without i can only say: "Screen output is different, this  is normal in a gameplay".

Share this post


Link to post
Share on other sites

Oh there is the image, the name of app I posted on top "BlueStacks App Player"
I'm try to get more mobile phone number

Ffj3HKV.png

 

btw why i can't upload bmp picture @@!

Share this post


Link to post
Share on other sites

I don't ask for the bluestack app, i asked for the app bluestack app is playing.

Share this post


Link to post
Share on other sites

 

5 minutes ago, AutoBert said:

I don't ask for the bluestack app, i asked for the app bluestack app is playing.

oh i'm sorry, textplus man :D

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

And this app dosn't change display ouptput after have signed up once successfully? I think in both cases:

  1. sign up successfully
  2. sign up failed

display output changes. So it's noncence to do it in a loop. 2. try to find image must fail, it 1. case it isn't neccecary to do anything as you are signed up. In 2. case you have to search for another image.

Edited by AutoBert

Share this post


Link to post
Share on other sites
8 minutes ago, AutoBert said:

And this app dosn't change display ouptput after have signed up once successfully? I think in both cases:

  1. sign up successfully
  2. sign up failed

display output changes. So it's noncence to do it in a loop.

3

I put it in a loop to check asap if it's showing a pic or not so i can do the next step.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

10 minutes ago, Yuu said:

I put it in a loop to check asap if it's showing a pic or not so i can do the next step.

24 minutes ago, AutoBert said:

So it's noncence to do it in a loop. 2. try to find image must fail, it 1. case it isn't neccecary to do anything as you are signed up. In 2. case you have to search for another image.

and i think you haven't posted the whole script or is the "not responding"-message from bluestack?

Edited by AutoBert

Share this post


Link to post
Share on other sites

#10 ·  Posted

It's the sleep which freezes your GUI and you didn't post whole script.

Share this post


Link to post
Share on other sites

#11 ·  Posted

1 hour ago, AutoBert said:

It's the sleep which freezes your GUI and you didn't post whole script.

Of course, I didn't post whole my project, what wrong with it ?

I tested, not because of sleep function.

Anyway, tks you so much.

Share this post


Link to post
Share on other sites

#12 ·  Posted

2 hours ago, Yuu said:

Of course, I didn't post whole my project, what wrong with it ?

What's wrong with it is you're being purposely evasive when people are asking questions in an effort to help you. That leads to people assuming you're doing something you know if against the rules. Even if you're not, by posting bits and pieces you're asking us to first guess at what you are doing and then troubleshoot it for you. Not the way to garner a lot of help.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#13 ·  Posted

33 minutes ago, JLogan3o13 said:

What's wrong with it is you're being purposely evasive when people are asking questions in an effort to help you. That leads to people assuming you're doing something you know if against the rules. Even if you're not, by posting bits and pieces you're asking us to first guess at what you are doing and then troubleshoot it for you. Not the way to garner a lot of help.

I explained every question he asked me. I know he just wants to help and i'm very appreciated for that.

I told that i tested and that part which i posted cause my problem. Moreover, the other part isn't really relative to it.

And yes i don't want to post all of my projects, i have learned how to code for 2 weeks and this is my first program. I want to keep it for myself until it is perfect.

The point which i want to ask just is "Put dll imagesearch into loop cause loop" and if that question is against our forum rule, i'm so sorry and you can close it.

Thanks for your reply.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

17 hours ago, Yuu said:

I told that i tested and that part which i posted cause my problem. Moreover, the other part isn't really relative to it.

Wrong, your posted snipet never could produce a 'not responding' errormessage. So nobody can solve your real issue without having the script produces the message. It's the sleep which causes issue in the other part (GUI). Without GUI this message never appears. And as i said:

23 hours ago, AutoBert said:

So it's noncence to do it in a loop. 2. try to find image must fail, if 1. case it isn't neccecary to do anything as you are signed up. In 2. case you have to search for another image.

doing nonsence in this small snipet, i think there is much more nonsence in the other part of script. And automating a game is nonsence, if you don't like to play why should your pc play for you?

Edited by AutoBert

Share this post


Link to post
Share on other sites

#15 ·  Posted

5 hours ago, AutoBert said:

Wrong, your posted snipet never could produce a 'not responding' errormessage. So nobody can solve your real issue without having the script produces the message. It's the sleep which causes issue in the other part (GUI). Without GUI this message never appears. And as i said:

doing nonsence in this small snipet, i think there is much more nonsence in the other part of script. And automating a game is nonsence, if you don't like to play why should your pc play for you?

i don't want to post my project here, but i can pm it for you so you can check my word.

Share this post


Link to post
Share on other sites

#16 ·  Posted

Posting here will give better results and you can also post a runable reproducer which show the issue.

Share this post


Link to post
Share on other sites

#17 ·  Posted

@Yuu If your project is work related or you otherwise feel more comfortable PMing than posting, please do so. But understand the small amount of code you have posted at present is not enough to assist you.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Isn't the problem, or maybe part of the problem, that you have coded two tests which might exit from your While loop?  One depends on the result of the image search and the other requires a time difference to be exactly 15000 mS.  I should think the second condition is never true.  Did you ever expect it to be?

Share this post


Link to post
Share on other sites

The Problem is (so i think) GuiGetMsg and the sleep. While sleeping the GUI is frozen.

Share this post


Link to post
Share on other sites

There's no GuiGetMsg in the supplied code.  I wonder if, despite what the OP says, if there's a problem in the DLL call?  Whether it never returns to _imagesearch, or it returns immediately, so in essence the While loop is an infinite one?

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