jhodgson14 wrote: ↑Fri Apr 26, 2019 11:30 am
Hi There,
Firstly,
Code: Select all
Windows 10, Free, CR75(DEV), VERSION BUILD=1005 RECORDER=CR
Objective: Extract two pieces of information from order pages and display them to the user in a PROMPT dialog box.
At the end of an ordering process we use it gives you the info you need on two separate pages which is quite annoying. The info is provided in a table on each page and I'm wondering if there is a better method than what I currently have in mind.
Currently this is my script;
Code: Select all
TAG POS=1 TYPE=A ATTR=TXT:Assemble
TAG POS=7 TYPE=TABLE ATTR=TXT:* EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=TXT:Assembled
TAG POS=2 TYPE=A ATTR=TXT:Assemble
TAG POS=7 TYPE=TABLE ATTR=TXT:* EXTRACT=TXT
TAG POS=1 TYPE=A ATTR=TXT:Assembled
SET !VAR2 {{!EXTRACT}}
SET !VAR3 ("'{{!VAR1}}'.concat('{{!VAR2}}')");
PROMPT "{{!VAR3}}
The table that each site gives looks like this;
Screen Shot 2019-04-26 at 12.09.11.png
Of course currently after the concat, the info is presented like this in the PROMPT window
Screen Shot 2019-04-26 at 12.23.23.png
My javascript knowledge is limited so the only way I know to get this to make sense would be lots of substrg's & slices.
Is there a better way to achieve this end goal?
Many Thanks J
Alright... OK, you are making a few "Mistakes":
1- You need to add a "SET !EXTRACT NULL" just before the 2nd 'EXTRACT', or the 1st 'EXTRACT' is also taken into your '!VAR2'.
2- 'concat()' is a JS Method, and can only be used inside 'EVAL()' when you are constructing your '!VAR3'.
3- And even with 'EVAL()', your final ';' would also need to be inside 'EVAL()', before the closing _")_.
Instead of 'concat()' you can also use a simple '+' to concatenate 2 Strings. The Syntax is much simpler...
Instead of 'EVAL()' + 'concat()' (or '+'), you can also use the 'ADD' Command.
You can also do the Concatenation and final Layout directly in the 'PROMPT' by using '<SP>' (Space) and '<BR>' (Line Break):
Code: Select all
PROMPT VAR1:<SP>_{{!VAR1}}_<BR><BR>VAR2:<SP>_{{!VAR2}}_
(Avoid using any '!' from '!VARn' for example directly in the 'PROMPT' for displaying Text or you get some "unpredictable" Results as iMacros then thinks those will be Input Vars...)
BUT...!, I think I had noticed that v10.0.x for CR has a Bug with '<BR>' in the 'PROMPT' which is replaced by a Space, you might want to try with '\r' instead (without the Single Quotes). I'm a bit "surprised" nobody ever reported it and complained, I guess '\r' or '\r\n' is probably the Workaround and all Users managed to find it...
And hum..., the 'EXTRACT' on the 'TYPE=TABLE' is maybe a little bit "too powerful" for your Need, you might want to only extract the few Fields that you "really" need/want in the 'PROMPT' instead of extracting all Cells from those 2 Tables as it also extracts the Title and many empty Cells...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...