I am hoping someone can help me understand something.
I have a script that grabs text from the screen and returns something like this
__
Balance
33.
39.
35.
204.
0.
33.
185.
286.
169.
__
I want to be able to take an action based on the line being a number greater than zero. So in this case it would take the action for all 3-6 and 8-11. but not 7 because it is zero. My thought is to turn the text into an array and then test each line of the array. However, I am not sure how I can turn the OCRed data into an array or if there is some better way to manage this task.
Any help?
Action Based on Found Text
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Action Based on Found Text
Use the RegEx or Separate functions.
Here's an example. For the purposes of a working example I've hard coded the data to a label in place of where you'd get it from the screen:
Here's an example. For the purposes of a working example I've hard coded the data to a label in place of where you'd get it from the screen:
Code: Select all
/*
Data:
Balance
33.
39.
35.
204.
0.
33.
185.
286.
169.
__
*/
LabelToVar>Data,strData
RegEx>\d*(?=\.),strData,0,matches,nm,0
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: Action Based on Found Text
Thank you Marcus, I found the same answer this weekend.
I had to learn what regular expressions were to use the regex command.
This pulled the data into an array and I could take action off the Array_1 - Array_x separately.
Regexr.com is a great learning tool I found. I believe it was referenced in a blog post by Marcus but the link didn't work any longer as I think it was separated into a standalone page after he wrote about it.
Just wanted to close the loop and add Regexr.com incase anyone had a similar question that might come up in a future search.
I had to learn what regular expressions were to use the regex command.
This pulled the data into an array and I could take action off the Array_1 - Array_x separately.
Regexr.com is a great learning tool I found. I believe it was referenced in a blog post by Marcus but the link didn't work any longer as I think it was separated into a standalone page after he wrote about it.
Just wanted to close the loop and add Regexr.com incase anyone had a similar question that might come up in a future search.