FloatingMuseum Posted October 24, 2013 Report Share Posted October 24, 2013 Hello I need a possibility to copy Title and URL of the Tab not separately (as in Maxthon now) but in single structure with two fields: Title and Address. I know Maxthon can do this. Therefore, I have decided to write the plugin. The problem is I am newbie in JS and WebKit. I think I have to use a Tab.title and a Tab.url. But I cannot find how to copy it to the clipboard. I have tried to search WebKit API and found this: http://oldforum.maxthon.com/viewthread.php?tid=79469. But it is for html page's content not for WebKit Core. Also, I cannot find how to define a keyboard shortcut for an addon. Help, please. Link to comment Share on other sites More sharing options...
ligoten Posted October 28, 2013 Report Share Posted October 28, 2013 I've tried to do something very similar myself, and this is what I've come up with so far. It depends heavily on AutoHotKey. First, I assigned the "Copy Title and URL" action to Ctrl+Shift+z in Maxthon. Next, I added the following to my AutoHotKey script:$^+z:: send ^+z IfWinActive ahk_class Maxthon3Cls_MainFrm { StringReplace, clipboard, clipboard, `r`n, =, All FileAppend %clipboard% `r`n, f:\downloads\tabs.txt return } returnThis code fires whenever you press Ctrl+Shift+z and re-sends the Ctrl+Shift+z (but doesn't fire itself in an infinite loop); if the active window is Maxthon (despite the Maxthon3Cls_MainFrm, this does work on Maxthon Cloud), it then reads the contents of the clipboard and replaces any newline with the equals sign (not a good idea for pages with equals signs in the URL, but works as a proof of concept), then appends the modified clipboard string to a file "f:\Downloads\tabs.txt" Link to comment Share on other sites More sharing options...
FloatingMuseum Posted October 29, 2013 Author Report Share Posted October 29, 2013 Thanks. I think it's a nice solution. And I didn't know about AutoHotKey, it's a very interesting program. Actually, I need this feature only for OneNote (I save all links in it). Since OneNote supports addins on C# I will try to create feature with it. Link to comment Share on other sites More sharing options...
ligoten Posted October 29, 2013 Report Share Posted October 29, 2013 Good luck to you. I've been muddling my way toward the ability to save links back to my Maxthon 2 session from Maxthon Cloud, so this topic is quite interesting to me. Link to comment Share on other sites More sharing options...
Max_2 Posted October 29, 2013 Report Share Posted October 29, 2013 Hello, I have this old plugin from Max 2. Don't know if you can get it to work in Max now. Good luck! //************************************* //* * //* Created by mdlist * //* Visit mdlist.free.fr * //* May be modified for personal use * //* Please keep this credit * //* * //* *********************************** var security_id=%max_security_id; function no_error(){ return true; } onerror=no_error; var selectedtext=''; try{ selectedtext=window.document.selection.createRange().text; } catch(asdf){ } if(frames.length>0){ for(i=0;i try{ selectedtext+=window.frames.document.selection.createRange().text; } catch(asdf){ } } } selectedtext = (selectedtext.replace(/^\W+/,'')).replace(/\W+$/,''); selectedtext=escape(selectedtext); if (selectedtext) selectedtext="%AB"+selectedtext+"%BB%0D%0A%0D%0A%0D%0A"; var mdlist=0; var url,title; var mailmessage = selectedtext; var alltabs=external.tab_count; for (mdlist;mdlist url=escape(external.get_tab(security_id,mdlist).document.URL); if (external.get_tab(security_id,mdlist).document.title != ""){ title=escape(external.get_tab(security_id,mdlist).document.title)+":\n"; } else title=""; mailmessage += title + url + "\n\n"; } mailmessage = unescape(mailmessage); window.clipboardData.setData("Text",mailmessage); alert("The tabs info has been copied to the clipboard."); Link to comment Share on other sites More sharing options...
FloatingMuseum Posted October 30, 2013 Author Report Share Posted October 30, 2013 Max_2 replied at 2013-10-29 15:45 Hello, I have this old plugin from Max 2. Don't know if you can get it to work in Max now. Thanks. I will write about results. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.