Get image info

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
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
Chilly_Bang
Posts: 29
Joined: Tue Jan 27, 2015 9:13 am

Get image info

Post by Chilly_Bang » Thu Apr 05, 2018 6:04 pm

Hi
I'm on Win7x64, FF 52.7.3x64, iMacros 9.0.3

FF allows displaying of an image list with according image data, like on screenshot:
Image
How to access all available image infos with iMacros? I would like to it into CSV.
FCI: Win 7 x64 + Win10 x64 + FF 45.9.0 + iMacro for FF 9.0.3
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Get image info

Post by chivracq » Fri Apr 06, 2018 1:07 am

Chilly_Bang wrote:Hi
I'm on

Code: Select all

Win7x64, FF 52.7.3x64, iMacros 9.0.3
FF allows displaying of an image list with according image data, like on screenshot:
Image
How to access all available image infos with iMacros? I would like to it into CSV.
Mini-Reply just to let you know that I had started typing a (long) Reply, a few hours ago, and working on a "Creative" Solution for your Case, but my "Creative Solution" seems to bring my Browser (Pale Moon v26.3.3 + iMacros for FF v8.8.2 on Win10_x64) in such an "ecstatic" State of "complete Agony" that my Script crashes directly and with no Pardon my Browser...! I've never seen that...!! I know several ways to crash FF and PM (with iMacros), but not like in this Case, it's nearly disturbing, ah-ah...! :shock:
And of course, I lost my Reply as I wanted to test my Script before posting, and I "stupidly" did it in the same PM Profile that I was using for the Forum, and didn't have the "Courage" to start typing it all over again... I still have the Script but I don't want to post it as it turns out to be such a "deadly Weapon", ah-ah...!! :twisted:

I'll see if I have the Time to dig into that tomorrow again, but hum, I don't promise, I'm going to be a bit busy and during the WE as well...
(I've got a big (late) Gig on Saturday evening, (I'm a DJ/VJ IRL), and I still have a lot to "prepare" and it's going to be a "crazy" WE for me...)

