Help with Get Text and variables

I wanted to include screenshots but I don’t have the trust or whatever but here is my problem.
I have a simple automation that reads a value from the same application at different times. I have the first scan/read set to save to price1 variable and the second scan/read to price2 variable. At the end I have the computer read out the values in the prompt and they read the same.

I changed the number it was reading in between scans, hence the 10 second delay to allow me to change the number. I am 100% sure I am changing it in time so that is out of the question.

I’m wondering why it prints the same number twice even though I have it set to save on different variables on each scan/read.

Another thing, I have a small question about variables. How do you change a variable value further down the automation. Say you have a get text box set to save to variableX and further down you have another get text box set to variableX aswell. When I have tested this, the variableX does not update to the second reading of get text.

Thank you

HI @weskorecki

Could you share the screenshots of what is the w=error you are getting so that we can assist you in that.

Regards

Hi @weskorecki ,
Your request is not clear

My understanding is that you want to use a variable to store 2 values at another time.
could be the strText variable. it will take the value at position 1 and then write it somewhere, then continue to another location and get the new value, then write it somewhere.
and the problem you have is that both times it gives the same result.

That’s right?

if it is correct, I think you need to check with messagebox at each step to get the value, after getting it return the correct result

There are many mistakes that can lead to this error, it may be due to the variable, it may also be due to the incorrect value extraction…

Regards,
LNV

however, to be more clear, i need to be more clear

Ok example above isn’t exactly what I want to do.

I am new so please have patience.

I would like to use “get text” and store the indicated target value in a variable. Seconds later the indicated target value in the program I am reading from changes and I would like to use “get text” again, looking at the same position, using the same indicated target and store in/update the same variable.

To test I have been writing the value of the variable in the output at the bottom of StudioX twice. There are 2 "write line"s. 1 After the first “get text” and 1 after the second “get text”. So I can see if the value has changed.

When I run the program, the first “get text” works and I see the value of the variable after the first read. A set amount of seconds later and the indicated target value changes, the second “get text” reads. The second “write line” is called and displays the same value as the first. So instead of getting 2 different values, there is a double of the same value .

I have tested and if everything is the same but the second “get text” is set to read a different indicated target but saved to the same variable as the first, the output reads 2 different values.

I am using the time on the target program as the indicated target.


Screenshot 2023-08-15 205547

There are chances of both get text activities are extracting same element.
make sure you are using dynamic selectors.

if you are not trust with screenshots, you can share the selectors of both get text activities.

add more time delay.

What are dynamic selectors

And I tried again with a longer delay and no change

Hello @weskorecki ,
When you are selecting the Target for the Get text Activity, Please try making it Dynamic.:


You can choose the Above option so that it becomes Dynamic.
Reagrds

The dynamic text target button doesn’t show up on the program that I want it to use… does work on calculator though.

Maybe there’s a setting?

Thanks for the Information @weskorecki ,
Can you please send me the Screenshot of the Selectors that you have used for the Get text?
Regards

@Akshay_B

I assume you mean this?

also in the properties tab of the get text, this is strict selector, not sure if it means anything.

*there is strict selector

i mean to say

Thanks for the Information @weskorecki , May I know How Often does the Value gets updated in the Application?

@Akshay_B The target is the current time so it updates every second.
But all this is just a simplified example. What I actually do what I want to do is read the price of the market. So it can change every second to 10 seconds ish.

Hey @weskorecki ,

1.Try selecting ‘Strict Selectors’ for the target after using ‘Get text’ , also ensure the target is dynamic and uncheck ‘Computer Vision’.

  1. You can try using ‘Get OCR text’ activity as well

@weskorecki

From the screenshot we can see you are using computer vision as target method instad find a strict selector and use the strict selector target method

Please indicate the elment in ui explorer and show the selector ot yourself can find a reliable selector…by using center top and right top panels in it…

When I say reiable …it should not contain any number or dynamic data

Hope this helps

Cheers

@Anil_G It does help, I got the dynamic text target to show up but not on the target that I want. I think I can work around this with some customizations of the target program.

Thanks for everyone’s help :stuck_out_tongue_winking_eye:

1 Like

@weskorecki

Glad it helped

Happy Automation

Cheers

Hey @Brian_Mathew_Maben ,
Thanks for providing the screenshots and related texts, it really made me understand it better with the image you provided
Thanks for the solution!

Happy automation!
@weskorecki