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:

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...!Chilly_Bang wrote:Hi
I'm onFF allows displaying of an image list with according image data, like on screenshot:Code: Select all
Win7x64, FF 52.7.3x64, iMacros 9.0.3
How to access all available image infos with iMacros? I would like to it into CSV.
I'm really interested. "Creative Solution" sounds good.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...!![]()
This is no problem with form history control addon (auto delete after 1 week or 1 month in the options), really!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...
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...
With live stream?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...)
drop youtube link?chivracq wrote:I'm a DJ/VJ IRL
Sorry, quoting your whole Post in "Block"...thecoder2012 wrote:I'm really interested. "Creative Solution" sounds good.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...!![]()
This is no problem with form history control addon (auto delete after 1 week or 1 month in the options), really!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...
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...![]()
With live stream?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...)
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...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.drop youtube link?chivracq wrote:I'm a DJ/VJ IRL
Yes, i was meaning Shugar@SOF toochivracq
I see no solution in my eyes. Because "about:cache" is not really useful for Dimensions or "download" the file from the cache?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...!
Older versions: https://addons.mozilla.org/de/firefox/a ... /versions/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...
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.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, ...
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)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?
Which image is not in your window/DOM? Example? (multiple ways possible with JS)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.
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}}
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);
I was thinking in the same way, to get width/height with regex, but there are some problems with it:thecoder2012
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...Chilly_Bang wrote:I was thinking in the same way, to get width/height with regex, but there are some problems with it:thecoder2012
- 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
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}}
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...!)thecoder2012 wrote:(idea from this thread)
=> Yep indeed, minified Version...:chivracq wrote:... and I didn't try to minify it, ah-ah...!
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}}
Wow, it is already pretty impressive! Ah, just read your message to its end - sad situation with naturalWidth / naturalHeight...chivracq
Hum, the "Magic" in this 'Bulk Image Details' CR Add-on seems to be in the 'contentscript.js' Script:Chilly_Bang wrote:Wow, it is already pretty impressive! Ah, just read your message to its end - sad situation with naturalWidth / naturalHeight...chivracq
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.
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;};
Maybe.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...!
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}}
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>";
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
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
Code: Select all
SAVEAS TYPE=TXT FOLDER=* FILE=results.csv