General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Mail macro modification
Posted by: foobarly
Date: April 23, 2008 04:23PM

I am trying to better adjust the mail.kmm macro file to my needs and uses. I have been mostly successful with the following:
Mail_SendPageURL{
$JS_doit="with(top.document)location='mailtomoody smileysubject=[Webpage] '+encodeURIComponent(title)+'&body=See URL: '+encodeURIComponent(URL)"; &JS_hndlDoc;
}
Mail_SendLinkURL{
$JS_doitLink="j=a.length;location='mailtomoody smileybody='+encodeURIComponent(href)"; &JS_hndlLink;
}
Mail_SendImageURL{
$JS_doitImage="a=false;location='mailtomoody smileysubject=[Image] '+encodeURIComponent((title)?title:¤((alt)?alt:document.title))+'&body=See URL: '+encodeURIComponent(src)"; $JS_doitInput=$JS_doitImage; &JS_hndlImage;
}
Mail_SendFrameURL{
$JS_doit="location='mailtomoody smileysubject='+encodeURIComponent(title)+'&body='+encodeURIComponent(URL)"; &JS_hndlDoc;
}
Mail_SendSelection{
$JS_doit="if(getSelection())location='mailtomoody smileysubject=[Clipping] '+encodeURIComponent(title)+'&body='+encodeURIComponent(getSelection())+'%0D%0A%0D%0A- - - - -%0D%0AClipping from URL:%0D%0A'+encodeURIComponent(URL)"; $SelectedText==""?0:&JS_hndlDoc;
}
Attention: please remove any '¤' sign found in the code above.

Except -- there are always exceptions, right? -- the 'Send By Mail' context menu option isn't always working (like with a selection in http:// www.tcbmi.com/strokeit/donate.shtml) and the javascript error console (chrome://console2/content/console2.xul) is showing this error: 'Deprecated method document.getSelection() called. Please use window.getSelection() instead'.

In the first instance, could it be that server side includes aren't compatible with this? I really have no idea how to solve the console error.

Any help deeply appreciated.



Edited 2 time(s). Last edit at 04/24/2008 10:37AM by foobarly.

Options: ReplyQuote
Re: Mail macro modification
Posted by: kko
Date: April 23, 2008 07:59PM

Quote
foobarly
the send 'Send By Mail' context menu option isn't always working (like with a selection in http:// www.tcbmi.com/strokeit/donate.shtml)

Hmm, works for me (with the original mail.kmm).


Quote
foobarly
the javascript error console is showing this error: 'Deprecated method document.getSelection() called. Please use window.getSelection() instead'.

Line:

$JS_doit="if(getSelection())location='mailtomoody smileysubject=[Clipping] '+encodeURIComponent(title)+'&body='+encodeURIComponent(getSelection())+'%0D%0A%0D%0A- - - - -%0D%0AClipping from URL:%0D%0A'+encodeURIComponent(URL)"; $SelectedText==""?0:&JS_hndlDoc;

should be:

$JS_doit="if(window.getSelection())location='mailtomoody smileysubject=[Clipping] '+encodeURIComponent(title)+'&body='+encodeURIComponent(window.getSelection())+'%0D%0A%0D%0A- - - - -%0D%0AClipping from URL:%0D%0A'+encodeURIComponent(URL)"; $SelectedText==""?0:&JS_hndlDoc;

(two corrections, pay attention to your question marks)


Quote
foobarly
In the first instance, could it be that server side includes aren't compatible with this?

No. You are manipulating the document that is in your browser. It doesn't matter how the server created it.

Options: ReplyQuote
Re: Mail macro modification
Posted by: foobarly
Date: April 24, 2008 10:50AM

Thank you, kko. The console error is gone! smiling smiley

Unfortunately, the other problem still remains. Oh well, I guess I'll just live with it, my modification mostly works -- pity because that particular option would be the most convenient -- but I don't have the knowledge to fully debug the issue. Thanks again.

Final code, for the record:
Mail_SendPageURL{
$JS_doit="with(top.document)location='mailtomoody smileysubject=[Webpage] '+encodeURIComponent(title)+'&body=See URL: '+encodeURIComponent(URL)"; &JS_hndlDoc;
}
Mail_SendLinkURL{
$JS_doitLink="j=a.length;location='mailtomoody smileybody=See URL: '+encodeURIComponent(href)"; &JS_hndlLink;
}
Mail_SendImageURL{
$JS_doitImage="a=false;location='mailtomoody smileysubject=[Image] '+encodeURIComponent((title)?title:¤((alt)?alt:document.title))+'&body=See URL: '+encodeURIComponent(src)"; $JS_doitInput=$JS_doitImage; &JS_hndlImage;
}
Mail_SendFrameURL{
$JS_doit="location='mailtomoody smileysubject=[Webcontent] '+encodeURIComponent(title)+'&body=See URL: '+encodeURIComponent(URL)"; &JS_hndlDoc;
}
Mail_SendSelection{
$JS_doit="if(window.getSelection())location='mailtomoody smileysubject=[Clipping] '+encodeURIComponent(title)+'&body='+encodeURIComponent(window.getSelection())+'%0D%0A%0D%0A- - - - -%0D%0AClipping from URL:%0D%0A'+encodeURIComponent(URL)"; $SelectedText==""?0:&JS_hndlDoc;
}
Attention: please remove any '¤' sign found in the code above.

