Hello, I'm trying to create a variable using the text image finder.
The text finder will return a string value of "11/22/33", but I want the numeric values to be placed in its own variable.
ie. x = 11, y = 22, z = 33
Going through the functions it seems RegEx would be the best command for this task? Currently looking through and figuring out how the easy pattern syntax works for this.
Thanks
Return partial variables within string
Moderators: JRL, Dorian (MJT support)
- Dorian (MJT support)
- Automation Wizard
- Posts: 1416
- Joined: Sun Nov 03, 2002 3:19 am
Re: Return partial variables within string
Or you could use the Separate command, and separate by /
Re: Return partial variables within string
Hello Tienytne,
Here is one way you can do it with RegEx.
Hope this helps.
PepsiHog
Here is one way you can do it with RegEx.
Code: Select all
let>nDate=11/22/33
RegEx>(\d\d?).(\d\d?).(\d\d?),nDate,0,match,nom,1,nx=$1;ny=$2;nz=$3,Result
StringReplace>Result,;,crlf,Result
StringReplace>Result,n,let>,Result
IncludeFromVar>Result
mdl>%x%/%y%/%z%
PepsiHog
Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
Re: Return partial variables within string
Here is a more simplistic form of the above.
Code: Select all
let>nDate=11/22/33
RegEx>(\d\d?).(\d\d?).(\d\d?),nDate,0,match,nom,1,$1,x
RegEx>(\d\d?).(\d\d?).(\d\d?),nDate,0,match,nom,1,$2,y
RegEx>(\d\d?).(\d\d?).(\d\d?),nDate,0,match,nom,1,$3,z
mdl>%x%/%y%/%z%
Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
Re: Return partial variables within string
If ndate was separated by spaces instead of "/", how would I handle that?
i.e. ndate=11 22 33
Thanks!
i.e. ndate=11 22 33
Thanks!
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Return partial variables within string
PepsiHog's solution still works. It doesn't care what the separator is.
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?