Yuu Posted May 7, 2016 Share Posted May 7, 2016 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 More sharing options...
AutoBert Posted May 7, 2016 Share Posted May 7, 2016 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". Link to comment Share on other sites More sharing options...
Yuu Posted May 7, 2016 Author Share Posted May 7, 2016 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 btw why i can't upload bmp picture @@! Link to comment Share on other sites More sharing options...
AutoBert Posted May 7, 2016 Share Posted May 7, 2016 I don't ask for the bluestack app, i asked for the app bluestack app is playing. Link to comment Share on other sites More sharing options...
Yuu Posted May 7, 2016 Author Share Posted May 7, 2016 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 Link to comment Share on other sites More sharing options...
AutoBert Posted May 7, 2016 Share Posted May 7, 2016 (edited) And this app dosn't change display ouptput after have signed up once successfully? I think in both cases: sign up successfully 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 May 7, 2016 by AutoBert Link to comment Share on other sites More sharing options...
Yuu Posted May 7, 2016 Author Share Posted May 7, 2016 8 minutes ago, AutoBert said: And this app dosn't change display ouptput after have signed up once successfully? I think in both cases: sign up successfully 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 More sharing options...
AutoBert Posted May 7, 2016 Share Posted May 7, 2016 (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 May 7, 2016 by AutoBert Link to comment Share on other sites More sharing options...
Yuu Posted May 7, 2016 Author Share Posted May 7, 2016 I have tested and it was the part made my script "not responding" and freeze for few minutes. It's not and message from bs http://s32.postimg.org/a1vlu9o1x/Capture.png Link to comment Share on other sites More sharing options...
AutoBert Posted May 7, 2016 Share Posted May 7, 2016 It's the sleep which freezes your GUI and you didn't post whole script. Link to comment Share on other sites More sharing options...
Yuu Posted May 7, 2016 Author Share Posted May 7, 2016 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 More sharing options...
Moderators JLogan3o13 Posted May 7, 2016 Moderators Share Posted May 7, 2016 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 More sharing options...
Yuu Posted May 7, 2016 Author Share Posted May 7, 2016 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 More sharing options...
AutoBert Posted May 8, 2016 Share Posted May 8, 2016 (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 May 8, 2016 by AutoBert Link to comment Share on other sites More sharing options...
Yuu Posted May 8, 2016 Author Share Posted May 8, 2016 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 More sharing options...
AutoBert Posted May 8, 2016 Share Posted May 8, 2016 Posting here will give better results and you can also post a runable reproducer which show the issue. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 9, 2016 Moderators Share Posted May 9, 2016 @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 More sharing options...
JeremyNicoll Posted May 11, 2016 Share Posted May 11, 2016 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 More sharing options...
AutoBert Posted May 11, 2016 Share Posted May 11, 2016 The Problem is (so i think) GuiGetMsg and the sleep. While sleeping the GUI is frozen. Link to comment Share on other sites More sharing options...
JeremyNicoll Posted May 11, 2016 Share Posted May 11, 2016 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? 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