And for those interested, parallel Thread on SOF:
- Get image info with iMacros
(No Replies/Answers yet, but hum..., @OP, I would be surprised if you get any Solution for that kind of Scenario on SOF..., and I would be even more surprised if anybody went "digging" in the Direction where I went, ah-ah...!)
Hum, FCI not mentioned on SOF, @OP, not good...! => You missed a +1 from me, ah-ah...! You should post with the same "Quality" on all Forums... :shock:
- (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...
User avatar
thecoder2012
Posts: 446
Joined: Sat Aug 15, 2015 5:14 pm
Location: Internet
Contact:

Re: Get image info

Post by thecoder2012 » Fri Apr 06, 2018 11:22 am

chivracq wrote:... and working on a "Creative" Solution for your Case, but my "Creative Solution" seems to bring my Browser (Pale Moon v26.3.3 + iMacros for FF v8.8.2 on Win10_x64) in such an "ecstatic" State of "complete Agony" that my Script crashes directly and with no Pardon my Browser...! I've never seen that...!! I know several ways to crash FF and PM (with iMacros), but not like in this Case, it's nearly disturbing, ah-ah...! :shock:
I'm really interested. "Creative Solution" sounds good.
chivracq wrote:And of course, I lost my Reply as I wanted to test my Script before posting, and I "stupidly" did it in the same PM Profile that I was using for the Forum, and didn't have the "Courage" to start typing it all over again...
This is no problem with form history control addon (auto delete after 1 week or 1 month in the options), really!
But untested with PM v26.3.3 :?
chivracq wrote:I'll see if I have the Time to dig into that tomorrow again, but hum, I don't promise, I'm going to be a bit busy and during the WE as well...
:shock:
chivracq wrote:(I've got a big (late) Gig on Saturday evening, (I'm a DJ/VJ IRL), and I still have a lot to "prepare" and it's going to be a "crazy" WE for me...)
With live stream? :wink:
Join 9kw.eu Captcha Service now and let your iMacros continue downloads and scripts while you sleep. - Custom iMacros? Contact me! :idea:
Chilly_Bang
Posts: 29
Joined: Tue Jan 27, 2015 9:13 am

Re: Get image info

Post by Chilly_Bang » Sat Apr 07, 2018 12:26 am

@chivracq wow, really sorry, for late answer (was at a kind of gig too), and for that the task forced your hardware to crush, smoke and noize. The thread at SOF is by me - have no much hope to get an answer at SOF, but i know there one single guy, who is real imacros magician. But he wasn't there for a long time.
Really interesting in your solution, specially after such kind of preparation and birth pangs. And you should better lie-in after your gig, before beginning with hack stuff.
chivracq wrote:I'm a DJ/VJ IRL
drop youtube link?
FCI: Win 7 x64 + Win10 x64 + FF 45.9.0 + iMacro for FF 9.0.3
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Get image info

Post by chivracq » Sat Apr 07, 2018 2:30 am

thecoder2012 wrote:
chivracq wrote:... and working on a "Creative" Solution for your Case, but my "Creative Solution" seems to bring my Browser (Pale Moon v26.3.3 + iMacros for FF v8.8.2 on Win10_x64) in such an "ecstatic" State of "complete Agony" that my Script crashes directly and with no Pardon my Browser...! I've never seen that...!! I know several ways to crash FF and PM (with iMacros), but not like in this Case, it's nearly disturbing, ah-ah...! :shock:
I'm really interested. "Creative Solution" sounds good.
chivracq wrote:And of course, I lost my Reply as I wanted to test my Script before posting, and I "stupidly" did it in the same PM Profile that I was using for the Forum, and didn't have the "Courage" to start typing it all over again...
This is no problem with form history control addon (auto delete after 1 week or 1 month in the options), really!
But untested with PM v26.3.3 :?
chivracq wrote:I'll see if I have the Time to dig into that tomorrow again, but hum, I don't promise, I'm going to be a bit busy and during the WE as well...
:shock:
chivracq wrote:(I've got a big (late) Gig on Saturday evening, (I'm a DJ/VJ IRL), and I still have a lot to "prepare" and it's going to be a "crazy" WE for me...)
With live stream? :wink:
Sorry, quoting your whole Post in "Block"...

=> "Creative Solution" involves 'about:cache' (Disk), there I found all the Info @OP was looking for, except "Dimension", if you feel like doing some Testing, I won't really have the time until Day+2..., but be careful, ah-ah...!

=> Add-on: v2.0.3.2 I think I tried to install, didn't manage indeed on PM26, maybe with some earlier Version, installed OK of FF v55.0.3, but hum, I use PM as my Standard/Default/Prod Browser thus for the Forum as well, FF is only to test for the Forum...

=> Live Stream: Shit I saw the guy tonight organizing for tomorrow, and I forgot to ask, but I guess not, not the first time I get the "Request", I should keep asking, I usually play in relatively small Venues in Amsterdam, a little bit Underground or at least not Commercial, and I guess they either don't have the Tech Knowledge how to set up a Live Stream, or the Equipment if Investment is involved, or don't want to do it because not Commercial and they struggle already enough to "survive" and are "afraid" that if they stream, then nobody will come... But hum..., mini Idea, we'll see...
Chilly_Bang wrote:@chivracq wow, really sorry, for late answer (was at a kind of gig too), and for that the task forced your hardware to crush, smoke and noize. The thread at SOF is by me - have no much hope to get an answer at SOF, but i know there one single guy, who is real imacros magician. But he wasn't there for a long time.
Really interesting in your solution, specially after such kind of preparation and birth pangs. And you should better lie-in after your gig, before beginning with hack stuff.
chivracq wrote:I'm a DJ/VJ IRL
drop youtube link?
Hum, on SOF, Advanced User @Shugar is very good, especially with JavaScript..., he's the best at the moment since 1 or 2 years on SOF, same like @iimfun on our Forum, and there might be a Solution in pure JS I would think, and otherwise if my Sol doesn't work, I'm a bit "worried" of that crazy Crash, I already thought of 2 other "possible" Solutions, but hum, a bit more cumbersome then...
But hum, it took me 1 sec to find "my" first Sol, only when I encountered the ugly Crash, I went thinking "hum, any other Option(s) MAYBE, in case this one, oops-oops-oops doesn't work...?", and 2 sec later I had 2 other "Options" in mind, but I'm not a Super-Computer, ah-ah...!

YT Link, pfff, nope, I do have a SoundCloud Page, but nothing on it, I'm a "Creative" Live Beast, ah-ah...!, never twice the same Gig...!! :wink:
- (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...
Chilly_Bang
Posts: 29
Joined: Tue Jan 27, 2015 9:13 am

Re: Get image info

Post by Chilly_Bang » Sat Apr 07, 2018 9:45 am

chivracq
Yes, i was meaning Shugar@SOF too :) Seen some solutions he provided in Javascript - really awesome, impressive and short, JS magic in its best.

In general - i'm very often struggling with tasks, where an iMacros access to browser function would be a simplest and easiest way to get stuff done in seconds. Like an access to browser inbuilt functions (already existing, like in current case), or, like using a browser extension's output by iMacro - but after all research i haven't find any solution, which would be like: do this, than that and you are done. Is iMacros generally a wrong tool for it?

I imagine a way like the usual iMacros recording way: run iMacros→load url→activate browser extension by iMacros, like klick on extension button→(i.e. page changed by extension, like DOM rewritten)→iMacros accesses rewritten DOM, like take data from additional DIV→write into CSV→loop (load next url). The crucial point is always an access to everything, what isn't HTML, also not in window. And this is weird for me, because, specially in the last time, browsers are pretty gut accessible and operable by Javascript. Maybe its time for something like, don't know, iMacros extension or a bridge or some lines of code, something like that, which would allow equally easily access to browser functions and extension, like to content of browser window.
FCI: Win 7 x64 + Win10 x64 + FF 45.9.0 + iMacro for FF 9.0.3
User avatar
thecoder2012
Posts: 446
Joined: Sat Aug 15, 2015 5:14 pm
Location: Internet
Contact:

Re: Get image info

Post by thecoder2012 » Sun Apr 08, 2018 6:31 am

chivracq wrote:=> "Creative Solution" involves 'about:cache' (Disk), there I found all the Info @OP was looking for, except "Dimension", if you feel like doing some Testing, I won't really have the time until Day+2..., but be careful, ah-ah...!
I see no solution in my eyes. Because "about:cache" is not really useful for Dimensions or "download" the file from the cache?
Download option is enough for me because then I can create it but I see no way. :wink:
chivracq wrote:=> Add-on: v2.0.3.2 I think I tried to install, didn't manage indeed on PM26, maybe with some earlier Version, installed OK of FF v55.0.3, but hum, I use PM as my Standard/Default/Prod Browser thus for the Forum as well, FF is only to test for the Forum...
Older versions: https://addons.mozilla.org/de/firefox/a ... /versions/ :wink:
Possible for PM: https://addons.mozilla.org/de/firefox/a ... on-1.4.0.6 (2.x and higher only with FF v50+)
chivracq wrote:Hum, on SOF, Advanced User @Shugar is very good, especially with JavaScript..., he's the best at the moment since 1 or 2 years on SOF, same like @iimfun on our Forum, and there might be a Solution in pure JS I would think, ...
Solution in pure JS is no problem with enough knowledge. You can access the local cache in imacros 8.9.7 without "about:cache" and it's faster.
iimfun was not active since 4 months. I have checked all 16 pages in the searchfunction. But Shugar is active.
Chilly_Bang wrote:... but after all research i haven't find any solution, which would be like: do this, than that and you are done. Is iMacros generally a wrong tool for it?
You can use all browser javascript (addon) functions in imacros (*.js). See https://stackoverflow.com/questions/278 ... le-or-blob and http://forums.mozillazine.org/viewtopic ... &t=3034341 (grab the file in your cache and then grab the dimensions with js)
I have used it in my audio/flash example (memory cache not disk cache but same way) to grab the file.
Chilly_Bang wrote:The crucial point is always an access to everything, what isn't HTML, also not in window. And this is weird for me, because, specially in the last time, browsers are pretty gut accessible and operable by Javascript.
Which image is not in your window/DOM? Example? (multiple ways possible with JS)

Example with Google Logo in pure iim with EVAL: (idea from this thread)

Code: Select all

URL GOTO=https://www.google.de/
TAG POS=1 TYPE=IMG ATTR=ID:hplogo EXTRACT=HTM
SET width EVAL("var d = \"{{!EXTRACT}}\";var rx = new RegExp('width=\"([^\"]+)\"','i'); var x = d.match(rx)[1];  x;")
SET height EVAL("var d = \"{{!EXTRACT}}\";var rx = new RegExp('height=\"([^\"]+)\"','i'); var x = d.match(rx)[1];  x;")
PROMPT {{width}}x{{height}}
Example with Google Logo and iMacros 8.9.7 with Javascript (*.js):

Code: Select all

iimPlayCode("URL GOTO=https://www.google.de/");
var size = window.document.getElementById("hplogo").height+"x"+window.document.getElementById("hplogo").width;
iimPlayCode("PROMPT "+size);
All things are untested with iMacros 9.x and I think 8.x like 8.9.7 or 8.8.2 are better in this case. :wink:
Join 9kw.eu Captcha Service now and let your iMacros continue downloads and scripts while you sleep. - Custom iMacros? Contact me! :idea:
Chilly_Bang
Posts: 29
Joined: Tue Jan 27, 2015 9:13 am

Re: Get image info

Post by Chilly_Bang » Mon Apr 09, 2018 7:29 am

thecoder2012
I was thinking in the same way, to get width/height with regex, but there are some problems with it:
- images loading with CSS aren't there,
- images without size declaration aren't there,
- and, very important: i need absolutely to get naturalWidth and naturalHeight of images - browser has these sizes (on screenshot just before scaled to), but in the source code of the html document they are definitely not there
FCI: Win 7 x64 + Win10 x64 + FF 45.9.0 + iMacro for FF 9.0.3
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Get image info

Post by chivracq » Mon Apr 09, 2018 10:29 am

Chilly_Bang wrote:
thecoder2012
I was thinking in the same way, to get width/height with regex, but there are some problems with it:
- images loading with CSS aren't there,
- images without size declaration aren't there,
- and, very important: i need absolutely to get naturalWidth and naturalHeight of images - browser has these sizes (on screenshot just before scaled to), but in the source code of the html document they are definitely not there
Yep, exactly...!, Width/Height are only present in the Source if the Images are being "scaled"... And then easier to get those Values would simply be an 'EXTRACT=HTM' directly on the Image, no 'Regex' really needed then...
=> Mini-Demo on that very same 'Google' Logo from 'google.de':

Code: Select all

VERSION BUILD=8820413 RECORDER=FX
SET !EXTRACT_TEST_POPUP NO
TAB T=1

URL GOTO=https://www.google.de/
TAG POS=1 TYPE=IMG ATTR=ID:hplogo EXTRACT=HTM
'=> Extracted: "... height="92" width="272">"

SET Img_Height EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('height=\"'); y=x[1].split('\"'); z=y[0]; z;")
SET Img_Width EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('width=\"'); y=x[1].split('\"'); z=y[0]; z;")

PROMPT Image<SP>Dimensions:<SP>{{Img_Height}}x{{Img_Width}}
(Tested on iMacros for FF v8.8.2, PM v26.3.3, Win10_x64.)

Oh...!, but @thecoder2012's Sol with 'Regex' and 'match()' is also with 'EXTRACT=HTM' on the Image, hum..., I had seen some 'EXTRACT' on the whole 'BODY' earlier, which I found a bit cumbersome, and would be much slower... Then OK, we both more or less come up with the same Sol, even if mine is a bit simpler (to reuse) I would think, and I didn't try to minify it, ah-ah...!
thecoder2012 wrote:(idea from this thread)
Hum, funny, I checked that Link, I had "handled' that Thread apparently at that time, ah-ah...! But hum..., one more User to "spank" next time they'll come looking for some Help on the Forum as they never followed up on that one, grrr...! (And a perfect Example as to why I won't write any Scripts anymore or very rarely for other Users, ah-ah...!)
Hum..., and funny to see that 3 years later, I'm still using the same iMacros for FF Version, ah-ah...! 8)

But, pffff..., at @OP, if you really need the "real" Dimensions of the Image, hum..., like I mentioned earlier, that Info is "strangely" not mentioned in the 'Cache' (Summary), only the Size, while I think that 'View Image Info' gets its Content from the Browser Cache, so I don't know how that specific Info gets retrieved/computed... Other Sols I thought of would involve some Macro-Tool at the OS Level like 'AutoIt' to do some windows Explorer Right-Click and check the Properties of the File, but hum..., yep it must be there, because the whole Content of the Image is available in HexaDecimal, I didn't see it, but Windows Explorer is able to get that Info from "somewhere", so it must be there... => Extractable from iMacros from 'about:cache'...
Last edited by chivracq on Mon Apr 09, 2018 9:46 pm, edited 2 times 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...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Get image info

Post by chivracq » Mon Apr 09, 2018 11:05 am

chivracq wrote:... and I didn't try to minify it, ah-ah...!
=> Yep indeed, minified Version...: :wink:

Code: Select all

URL GOTO=https://www.google.de/
TAG POS=1 TYPE=IMG ATTR=ID:hplogo EXTRACT=HTM
SET Img_Height EVAL("'{{!EXTRACT}}'.split('height=\"')[1].split('\"')[0];")
SET Img_Width EVAL("'{{!EXTRACT}}'.split('width=\"')[1].split('\"')[0];")

PROMPT Image<SP>Dimensions:<SP>{{Img_Height}}x{{Img_Width}}
(Tested on iMacros for FF v8.8.2, PM v26.3.3, Win10_x64.)
- (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...
Chilly_Bang
Posts: 29
Joined: Tue Jan 27, 2015 9:13 am

Re: Get image info

Post by Chilly_Bang » Mon Apr 09, 2018 6:47 pm

chivracq
Wow, it is already pretty impressive! Ah, just read your message to its end - sad situation with naturalWidth / naturalHeight...:(

Maybe this would help: found a chrome extension, which reads all, really all image data i need from the current url and writes it into csv - maybe the code of this extension would be helpful to run it as iMacros? I attach the extension's code for the case.
Attachments
gmaopijenojbjmlibkgdflmkgcnkdgki.zip
(18.35 KiB) Downloaded 371 times
FCI: Win 7 x64 + Win10 x64 + FF 45.9.0 + iMacro for FF 9.0.3
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Get image info

Post by chivracq » Mon Apr 09, 2018 10:22 pm

Chilly_Bang wrote:
chivracq
Wow, it is already pretty impressive! Ah, just read your message to its end - sad situation with naturalWidth / naturalHeight...:(

Maybe this would help: found a chrome extension, which reads all, really all image data i need from the current url and writes it into csv - maybe the code of this extension would be helpful to run it as iMacros? I attach the extension's code for the case.
Hum, the "Magic" in this 'Bulk Image Details' CR Add-on seems to be in the 'contentscript.js' Script:

Code: Select all

let ht0={};chrome.runtime.onConnect.addListener(function(p){p.onMessage.addListener(function(m){p.postMessage({imgs:ht0.gi()});});});ht0.gi=function(){let di=document.images;let imgs=[];for(let i=0,l=di.length,img=di[i];i<l;++i,img=di[i]){let w=img.width,h=img.height,nw=img.naturalWidth,nh=img.naturalHeight;imgs.push({src:img.src,width:w,height:h,naturalWidth:nw,naturalHeight:nh});};return imgs;};
It doesn't look very "complicated", and the "nw=img.naturalWidth,nh=img.naturalHeight;" part is doing the Trick I would think, but JavaScript is not my "piece of cake", ah-ah...!, hopefully @thecoder2012 will know what to do with it, ah-ah...! :wink:
- (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...
User avatar
thecoder2012
Posts: 446
Joined: Sat Aug 15, 2015 5:14 pm
Location: Internet
Contact:

Re: Get image info

Post by thecoder2012 » Tue Apr 10, 2018 12:13 am

chivracq wrote:It doesn't look very "complicated", and the "nw=img.naturalWidth,nh=img.naturalHeight;" part is doing the Trick I would think, but JavaScript is not my "piece of cake", ah-ah...!, hopefully @thecoder2012 will know what to do with it, ah-ah...! :wink:
Maybe. :wink:

As IIM File: (tested with iMacros 8.9.7 and Waterfox 55)

Code: Select all

URL GOTO=https://www.google.de/
URL GOTO=javascript:(function(){let<SP>di<SP>=<SP>window.document.images;let<SP>csv<SP>=<SP>"";for(let<SP>i=0,l=di.length,img=di[i];i<l;++i,img=di[i]){let<SP>w=img.width,h=img.height,nw=img.naturalWidth,nh=img.naturalHeight;csv<SP>+=<SP>img.src+","+w+","+h+","+nw+","+nh+"\r\n";};window.document.body.innerHTML<SP>=<SP>"<textarea<SP>id=csv<SP>rows=10<SP>cols=150<SP>wrap=off>"+csv+"</textarea>"})();
TAG POS=1 TYPE=TEXTAREA ATTR=ID:csv EXTRACT=TXT
PROMPT {{!EXTRACT}}
For iMacros 8.9.7 and Javascript:

Code: Select all

iimPlayCode("URL GOTO=https://www.google.de/");
let di = window.document.images;
let csv = "";
for(let i=0,l=di.length,img=di[i];i<l;++i,img=di[i]){
	let w=img.width,h=img.height,nw=img.naturalWidth,nh=img.naturalHeight;
	csv += img.src+","+w+","+h+","+nw+","+nh+'\r\n';
};
window.document.body.innerHTML = "<textarea id=csv rows=10 cols=150 wrap=off>"+csv+"</textarea>";
Better ways and examples possible but this way was fast for me.
Join 9kw.eu Captcha Service now and let your iMacros continue downloads and scripts while you sleep. - Custom iMacros? Contact me! :idea:
Chilly_Bang
Posts: 29
Joined: Tue Jan 27, 2015 9:13 am

Re: Get image info

Post by Chilly_Bang » Tue Apr 10, 2018 9:23 am

Whoohaa, i see the light!

The whole working code is:

Code: Select all

VERSION BUILD=8881205 RECORDER=FX
SET !TIMEOUT_STEP 0
SET !ERRORIGNORE YES
TAB T=1
SET !DATASOURCE pages.csv 
SET !DATASOURCE_COLUMNS 1
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO={{!COL1}}

URL GOTO=javascript:(function(){let<SP>di<SP>=<SP>window.document.images;let<SP>csv<SP>=<SP>"";for(let<SP>i=0,l=di.length,img=di[i];i<l;++i,img=di[i]){let<SP>w=img.width,h=img.height,nw=img.naturalWidth,nh=img.naturalHeight;csv<SP>+=<SP>window.location.href+"\t"+img.src+"\t"+w+"\t"+h+"\t"+nw+"\t"+nh+"\r\n";};window.document.body.innerHTML<SP>=<SP><textarea<SP>id=csv<SP>rows=10<SP>cols=150<SP>wrap=off>"+csv+"</textarea>})();
TAG POS=1 TYPE=TEXTAREA ATTR=ID:csv EXTRACT=TXT


SAVEAS TYPE=EXTRACT FOLDER=* FILE=results.csv
In the file pages.csv are pages to test, in the file results.csv are image data. window.location.href helps to know, where images are located.

The data export looks like:

Code: Select all

test page 1, image 1, width, height, naturalwidth, naturalheight
test page 1, image 2, width, height, naturalwidth, naturalheight
test page 2, image 1, width, height, naturalwidth, naturalheight
test page 2, image 2, width, height, naturalwidth, naturalheight
FCI: Win 7 x64 + Win10 x64 + FF 45.9.0 + iMacro for FF 9.0.3
User avatar
thecoder2012
Posts: 446
Joined: Sat Aug 15, 2015 5:14 pm
Location: Internet
Contact:

Re: Get image info

Post by thecoder2012 » Tue Apr 10, 2018 5:30 pm

Try this line but i'm unsure:

Code: Select all

SAVEAS TYPE=TXT FOLDER=* FILE=results.csv
Reference: Can't save extracted data into a continuously appending

Other solution is without textarea and grab it or generate all datas as html table.
Join 9kw.eu Captcha Service now and let your iMacros continue downloads and scripts while you sleep. - Custom iMacros? Contact me! :idea:
Post Reply