Extensions :  K-Meleon Web Browser Forum
All about K-Meleon extensions. 
Pages: Previous12
Current Page: 2 of 2
Re: Macro request - Copy all links from all tabs
Posted by: JamesD
Date: June 28, 2016 11:47AM

rodocop

Some other points to resolve::

1) Where to put the menu for this? Page Properties does not seem right because not just one page's links. Tools or View, perhaps?

2) What text should the menu item contain? Right now it says, "All links in Window".

2.1) Macroinfo statement text?

3) Should the macro provide a method to view the output file?

I plan to add some statistics to the final alert. This is to give use some idea of the size of the output file.

Options: ReplyQuote
Re: Macro request - Copy all links from all tabs
Posted by: rodocop
Date: June 28, 2016 01:08PM

Quote
JamesD
rodocop

Some other points to resolve::

1) Where to put the menu for this? Page Properties does not seem right because not just one page's links. Tools or View, perhaps?

2) What text should the menu item contain? Right now it says, "All links in Window".

2.1) Macroinfo statement text?

3) Should the macro provide a method to view the output file?

I plan to add some statistics to the final alert. This is to give use some idea of the size of the output file.

1) I think in View->Page Properties section (along with docinfo-related items)
2) My proposition: "Links from all open pages"
2.1) Hmmm... What is the current output for this macro?
3) Ahh, understand.
The request was to have this list finally in clipboard. So that's it: load the ready list to clipboard and let macroinfo say something like: "All links are now collected in clipboard. Use Paste procedure to put it where you need"

It would be great to have 2 ways to represent a result:
- loaded to clipboard;
- txt-file open in new active tab (and may be linkified with corresponding macro).

But I can try to make second kind of output by myself in order to have some minor training in macrocoding grinning smiley

Options: ReplyQuote
Re: Macro request - Copy all links from all tabs
Posted by: JohnHell
Date: June 28, 2016 02:00PM

Quote
JamesD

2) What text should the menu item contain? Right now it says, "All links in Window".


That is where I was pointing too.

If the request is focused to extract links types, there should be 2 more options.


What I meant with an array check, is because the injectJS should check which links to return based on the two options.

In the original XPI file there are two files: fileextensions.js and filesharingsites.js which contain the arrays to check against.

My idea is to let the user download the updated the XPI and extract those files to a macro subfolder for this macro. Then, based in the menu option chosen make a readfile to those files and include in the injectJS code with a while loop to check.

In other words (this is draft, and I'm writting it while posting and therefore hasn't been tested; variable naming is just the idea):

NOTE: code might be wrong, we need to join opinions before implement.

$varcheck = "var copyalllinks = ['//']";

_Snippet_taprueba3 {
	$_tadf3 = injectJS("(function(u){".$varcheck."var cal; copyalllinks ? cal = copyalllinks : typeof CopyAllLinks.fileExtensions !== 'undefined' ? cal = CopyAllLinks.fileExtensions : typeof CopyAllLinks.fileSharingSites !== 'undefined' ? cal = CopyAllLinks.fileSharingSites : false ; var cnt = 0; while(cnt < cal.length){ u = document.links[".$_ucount."].href; if(u.indexOf(cal[cnt]) != -1){return u; break;} cnt++;} return false;})();");
   
   $_taf3 != "false" ? $_taprueba = $_taprueba."\n-> ".$_tadf3 : 0 ;
}

menuoptionforalllinks{
&_Snippet_taprueba3;
}

menuoptionforextensions{
$varcheck = readfile(path to fileextensions.js);
&_Snippet_taprueba3;
}

menuoptionforsharingsites{
$varcheck = readfile(path to filesharingsites.js);
&_Snippet_taprueba3;
}



Edited 3 time(s). Last edit at 06/28/2016 02:06PM by JohnHell.

Options: ReplyQuote
Re: Macro request - Copy all links from all tabs
Posted by: JamesD
Date: June 28, 2016 02:03PM

Quote
rodocop
The request was to have this list finally in clipboard. So that's it: load the ready list to clipboard and let macroinfo say something like: "All links are now collected in clipboard. Use Paste procedure to put it where you need"

Does anyone know of size limit for clipboard? I think it is really big. I will have a try.

Will try for "Page &Properties" as place for menu.

Must run errands for my wife now. Try later today.

Edit: Must go back and read post from JohnHell.



Edited 1 time(s). Last edit at 06/28/2016 02:04PM by JamesD.

Options: ReplyQuote
Re: Macro request - Copy all links from all tabs
Posted by: JohnHell
Date: June 28, 2016 02:11PM

Just in case, read again the above, I edited to add a "false" check to the return as I needed to avoid strict javascript errors and to avoid add false urls to the final result.

I don't know if clipboard has a limit. In my opinion the best option should be write file in %temp% and "notepad %temp%\\openfile". If system variables could be used.

Options: ReplyQuote
Re: Macro request - Copy all links from all tabs
Posted by: JamesD
Date: June 28, 2016 03:39PM

JohnHell

I think I just became 'lost' again. Let me try to get right menu, standard names, and clipboard. Once I have that, you and rodocop can decide about the other.

Options: ReplyQuote
Re: Macro request - Copy all links from all tabs
Posted by: rodocop
Date: June 28, 2016 03:43PM

The general answer is that windows clipboard is limited only to the RAM size.

There are some particular app-related limits like in MS Office and other apps where you cannot copypaste more than 65000 text lines.

Anyway I cannot imagine scenario where number of links will exceed this latter limit.

Options: ReplyQuote
Re: Macro request - Copy all links from all tabs
Posted by: JamesD
Date: June 28, 2016 05:33PM

I have tested some and it seems to work. Obviously, it will need additions/improvements.

All suggestions welcome.

Edit: Changed ver no. to match.



Edited 1 time(s). Last edit at 06/28/2016 05:50PM by JamesD.

Attachments: AllinksFtabs_1_1.7z (1.2 KB)  
Options: ReplyQuote
Re: Macro request - Copy all links from all tabs
Posted by: JohnHell
Date: June 28, 2016 09:51PM

Converted to UTF-8 and renamed variables and/or functions (have in mind that it was a test and I named in spanish as what it was (test=prueba )).

No more changes.

I'll assume that the original request was for extensions and file sharing sites, so the next update will include/change a popup menu with 3 options: all links, extension links and file sharing sites. And the code above to check which links matches the correct option.

Attachments: AllinksFtabs_1_11.zip (1.1 KB)  
Options: ReplyQuote
Re: Macro request - Copy all links from all tabs
Posted by: JohnHell
Date: June 29, 2016 12:08AM

I desist.

I reached a point that would need to include another script, and then another one from the original extension and a full rewrite.

Too much work.

I would leave the extension as is now and let the people choose the links they need.



Edited 1 time(s). Last edit at 06/29/2016 12:08AM by JohnHell.

Options: ReplyQuote
Re: Macro request - Copy all links from all tabs
Posted by: rodocop
Date: June 29, 2016 12:29AM

It's already a great job, folks!

Thank you all. Will try it in use and then - may be - contribute to the code.



Edited 1 time(s). Last edit at 06/29/2016 12:29AM by rodocop.

Options: ReplyQuote
Pages: Previous12
Current Page: 2 of 2


K-Meleon forum is powered by Phorum.