Jump to content

Script have been "not responding" several time.


Recommended Posts

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.

Link to comment
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 @@!

Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Moderators
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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Moderators

@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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...