Cormin Posted June 3, 2014 Posted June 3, 2014 How can I make an if statement to continue when this value (-421, selected by finder tool) is + or - 1 number within -421? If it's anything else I want to re-calibrate again(I can do this part), if it is within that range of +/-1 then continue the script.
Danp2 Posted June 3, 2014 Posted June 3, 2014 First step would be to retrieve the value from the control. Show us your code where you tried to do this. Latest Webdriver UDF Release Webdriver Wiki FAQs
Cormin Posted June 3, 2014 Author Posted June 3, 2014 First step would be to retrieve the value from the control. Show us your code where you tried to do this. Not sure what you mean specifically. I haven't been using control clicks and my code does nothing with this box anyways for now. This box only gives me data from the board I'm programming giving me info on how much current it sees when I apply the current by hand.
Cormin Posted June 3, 2014 Author Posted June 3, 2014 This text box can be selected and copied into clipboard. I could do clipget but was hoping for a faster way than that.
Danp2 Posted June 3, 2014 Posted June 3, 2014 Based on your initial post, my assumption was that you needed to retrieve the value from the designated control and then perform an action if the value is within +/- 1 of -421. To get the control's contents, you would call ControlGetText() with the appropriate parameters. Latest Webdriver UDF Release Webdriver Wiki FAQs
Cormin Posted June 3, 2014 Author Posted June 3, 2014 (edited) Based on your initial post, my assumption was that you needed to retrieve the value from the designated control and then perform an action if the value is within +/- 1 of -421. To get the control's contents, you would call ControlGetText() with the appropriate parameters. MouseClick("left",156,210,1);calibrate start Sleep ( 50 ) MouseMove(1233,201) Sleep ( 50 ) Sleep ( 5000 ) MouseMove(251,212) Sleep ( 20 ) Beep(600, 500) Sleep ( 5000 ) This is my code for this process. The mouse click just clicks the big calibrate as indicated below button. It then moves the mouse(only for my reference when using headphones) to the right while calibrating then back when done calibrating. This is when I want the if statement. After the second mouse move, I want it to read if the box says +/-1 to -421, if it does continue the script, if it does not then click the button again. When its done calibrating(after the beep) I then stop current. So I guess I want a loop in there too which I don't know how to use. I want it to keep calibrating until it is within range. I don't know how to use control clicks. Also in a lot of spots in this program they don't work anyways. Edited June 3, 2014 by Cormin
Danp2 Posted June 3, 2014 Posted June 3, 2014 So have you tried using ControlGetText? Based on the contents of your screenshot, the following should work: $nCurrent = ControlGetText("Texas Instruments", "", "[CLASSNN:ThunderRT6Textbox3]") Latest Webdriver UDF Release Webdriver Wiki FAQs
Cormin Posted June 3, 2014 Author Posted June 3, 2014 (edited) So have you tried using ControlGetText? Based on the contents of your screenshot, the following should work: $nCurrent = ControlGetText("Texas Instruments", "", "[CLASSNN:ThunderRT6Textbox3]") I have not. I don't know how to use that in a looping if statement. Thanks so much for helping so far. Edited June 3, 2014 by Cormin
Cormin Posted June 3, 2014 Author Posted June 3, 2014 So have you tried using ControlGetText? Based on the contents of your screenshot, the following should work: $nCurrent = ControlGetText("Texas Instruments", "", "[CLASSNN:ThunderRT6Textbox3]") Tried making a tiny script to even test if this works. I have no clue how to use this. Sleep ( 800 ) $nCurrent = ControlGetText("Texas Instruments", "", "[CLASSNN:ThunderRT6Textbox3]") Sleep ( 50 ) MsgBox($nCurrent)
Danp2 Posted June 3, 2014 Posted June 3, 2014 You need to read the help file. The correct syntax would be: MsgBox(0, "result", $nCurrent) This should tell you if the value is being read with the earlier code. Then you would need to wrap everything in a While loop, like this: Local $nCurrent, $nMin = -422, $nMax = -420 While 1 MouseClick("left",156,210,1);calibrate start Sleep ( 50 ) MouseMove(1233,201) Sleep ( 50 ) ; Sleep ( 5000 ) MouseMove(251,212) Sleep ( 20 ) $nCurrent = ControlGetText("Texas Instruments", "", "[CLASSNN:ThunderRT6Textbox3]") If $nCurrent >= $nMin And $nCurrent <= $nMax Then ExitLoop EndIf Sleep ( 5000 ) WEnd Beep(600, 500) You probably will want to add some other method to exit the loop so that it doesn't run non-stop if the correct value isn't ever retrieved. Latest Webdriver UDF Release Webdriver Wiki FAQs
Cormin Posted June 3, 2014 Author Posted June 3, 2014 Sleep ( 800 ) $nCurrent = ControlGetText("Texas Instruments", "", "[CLASSNN:ThunderRT6Textbox3]") Sleep ( 50 ) MsgBox(0, "result", $nCurrent) This just gives me a window named result with nothing inside.
somdcomputerguy Posted June 3, 2014 Posted June 3, 2014 Sleep ( 800 ) $nCurrent = ControlGetText("Texas Instruments", "", "[CLASSNN:ThunderRT6Textbox3]") Sleep ( 50 ) MsgBox(0, "result", $nCurrent) This just gives me a window named result with nothing inside. Add Opt("WinTitleMatchMode", 2) to the top of this script, and read the Help file some more - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
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