K-Meleon
 

Home/News
Screenshots
Download
Documentation
Resources
Get Involved
Forum
Bugs
Development

SourceForge Logo
Spam Chongqed

 

 

 

 

 

 

K-Meleon

Documentation - Macros and Macro Scripting - E-Mail Selected Text

Introduction

This document explains how to create a macro that will e-mail the currently selected text.

Defining the Macro

You can add macros directly in K-Meleon. Select Edit - Preferences - Configs and then select the tab labeled "Macros". Scroll to the bottom of the file and add the following code:

email_text{
menu=Email &Text
open(javascript:self.location='mailto:?subject='Check this+&body='document.getSelection());
}
This code does two things. First, it defines a menu item, "Email &Text" for later use. It also defines the macro that will execute when you select that menu item. In this case, the macro "email_text" uses Javascript to open up your e-mail application and create an e-mail that includes the text that you have selected.

Click on the "OK" button to save your changes. A dialog will appear asking you if you wish to save your changes to "macros.cfg". Select "Yes" to save the changes. Now that we've defined the macro, we need to have a way to execute it.

Adding a Menu Entry for the Macro

When creating a macro, you have the option of binding the macro to a toolbar button, accelerator keys, creating a menu entry or all three. In this example, we'll just create a menu entry for our macro. Again, select Edit - Preferences - Configs and then select the tab labeled "Menus". We'll be adding our macro to the menu that appears when you right-click on a document. We'll also be adding it to our "File" menu. You can actually add it to any menu you wish or create a whole new menu for your macro. It's your choice!

In this window, add the following at the top:

&Email{
macros(email_text)
}

To add the macro to your Document Popup menu, scroll down until you find Document Popup defined and add this entry:

DocumentPopup {
       :&Email
        -
        &Back = ID_NAV_BACK
        &Forward = ID_NAV_FORWARD
        &Reload = ID_NAV_RELOAD
	  .
	  .
	  .

To add the macro to the "File" menu, find where the menu is defined and add an entry:


&File {
        &New Window+N = ID_NEW_BROWSER
        &Open...+O = ID_FILE_OPEN
        Save &As...+S = ID_FILE_SAVE_AS
        -
        :&Email
	  .
	  .

When you select "File", this entry will appear in the menu. When you select the entry, you will be able to email the selected text. Of course, you need to have an e-mail application configured on your computer to facilitate that e-mail process.

Click on the "OK" button to save your changes. A dialog will appear asking you if you wish to save your changes to "menus.cfg". Select "Yes" to save the changes.

Exit K-Meleon and restart the browser (if you have the symbiotic loader installed, you may have to re-boot). Select the File menu and you should see your new entry in the list of menu items. When you are ready to e-mail a selection of text, highlight the text, right-click and select the item from the list.

Coding and text by sesh with additional text by Andrew Mutch and Po.

Last updated: April 16, 2002
Created: April 16, 2002

(c) 2000-2001 kmeleon.org. All rights reserved.
design by splif.