EVAL + Javascript Condition with XPATH (catching EANF)

Discussions and Tech Support specific to the iMacros for Chrome extension.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
jaivee
Posts: 7
Joined: Sun Sep 01, 2019 9:23 am

EVAL + Javascript Condition with XPATH (catching EANF)

Post by jaivee » Sun Sep 01, 2019 9:50 am

VERSION BUILD=1005 RECORDER=CR
Chromebook (I Macros Chrome extension ideally, but also Windows 10 and Internet Explorer possible, if needed), German
Chrome version 76.0.3809.102
iMacros= Personal Edition

Dear all,
we are trying to develop a script with

STEP 1: checks an XPATH defined container whether or not it is empty and then
STEP 2: If it is empty it should follow another XPATH with an URL

however, it seems we do have problems extracting the URL from within the Java Script

Could you help me with this?
Would be really great

Code: Select all


GOTO URL=www....

' extracting the link URL
TAG XPATH="//*[@id='itemsList']/ul/li[1]/div[@class='header']/h2/a"  EXTRACT=HREF
SET !VAR2  {{!EXTRACT}}

' extracting the P element which should be empty
TAG XPATH="//*[@id='itemsList']/ul/li[1]/div[contains(@class,'header')]/p/b"  EXTRACT=TXT
SET  !VAR3 {{!EXTRACT}}

' checking whether the P element is empty and if yes following the URL 
SET !VAR1 EVAL("var link = '{{!VAR2}}';  var m = '{{!VAR3}}'.match(/\\bEANF\\b/ig);if (m) link.split('?')[0] ;else 'http://www.google.de';")

we do see that within the java script the URL is not delivered, hence it is not possible to follow that link
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: EVAL + Javascript Condition with XPATH (catching EANF)

Post by chivracq » Sun Sep 01, 2019 11:26 am

jaivee wrote:
Sun Sep 01, 2019 9:50 am

Code: Select all

VERSION BUILD=1005 RECORDER=CR
Chromebook (I Macros Chrome extension ideally, but also Windows 10 and Internet Explorer possible, if needed), German
Chrome version 76.0.3809.102
iMacros= Personal Edition
Dear all,
we are trying to develop a script with

STEP 1: checks an XPATH defined container whether or not it is empty and then
STEP 2: If it is empty it should follow another XPATH with an URL

however, it seems we do have problems extracting the URL from within the Java Script

Could you help me with this?
Would be really great

Code: Select all

GOTO URL=www....

' extracting the link URL
TAG XPATH="//*[@id='itemsList']/ul/li[1]/div[@class='header']/h2/a"  EXTRACT=HREF
SET !VAR2  {{!EXTRACT}}

' extracting the P element which should be empty
TAG XPATH="//*[@id='itemsList']/ul/li[1]/div[contains(@class,'header')]/p/b"  EXTRACT=TXT
SET  !VAR3 {{!EXTRACT}}

' checking whether the P element is empty and if yes following the URL 
SET !VAR1 EVAL("var link = '{{!VAR2}}';  var m = '{{!VAR3}}'.match(/\\bEANF\\b/ig);if (m) link.split('?')[0] ;else 'http://www.google.de';")
we do see that within the java script the URL is not delivered, hence it is not possible to follow that link

Your Thread might get moved to the 'General' Sub-Forum as it probably has nothing specific to the 'iMacros for CR' Sub-Forum only...

OK..., fouff...!, you seem to like 'XPATH' and 'REGEX', ah-ah...! Not my "piece of cake", beurk...!, and I find your Implementation a bit cumbersome, and I don't really "trust" the Syntax you are using in your 'EVAL()' indeed... But OK, try this one...:

Code: Select all

' extracting the link URL
SET !EXTRACT NULL
TAG XPATH="//*[@id='itemsList']/ul/li[1]/div[@class='header']/h2/a" EXTRACT=HREF
SET !VAR2 {{!EXTRACT}}

