[lug] End-user Mozilla programming, e.g. javascript, XPConnect?

Neal McBurnett neal at bcn.boulder.co.us
Wed Feb 20 13:25:52 MST 2002


Is it possible for a user of Mozilla to customize and augment its
functionality with a scripting language like javascript?

I know I can write tiny snippets of javascript, like the google
buttons.  E.g. after putting this text in as the URL for a bookmark or
toolbar button in Netscape or Mozilla, you get a cute litte interface
to searching via google without having to load the google home page
first.  And if there is text highlighted in the browser already, that
is used as the search text:

  javascript:q=document.getSelection();if(!q){void(q=prompt('Enter text to search using Google.  You can also search any text on this web page by highlighting the text and clicking Google Search.',''))};if(q)location.href='http://www.google.com/search?client=googlet&num=100&q='+escape(q)

But I want to do more.  One example of what I'd like to do is to
filter outgoing email compositions thru some code that would
auto-convert characters from proprietary microsoft character sets into
their plain ASCII equivalents.

E.g. I get an improperly formatted message from someone, which has
microsoft-specific characters like left/right-double-quote.  I want
to reply to them and a bunch of other people.  Using the latest
Mozilla release, I quote their message and insert my own text.  When I
click to send the message, Mozilla is good enough to point out the
inconsistancy between these characters and the default ISO-8859-1
character set:

   The message you composed contains characters not found in the
   selected Character Coding, so your message may become unreadable
   after you send it. To send it anyway, click OK. To return to the
   Composer window where you can choose a different Character Coding,
   click Cancel.

One option here is to just choose the menu item
     view/character coding/Unicode (UTF-8)
but that won't work well for some recipients.

So I'd like to run a little script, accessible from a menu or button,
that will just automatically convert Microsofts silly characters into
ASCII so I can send in the normal ISO8859-1 character set.

A brief look suggests that XPConnect may help here:

  http://www.mozilla.org/scriptable/

But it looks pretty involved and I don't know if it will really
do the trick.

Has anyone used XPConnect?  Any other options ("pipe to command"??)

Cheers,

Neal McBurnett <neal at bcn.boulder.co.us>
http://bcn.boulder.co.us/~neal/
GPG/PGP signed and/or sealed mail encouraged.  Keyid: 2C9EBA60



More information about the LUG mailing list