loverdo wrote:Thank you very much for your help
im still having problem with your code
All my attempts were unsuccessful
Ok the first part is working ... :
SET !ERRORIGNORE YES
first.png
But the second part is :
second.png
When i turb ... :
SET !ERRORIGNORE NO i get this :
third.png
IDK where is the problem
I decided to contact my friend the programmer could possibly help me
so he write me this code and modify like this :
Code: Select all
var x = document.body.innerHTML; var s,y,z; var n = x.split('available_dates = ['); y=n[1].split('];'); z=y[0]; var array = z.split(",");if (array.length>=2) { s=array[1]; } else if (array.length=1) { s=array[0]; } alert (s);
If
more than 1 Date available select the
2nd date
and If only one date available select it
this code is working and selecting the 2nd date :
I modify the page and I just left
17-07-2018 in the page to make sure this line work and only one date available :
After putting the code in imacros
Code: Select all
EVAL("var x = document.body.innerHTML;var y,z;var n = x.split('available_dates = [');y=n[1].split('];'); z=y[0]; var array = z.split(",");alert (array[0] );")
We are getting this :
Code: Select all
SyntaxError: can not parse macro line 11: EVAL("var x = document.body.innerHTML;var y,z;var n = x.split('available_dates = [');y=n[1].split('];'); z=y[0]; var array = z.split(",");alert (array[0] );")
This code also
Code: Select all
SET Avail_Dates EVAL("var x = document.body.innerHTML; var s,y,z; var n = x.split('available_dates = ['); y=n[1].split('];'); z=y[0]; var array = z.split(",");if (array.length>=2) { s=array[1]; } else if (array.length=1) { s=array[0]; } alert (s);")
SyntaxError: wrong format of SET command at line 11
I told him that maybe the problem is that the color of the code has been changed in imacros but he did not believe me
OK, I had seen your Reply yesterday afternoon, but I needed some "time" for a "good" Reply, ah-ah..., but I had to leave a bit later...
Yeah, but you've modified my "original" Script, I can see from the Prompts, you don't post the Script you are using, so I can't see/check what you've modified exactly, I can't test my Code directly on your Site/Page as you never posted the URL (or you could upload some (Full) HTML Saveas of the Page to your Thread, then I can test my Code on your Page), but my Code should work, I would think... I've already used (always for the Forum I think..., I don't think I use it for any of my own Scripts) several times extracting some '<script>' directly from the Source, and it works normally
, iMacros treats it like any other HTML Element that you can extract... But tja...!, I need to be able to test by myself if anything goes "wrong", maybe some "Special" Chars are contained in that JS Script that 'EVAL()' can't handle, I don't know...
I told him that maybe the problem is that the color of the code has been changed in imacros but he did not believe me
Yep, your Friend is correct, never trust the Colours in iMacros (Editor), they are a bit "Buggy" anyway, ah-ah...!
But hum, what your Friend is doing with:
Code: Select all
var x = document.body.innerHTML; var s,y,z; var n = x.split('available_dates = ['); y=n[1].split('];'); z=y[0]; var array = z.split(",");if (array.length>=2) { s=array[1]; } else if (array.length=1) { s=array[0]; } alert (s);
... is more or less just the same like me, except that he/she is extracting your JS Script at some higher HTML Level in the Page => 'BODY'... OK, why not..., not best-best Practice on FF in my Opinion, iMacros is always a bit "slow" I've noticed when extracting the 'BODY' or 'HTML' Content on a Page, especially for "large" Pages, "my" 'EXTRACT=HTM' on 'TYPE=SCRIPT' was extracting the same Data, and at the smallest HTML Level, is more efficient I would think...
But then, you cannot use that Syntax in 'EVAL()' (I think...!?
), I'm not completely sure, but I thought it only works in 'URL GOTO=javascript', not in 'EVAL()'... Hum, and for both, 'alert()' doesn't work anyway, has been broken since at least v8.40 for FF, first Version I tried to use some 'alert()' inn 'EVAL()' or 'URL GOTO=javascript', I've never managed to get it to work, even if it's "advertized" in the Wiki...!
And even if you used that Syntax in 'URL GOTO=javascript', pfff..., it's very cumbersome in my Opinion, you then need a "special" Technique which is more of a "Trick" actually to be able to pass some Data/Var from the 'URL GOTO' to the '.iim' Script...
It can be done, but hum..., pretty cumbersome like I said..., wouldn't be my first Choice to be honest, there are much simpler Ways...!
But anyway, if you REALLY want to go this Way, more Info about that "Method" if you have a look at the following Thread...:
-
How to pass js variable to imacros variable
But the Script I had posted was pretty "straightforward", you can do everything you want from my 'Avail_Dates_Arr' Var, already demonstrated with 'Avail_Date_3'...
But you need to get 'Avail_Dates_Arr' populated, ah-ah...!, (empty in your Prompt, oops...!, NOT GOOD...!
), otherwise, nothing will work, ah-ah...!!
Ask your Friend to review and to understand my Script, as I guess it might maybe be a little bit too "High Level" for you if you are not very-very Techie, ah-ah...! (no Offense of course...!
), then they should be able to help you further... But believe me, even if my Script looked a bit "complex", I usually always find the simplest Way to implement stg with iMacros... (in pure '.iim' at least...), hum..., even when TechSup says it's not possible, ah-ah...!.
- (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...