' extracting the P element which should be empty
SET !EXTRACT NULL
TAG XPATH="//*[@id='itemsList']/ul/li[1]/div[contains(@class,'header')]/p/b" EXTRACT=TXT
SET !VAR3 {{!EXTRACT}}

' checking whether the P element is empty and if yes following the URL 
'SET !VAR1 EVAL("var link = '{{!VAR2}}';  var m = '{{!VAR3}}'.match(/\\bEANF\\b/ig);if (m) link.split('?')[0] ;else 'http://www.google.de';")
SET !VAR1 EVAL("var link='{{!VAR2}}', m='{{!VAR3}}', u1=link.split('?')[0], u2='http://www.google.de', z; if(m=='#EANF#'){z=u1;} else{z=u2;}; z;")
PROMPT Extracted<SP>Link:<BR>_{{!VAR2}}_<BR><BR>P_Element:<SP>_{{!VAR3}}_<BR><BR>URL:<BR>_{{!VAR1}}_
(Not tested...)

And there is a Difference between an Element being "empty" and being "not found". :!:
"empty" means the Element will be found, but when extracted, returns an empty String (=> ""), while "not found" will return "#EANF#".
Current Check is on "not found" (=> "#EANF#"), like you were also doing in your 'match()'...

And be "careful", I've corrected several Double Spaces in your Script... :!:
- (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...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: EVAL + Javascript Condition with XPATH (catching EANF)

Post by chivracq » Sun Sep 01, 2019 1:36 pm

And hum, one Remark about your FCI...:
You mentioned using iMacros for CR v10.0.5 'PE' on a ChromeBook which probably runs on Chrome OS.

But there is no 'PE' Version for Chrome OS, ah-ah...! :?

Afaik, you can only install Android/Linux Apps on Chrome OS, while the iMacros FIO-Module needed for Local File-Access (for CR & FF, IE 'Free' still has File-Access, at least on Win32/64, I'm not sure about Linux/MacOS) and to unlock the Limitations from the 'Free' Versions (Script = Max 50 Lines, Looping = Max 100 Loops, Vars = Max 3 Vars '!VAR[1-3]' and no User-defined Vars, to name a few...) is only available for Win32/64.
- (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...
jaivee
Posts: 7
Joined: Sun Sep 01, 2019 9:23 am

Re: EVAL + Javascript Condition with XPATH (catching EANF)

Post by jaivee » Sun Sep 01, 2019 9:01 pm

Hi - thank you very much for your swift reply!! That's awesome :)
Fixed the code below and it seems to work like that, now
  • the first XPATH extract the URL and the
  • second xpath checks whether or not it is defined
Thanks also a lot for your explanation of the difference between not defined / not found (=> "#EANF#") and an empty string String (=> "") - very helpful!!

Code: Select all

TAG XPATH="//*[@id='itemsList']/ul/li[{{!LOOP}}]/div[2]/h2/a"  EXTRACT=HREF
SET !VAR2  {{!EXTRACT}}
TAG XPATH="//*[@id='itemsList']/ul/li[{{!LOOP}}]/div[2]/p/b"  EXTRACT=TXT
SET  !VAR3 {{!EXTRACT}}
TAB T=1
SET !VAR1 EVAL("var link = '{{!VAR2}}';  var m = '{{!VAR3}}'.match(/\\bEANF\\b/ig);if (m) link ;else 'http://www.google.de';")

One last question: is it possible to have a iMacro code run within the "else" statement - like the below within else? It would save the detour via www.google.de,which is basically there at the moment to open a TAB and then also do the action and then close it again for those cases which have EANF (a bit lame, takes a lot of time, but it works)

Code: Select all

TAB OPEN 
TAB T=2 
URL GOTO={{!VAR1}}
In regards to the Personal Edition: Yes, you are right, mostly Chromebook and iMacro Chrome extension :) However, I bought the personal edition. Was not fully aware that Google Chrome has some limits. Nevermind, I hope the restrictions for the Google Chome Extension will be lifted soon. iMacro is a great software and for the longer scripts I will use it with my desktop computer. While at the same time will try to keep it as much for Chrome as possible.

Thanks again for your advice!!
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: EVAL + Javascript Condition with XPATH (catching EANF)

Post by chivracq » Mon Sep 02, 2019 1:14 am

Hum, Reply in 3 parts...
jaivee wrote:
Sun Sep 01, 2019 9:01 pm
Hi - thank you very much for your swift reply!! That's awesome :)
Fixed the code below and it seems to work like that, now
  • the first XPATH extract the URL and the
  • second xpath checks whether or not it is defined
Thanks also a lot for your explanation of the difference between not defined / not found (=> "#EANF#") and an empty string String (=> "") - very helpful!!

Code: Select all

TAG XPATH="//*[@id='itemsList']/ul/li[{{!LOOP}}]/div[2]/h2/a"  EXTRACT=HREF
SET !VAR2  {{!EXTRACT}}
TAG XPATH="//*[@id='itemsList']/ul/li[{{!LOOP}}]/div[2]/p/b"  EXTRACT=TXT
SET  !VAR3 {{!EXTRACT}}
TAB T=1
SET !VAR1 EVAL("var link = '{{!VAR2}}';  var m = '{{!VAR3}}'.match(/\\bEANF\\b/ig);if (m) link ;else 'http://www.google.de';")

Hum, OK, so this Script works now... I'm a bit "surprised" to be honest, but OK...
The only Difference I notice with your previous Script is that you now use directly the "raw" 'link'/'!VAR2' without doing the 'split()' on the '?'...

You use a completely different Syntax than the one I use, I'm surprised the ';' before the 'else' is not causing some "strange" Results, but OK if it works...! :o

Your whole Implementation is still pretty cumbersome, I'm nearly "impressed" you managed to get it to work "this time", but it's not based on "Good/Best Principles", and your Script is still full of Double Spaces (known to cause Pb's) while I had corrected them, and you didn't try the Script I had posted for you... :(
OK, fair enough, but next time you'll ask a Qt, I'll "wait a bit" and let you "sweat" a "long-mini-bit" until you really get stuck... :wink:
(A bit worthless for me if I write a Script for you and you don't even try it... while I very-very rarely, hum, nearly never actually write Scripts for other Users, exactly for this "Reason"... :shock: )

The Syntax I use in 'EVAL()' is yep maybe not as "sexy" as the one you use(d), but is (deliberately!) much easier to understand/adapt/reuse/extend AND TO DEBUG...! :idea:
Believe me, I'm used to write 'EVAL()' Statements for the Forum, I was the one who found out the Technique you are now using to implement your Conditional Logic... 8)
(As one of my "Creative" Workarounds, ah-ah...!, for stg that was for several years supposedly not possible to do or very cumbersome, while it is now actually "the (only) Way to go"..., unless Users stay on FF55/56 to keep using v8.9.7 for FF and '.js' Scripts... :wink: )

Hum, and "sorry" for my mini-"Rant", I realize I might be "bashing" you a bit hard, but you are actually doing "nearly perfectly" what I'm asking Users to do on the Forum: 8)
Perfect Follow-up, and you "understand" what you "are doing" and "what I am saying", and you are "trying "Things" by yourself", and you even find a Sol by yourself...! Very good...! :D
You'll be doing "Great Things" with iMacros, ah-ah...! :wink:

Just got a bit "frustrated" that I wrote a Script for you, (which I do veeeeery rarely), and that you didn't even try, grrr...! But OK, I'm over it, ah-ah...! 8)

>>>
jaivee wrote:
Sun Sep 01, 2019 9:01 pm
One last question: is it possible to have a iMacro code run within the "else" statement - like the below within else? It would save the detour via www.google.de,which is basically there at the moment to open a TAB and then also do the action and then close it again for those cases which have EANF (a bit lame, takes a lot of time, but it works)

Code: Select all

TAB OPEN 
TAB T=2 
URL GOTO={{!VAR1}}

I don't understand what you are asking / what you want exactly... :?
"possible to have a iMacro code run within the "else" statement?" doesn't really make sense to me...
Ask exactly what you want to do, and yep, I'll find a Solution... :P

>>>
jaivee wrote:
Sun Sep 01, 2019 9:01 pm
In regards to the Personal Edition: Yes, you are right, mostly Chromebook and iMacro Chrome extension :) However, I bought the personal edition. Was not fully aware that Google Chrome has some limits. Nevermind, I hope the restrictions for the Google Chome Extension will be lifted soon. iMacro is a great software and for the longer scripts I will use it with my desktop computer. While at the same time will try to keep it as much for Chrome as possible.

Thanks again for your advice!!

"not fully aware that Google Chrome has some limits" + "I bought the personal edition":
=> Then, hum, why did you buy the 'PE' Version for CR (which also works for FF and IE) if it was not to unlock the Limits of the 'Free' Version...!? :?

And the Limits don't come from "Google Chrome", all 3 Browsers (CR/FF/IE) have a 'Free' + a 'PE' Versions.
And for all (iMacros) Versions/Browsers, that 'PE' Version is only available for Win32/64 as OS.

=> iMacros on MacOS and Linux doesn't have a 'PE' Version "at the moment"... (Used to, well..., used to have Local File-Access Functionality, and I don't know of any "Dev-Plans", there is no "Road-Map" published of what is being developed (I've asked, and I would like to know, as I'm trying to help Users...! :roll: ), I usually discover a new Version has been released when a User mentions a Version "I don't know" :shock: in their FCI, ah-ah...! :P

And Android was never supported (for Local File-Access), + Chrome OS neither which is a very "new-Comer" in the OS-Landscape...

And I never used those 2 OS'es myself with iMacros..., so I never had a "Chance" to find a Way, and to look for a "Workaround"... :oops:
(Well, I do use 'TeamViewer' on an Android SmartPhone, to check if needed some Win7 + Win10 Laptops at Home, but pfff, last time I did it was maybe 3 or 4 years ago, ah-ah...! :P , all my iMacros Scripts know exactly when to run and what to do exactly "if anything goes wrong", the "worst" Thing will be Loss of Int. Co. for a very long time, and I won't be able to connect either through 'TV'... And my whole Workflow "works", there is not much I could do on a mini-Screen on a SmartPhone, ah-ah...!
(I'm a "pretty" Advanced User with iMacros from /always/ finding a Way/Workaround, and very often even when TechSup say it's not possible, but OK, I need to be "motivated" and to need that Use for myself, to go "digging" into it, ah-ah...! :twisted: )

But hum, I would already have 3 Workarounds for you on Chrome OS to get iMacros with Full Functionality: :idea:
- Chrome OS RDP // TeamViewer // GetBot. :idea:
Last edited by chivracq on Mon Apr 13, 2020 5:48 am, edited 1 time in total.
- (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...
jaivee
Posts: 7
Joined: Sun Sep 01, 2019 9:23 am

Re: EVAL + Javascript Condition with XPATH (catching EANF)

Post by jaivee » Tue Sep 03, 2019 9:05 am

Hi - thank you very much. So yeah, indeed you were very quick
After I figured the new code is working I planned to pull back my entry, but then you already came back... :)
Í tested your script and I am using it now. Thank you. It is very stable and works perfectly

Code: Select all

' extracting the link URL
SET !EXTRACT NULL
TAG XPATH="//*[@id='itemsList']/ul/li[1]/div[@class='header']/h2/a" EXTRACT=HREF
SET !VAR2 {{!EXTRACT}}

' extracting the P element which should be empty
SET !EXTRACT NULL
TAG XPATH="//*[@id='itemsList']/ul/li[1]/div[contains(@class,'header')]/p/b" EXTRACT=TXT
SET !VAR3 {{!EXTRACT}}

' checking whether the P element is empty and if yes following the URL 
SET !VAR1 EVAL("var link='{{!VAR2}}', m='{{!VAR3}}', u1=link.split('?')[0], u2='http://www.google.de', z; if(m=='#EANF#'){z=u1;} else{z=u2;}; z;")
PROMPT Extracted<SP>Link:<BR>_{{!VAR2}}_<BR><BR>P_Element:<SP>_{{!VAR3}}_<BR><BR>URL:<BR>_{{!VAR1}}_
SET !EXTRACT NULL is also a great idea, I was not aware of.

==>Including iMacro Code within the EVAL function?

I regards to the other question: Are you maybe aware of a possible way to integrate IMacro CODE within the EVAL function? I couldnt find any

Further down in the iMacro script we are using VAR1 with

Code: Select all

TAB OPEN 
TAB T=2 
URL GOTO={{!VAR1}}
if the P element IS DEFINED - as a work around - www.google.de is opened... etc.
...if the P element is NOT DEFINED, is #EANF# --> {z=u1;}, and another URL gets opened, which is the "right path"

The "Google Path" seems to be an unnecessary waste of time, but probably how the EVAL function is set up, hence impossible to skip?
Just wanted to ask if you maybe know a way to include the TAB OPEN etc. within the EVAL function

Thanks again
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: EVAL + Javascript Condition with XPATH (catching EANF)

Post by chivracq » Tue Sep 03, 2019 2:54 pm

jaivee wrote:
Tue Sep 03, 2019 9:05 am
Hi - thank you very much. So yeah, indeed you were very quick
After I figured the new code is working I planned to pull back my entry, but then you already came back... :)
Í tested your script and I am using it now. Thank you. It is very stable and works perfectly

Code: Select all

' extracting the link URL
SET !EXTRACT NULL
TAG XPATH="//*[@id='itemsList']/ul/li[1]/div[@class='header']/h2/a" EXTRACT=HREF
SET !VAR2 {{!EXTRACT}}

' extracting the P element which should be empty
SET !EXTRACT NULL
TAG XPATH="//*[@id='itemsList']/ul/li[1]/div[contains(@class,'header')]/p/b" EXTRACT=TXT
SET !VAR3 {{!EXTRACT}}

' checking whether the P element is empty and if yes following the URL 
SET !VAR1 EVAL("var link='{{!VAR2}}', m='{{!VAR3}}', u1=link.split('?')[0], u2='http://www.google.de', z; if(m=='#EANF#'){z=u1;} else{z=u2;}; z;")
PROMPT Extracted<SP>Link:<BR>_{{!VAR2}}_<BR><BR>P_Element:<SP>_{{!VAR3}}_<BR><BR>URL:<BR>_{{!VAR1}}_
SET !EXTRACT NULL is also a great idea, I was not aware of.

==>Including iMacro Code within the EVAL function?

I regards to the other question: Are you maybe aware of a possible way to integrate IMacro CODE within the EVAL function? I couldnt find any

Further down in the iMacro script we are using VAR1 with

Code: Select all

TAB OPEN 
TAB T=2 
URL GOTO={{!VAR1}}
if the P element IS DEFINED - as a work around - www.google.de is opened... etc.
...if the P element is NOT DEFINED, is #EANF# --> {z=u1;}, and another URL gets opened, which is the "right path"

The "Google Path" seems to be an unnecessary waste of time, but probably how the EVAL function is set up, hence impossible to skip?
Just wanted to ask if you maybe know a way to include the TAB OPEN etc. within the EVAL function

Thanks again

Yep, the "SET !EXTRACT NULL" is "Good Practice" if you want to "isolate" one Extract (if you are doing several Extracts of course) to store it in a Var or to do some Manipulation on it, to reuse it later in your Script or for Debug Purpose (with 'PROMPT') or if you want to include some Logging Functionality (... which won't be possible anyway with the 'Free' Version as you need the FIO-Module for the 'SAVEAS TYPE=EXTRACT'...).

It is possible to do that Data Manipulation on the whole '!EXTRACT' like you were doing, but that's usually cumbersome and "dangerous", although there are Cases where that can be "practical", if for example you'll be applying the same Manipulation to several Extracts.
And the 'Free' Version is limited to only 3 Vars, so you need to be a bit "saving" on those 3 Vars...

>>>

Running some Macro Code inside 'EVAL()', => nope, not possible...! :oops:
'EVAL()' only runs some pure JS in the Browser Built-in JS Engine (which doesn't know anything about this iMacros Add-on), and iMacros simply waits for the Result to store it as a String into your Var.

BUT...!, so you want to make the whole Block with the 'TAB OPEN' + Switch to that TAB + the 'URL GOTO' conditional, and that's possible... :D

First, instead of the 'Google' URL, you could compute an Empty String, and the 'URL GOTO' won't do anything. :idea:

The "2" in 'TAB T=2' can be computed dynamically using 'EVAL()' to conditionally switch to 'TAB_2', or stay on 'TAB_1'.

The "most difficult" part is the 'TAB OPEN', as the "OPEN" cannot be computed as a String. (I have an EnhReq about that btw, Item_14 about the "Super Built-in Var"... :wink: )
"Easier" would be if you can always have and leave that 'TAB_2' open and you simply switch to it, maybe conditionally, but you don't have to deal with the 'TAB OPEN' (and 'TAB CLOSE').

And if you "really" want a conditional 'TAB OPEN', I have some Syntax for a conditional 'TAB CLOSE' (in pure JS that can be run from 'URL GOTO=javascript') in this Thread (Item_4), and there is very certainly some similar JS Syntax for a 'TAB OPEN' that could be used the same way... :idea:
(And the JS Code can be computed as a String using 'EVAL()'...)
- (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...
jaivee
Posts: 7
Joined: Sun Sep 01, 2019 9:23 am

Re: EVAL + Javascript Condition with XPATH (catching EANF)

Post by jaivee » Wed Sep 04, 2019 7:30 am

thanks a lot for your great input! Very helpful!! 8) :)

pity with the EVAL function.
With the CSV import / export function it would be possible to write all the !VAR2 into a sheet and then select only the relevant
However, with Google Chrome / Chromebook set up this is limited currently as we know... lets hope for an update :idea: :) :!:

One other option for a work around, which I haven't explorer in detail though, could be to enter data to a Google Spreadsheet via Google Forms and then to select only the relevant https://www.portailseo.com/macros-seo/h ... e-sheets/#.

But this is only "food for thought" for future projects. My script is working great now. Thanks again!!
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: EVAL + Javascript Condition with XPATH (catching EANF)

Post by chivracq » Wed Sep 04, 2019 10:56 pm

jaivee wrote:
Wed Sep 04, 2019 7:30 am
thanks a lot for your great input! Very helpful!! 8) :)

pity with the EVAL function.
With the CSV import / export function it would be possible to write all the !VAR2 into a sheet and then select only the relevant
However, with Google Chrome / Chromebook set up this is limited currently as we know... lets hope for an update :idea: :) :!:

One other option for a work around, which I haven't explorer in detail though, could be to enter data to a Google Spreadsheet via Google Forms and then to select only the relevant https://www.portailseo.com/macros-seo/h ... e-sheets/#.

But this is only "food for thought" for future projects. My script is working great now. Thanks again!!

Yeah, well, "pity with the EVAL function.", that's the way iMacros is "designed", Macro Code is run directly from the '.iim' Script. :|
For Conditional Logic, you have to use a 'js' Script, or had to actually as '.js' Scripts are not supported anymore in the latest/current Version for FF (v10.0.2 for FF), or to use the 'SI' (Scripting Interface), or to use the Method I gave you...

About Local File-Access for Chrome OS, I doubt it will be implemented specifically for this OS the "Purpose" of Chrome OS and a ChromeBook is actually to do "everything" in a Web-Centric Environment as opposed to running Apps locally on the HD... But if Linux one day gets supported again, then there is a Chance that the same Setup might also work for Chrome OS as apparently, Linux and Android Apps can be installed on Chrome OS.

And yep, using a GoogleSheet, either directly in the Browser and directly from iMacros is a "workable" Workaround, or maybe better indeed via some Google Form, as last time I did some Testing myself with a GoogleSheet (in PM v26.3.3 + iMacros for FF v8.8.2), it was not working very "easily" and "straightforward", because the whole Data Cell Grid is seen by iMacros as just one big 'DIV' Element containing all Cells, and interacting with a specific Row/Coll/Cell (Range) was not very easy, and would only work using the 'EVENT' Mode and from the 'A1' Cell navigate to other Cells using the Keyboard Arrows, and it didn't always work very reliably... It is "supposed" to work "a bit better" in CR, but I've never tried myself in this Browser (that I don't like at all, ah-ah...! (As you nearly need to be a 3rd Degree NSA Hacker to get some Control over it, pfff, useless...!)).
- (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...
jaivee
Posts: 7
Joined: Sun Sep 01, 2019 9:23 am

Re: EVAL + Javascript Condition with XPATH (catching EANF)

Post by jaivee » Wed Nov 20, 2019 11:23 am

Windows 10, German
Internet Explorer
iMacros= Personal Edition

Dear chivracq, dear all,
I am using this script now for a very long time on CHROME. Works fantasticly

However, now I want to use it on IE and it stalls after

Code: Select all

' extracting the link URL
SET !EXTRACT NULL
TAG XPATH="//*[@id='itemsList']/ul/li[{{!LOOP}}]/div[@class='header']/h2/a" EXTRACT=HREF

' THIS IS WHAT HAPPENS AFTER THAT, BUT BASICALLY THE PROCESS REALLY STOPS WITH THE XPATH
' SET !VAR2 {{!EXTRACT}}

and the whole browser + the iMacro player shuts down

Do you maybe have an idea why this is happening?

I know this is for Chrome, but I am just trying my luck, since it is the same script

Thank you very much
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: EVAL + Javascript Condition with XPATH (catching EANF)

Post by chivracq » Wed Nov 20, 2019 6:15 pm

jaivee wrote:
Wed Nov 20, 2019 11:23 am

Code: Select all

Windows 10, German
Internet Explorer
iMacros= Personal Edition
Dear chivracq, dear all,
I am using this script now for a very long time on CHROME. Works fantasticly

However, now I want to use it on IE and it stalls after

Code: Select all

' extracting the link URL
SET !EXTRACT NULL
TAG XPATH="//*[@id='itemsList']/ul/li[{{!LOOP}}]/div[@class='header']/h2/a" EXTRACT=HREF

' THIS IS WHAT HAPPENS AFTER THAT, BUT BASICALLY THE PROCESS REALLY STOPS WITH THE XPATH
' SET !VAR2 {{!EXTRACT}}

and the whole browser + the iMacro player shuts down

Do you maybe have an idea why this is happening?

I know this is for Chrome, but I am just trying my luck, since it is the same script

Thank you very much

Hum, OK..., but your FCI concerning IE is not "completely" clear to me... :?
=> Can you mention the exact Versions for both 'iMacros for IE' and 'IE' the Browser you are using...? And maybe also your exact Win10 Version/Build...?

Some v12.6 Version got released last week, but I'm not sure if that Version is "only" for iMB (the iMacros Browser) or if iMacros for IE also got the same Update... :?
And that v12.6 Version indeed addresses/fixes some Issues related to some specific Win10/IE Update that is breaking, (and only on Win10 not-English, which would apply to you), some Functionality for iMacros v12.5 (iMB + IE) related to some JavaScript Popups/Dialogs/whatever, so that could be related to your Case...
- (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...
Post Reply