Options: ReplyQuote
Re: Mail macro modification
Posted by: foobarly
Date: April 24, 2008 10:54AM

FYI, here are some additional console errors generated while browsing this forums:

Warning: Error in parsing value for property '-moz-user-select'. Declaration dropped.
Source file: http:// kmeleonbrowser.org/forum/mods/editor_tools/colorpicker/js_color_picker_v2.css
Line: 94

Warning: Expected ',' or '{' but found 'html'. Ruleset ignored due to bad selector.
Source file: http:// kmeleonbrowser.org/forum/templates/kmeleon/default.css
Line: 284

Options: ReplyQuote
Re: Mail macro modification
Posted by: foobarly
Date: April 24, 2008 11:25AM

After seeing that I could 'Clip' any one or two paragraphs but not the whole text of the example page I mentioned (http:// www.tcbmi.com/strokeit/donate.shtml), could it be there's some limit on the amount of data that can be transfered this way?

Options: ReplyQuote
Re: Mail macro modification
Posted by: kko
Date: April 24, 2008 04:32PM

Yes, there is a limit. At first, the selected text is converted into a mailto: URL. There might be a limit for the length of URLs somewhere in the browser. In the end, the OS is generating a command line from this URL. The length of commands is also limited (the limit depends on the Windows version).

Due to your additions, the macro will reach this limit with less selected text...

Options: ReplyQuote
Re: Mail macro modification
Posted by: foobarly
Date: April 24, 2008 11:52PM

Damn, thought so. :mad:

Thanks for bearing me...

Options: ReplyQuote
Re: Mail macro modification
Posted by: foobarly
Date: July 07, 2008 09:30AM

Sorry to bring up this thread from the dead, but since the mods detailed here have proved to be a bounty for my Web clipping -- especially when I just use OE's "'Save as' text" feature to generate little text files, that keep the message subject line as the file name, and with the originating URL stored inside in plain text along with whichever text scrap I fancy...

I still have two problems, though, that I'll submitt here in the hope of suggestions that will lead to other improvements:

1. A lot of the text I am currently capturing uses diacritics, so the mail message output is spit out in a garbled ugliness -- I am guessing this is UTF-8 Unicode -- a situation I mostly solve by re-copying and re-pasting via the Windows clipboard; now if the clipboard can handle this type of text fine, K-Meleon macros should too, right?

2. I still use and old IE frontend called MixBrowser for its ability to embed a full webpage in the body of an HTML formatted email message, a really useful trick that I can't even start to figure how to replicate with KM -- but sure would love too.

Any hints? All help deeply appreciated. TIA, smiling smiley

Options: ReplyQuote
Re: Mail macro modification
Posted by: kko
Date: July 07, 2008 05:55PM

Quote
foobarly
1. A lot of the text I am currently capturing uses diacritics, so the mail message output is spit out in a garbled ugliness -- I am guessing this is UTF-8 Unicode -- a situation I mostly solve by re-copying and re-pasting via the Windows clipboard; now if the clipboard can handle this type of text fine, K-Meleon macros should too, right?

When you copy data to the clipboard (either manually or through a macro), additional (meta) information about the nature of the data (such as the encoding of text) is saved, so the application where you paste the clipboard contents can handle it accordingly. But here you are using the command line to exchange text between applications, so the target application doesn't get any encoding information... (km 1.5 might be worth a try since that is a Unicode build)

Quote
foobarly
2. I still use and old IE frontend called MixBrowser for its ability to embed a full webpage in the body of an HTML formatted email message, a really useful trick that I can't even start to figure how to replicate with KM -- but sure would love too.

I don't think that this is possible using macros. It might work through a XUL application (Firefox Add-On), though.

Options: ReplyQuote
Re: Mail macro modification
Posted by: JujuLand
Date: July 07, 2008 06:16PM

I have look for unMHT extension, but I have been able to make it work.

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc



Options: ReplyQuote
Re: Mail macro modification
Posted by: foobarly
Date: July 14, 2008 10:47AM

A late thanks for your replies, mates... (computer tweaking sent me offline).

@Alain:

Could Lex1's QuickSaver for Opera provide some assistance, either by adaptation or coding example? (It worked with oGet!...)
http://my.opera.com/Lex1/blog/quick-saver-2-1




Edited 1 time(s). Last edit at 07/15/2008 09:16AM by foobarly.

Options: ReplyQuote
Re: Mail macro modification
Posted by: foobarly
Date: July 15, 2008 11:01PM

<bump>

Just in case Alain hasn't read this...

Options: ReplyQuote


K-Meleon forum is powered by Phorum.