help please
Posted by: cod983
Date: December 01, 2012 02:13AM

Hello guys. how to add macros-toolbar icons: quick note, invert colors, drag and scroll, disable javascript

Re: help please
Posted by: JamesD
Date: December 01, 2012 07:48AM

Quote
cod983
how to add macros-toolbar icons: quick note, invert colors, drag and scroll, disable javascript

Let me take a couple of easy ones first.

Disable Javascript
Use the menu TOOLS - PRIVACY and look for 'Block Javascript'. If there is a checkmark it is blocked and if there is no checkmark then Javascript is not blocked. Note: there are other ways to block Javascript that will not show here.

Add macros
Macros are text files with the extension of 'kmm'. They may be put in either of two folders. If you wish to have the macro available to all profiles, then the macro should be in K-Meleon's macro folder. The folder is named 'macros' and is in the KM root folder. The root folder is where the file k-meleon.exe is located.

If you have only one profile or only wish the macro available to one of your profiles, then the macro may be located in the 'UserMacroFolder'. The easiest way to find your current user macro folder is to use the menu EDIT - CONFIGURATION - PROFILE DIRECTORY and look for a folder named 'macros' there.

Add toolbar icons
Toolbar icons, more commonly know as buttons, can be added in two ways. One is to change the toolbars.cfg of your skin. That can be reached using menu EDIT - CONFIGURATION -TOOLBARS.

There is some information at the top of that file on what is required. Note: A command ID is not the only item the button may execute. A macro may also be called. Some buttons both execute one command or macro and have a menu available via a right-click on the button.

The usual place to have the bmp file(s) for user designed buttons is the a folder named 'default' which should be located in the same folder as your skins. You may have to create this folder the first time you add a button.

You can create a button on a new toolbar using a macro. The code calls a plugin and is complicated. I can provide an example if you require this method.

Quick note
You might find an extension for that here.
http://kmext.sourceforge.net/

If you just need to document some research I have an extension here:
https://dl.dropbox.com/u/1522294/Note4me.7z

Re: help please
Posted by: cod983
Date: December 01, 2012 08:32PM

thanks a lot for your help. I have all these extensions and I want to add them as a toolbar icon or just shortcuts in toolbar



Re: help please
Posted by: JamesD
Date: December 02, 2012 12:46AM

Are these extensions in K-Meleon now?

Re: help please
Posted by: cod983
Date: December 02, 2012 05:56AM

Yes, but only in the (K-Meleon) menu.

Re: help please
Posted by: rodocop
Date: December 02, 2012 01:58PM

cod983,
you need

1) read this reference in toolbars part to learn KM macro syntax for creating toolbars.
You need here these lines:
pluginmsg(toolbars, "AddToolbar", "<ToolbarName>, <ButtonWidth>, <ButtonHeight>","");
pluginmsg(toolbars, "AddButton", "<ToolbarName>, <ButtonName>, <Command>, <MenuName>, <TooltipText>, <ButtonWidth>, <ButtonHeight>, hot.bmp[0], cold.bmp[0], dead.bmp[0]","");
2) get inside one of macros, which are producing toolbars - I've put alexapps16.kmm from Twin as example (I've created it earlier the same way - by editing existing macro by Alex Tarantul and disrupted) - and adapt the BuildToolbar part for your needs
(hint: it's closely linked with BuildMenu function)

3) While editing [your] macro and creating new functions please ensure that they comply KM Macro Coding Guidelines

One more hint: you can add button from one macro to the toolbar, created by another macro. It's possible due to unique function names, that is one of the main requirements of MacroCoding Guidelines. Use this to create one toolbar for all your 4 extensions.


Try K-Meleon-1.6db+NS by dugbug // KM-16-S2014 by Fred // 1.6beta2.6 by JamesD

K-Meleon Twin+ Download for modern browsers =//= Download for old ones =//= Discuss it!!!

New KM74.0 for test and feedback! Get it there!



Edited 3 time(s). Last edit at 12/02/2012 02:08PM by rodocop.

Attachments: alexapps16.kmm (4.1 KB)  
Re: help please
Posted by: cod983
Date: December 02, 2012 07:30PM

thank you.I will try this but this is too complicated for me

Re: help please
Posted by: rodocop
Date: December 03, 2012 08:50PM

I think there is no need in the button for disabling JS macro and in the macro of it own too - as you can toggle JS permission by simply pressing F7


Try K-Meleon-1.6db+NS by dugbug // KM-16-S2014 by Fred // 1.6beta2.6 by JamesD

K-Meleon Twin+ Download for modern browsers =//= Download for old ones =//= Discuss it!!!

New KM74.0 for test and feedback! Get it there!


Re: help please
Posted by: rodocop
Date: December 03, 2012 10:28PM

OK.
Lesson 1 grinning smiley

1) Open your quicknote.kmm by notepad (or your preferred text editor)
2) Add this portion of code somewhere near the end of macro (I've put it between 'Accels' section and $OnInit command)
QN_BuildToolbar{
$qn_tip1=_("Add to QuickNote");
pluginmsg(toolbars,"AddToolbar","QuickNote,16,16","");
pluginmsg(toolbars,"AddButton","QuickNote,quicknote1,macros("."QuickNote_Text"."),"."App Launchers".",".$qn_tip1.",16,16,"."TabDinBkGnd.bmp[1],TabDinBkGnd.bmp[1]","");
}

This creates new toolbar with 1 button which sends selected text to QuickNote

How it works? Look:
$qn_tip1=_("Add to QuickNote"); - this line sets tooltip for your button (you need as many such lines as many buttons you want to create - give them unique names, changing number after $qn_tip - 2, 3, 4 etc. Real coders prefer to start numeration from 0 but I've started from 1 - no matter, it make sense only whether name is unique across all the macros bunch and it wouldn't confuse yourselftongue sticking out smiley)
pluginmsg(toolbars,"AddToolbar","QuickNote,16,16","");
Your plugin (macro) sends to KM a message to 'Add Toolbar' which is named 'QuickNote' and consists of buttons which are 16x16 pixels in size

In other macros you can skip this step if you plan to add buttons from other extensions to this toolbar not creating their own bars.

pluginmsg(toolbars,"AddButton","QuickNote,quicknote1,macros("."QuickNote_Text"."),"."&QuickNote".",".$qn_tip1.",16,16,"."TabDinBkGnd.bmp[1],TabDinBkGnd.bmp[1]","");

This is message to 'Add button' to the 'QuickNote' toolbar; 'qiucknote1' is the button name (you define this); macros("."QuickNote_Text".") is the command that refers to one of the functions defined in macro earlier (by author). I've chosen QuickNote_Text to send selected text, but one can choose another function or create 2nd (3rd, 4th, etc.) button on the toolbar
(for next buttons you need more pluginmsg(toolbars,"AddButton",...) lines in macro)

Next goes tooltip (".$qn_tip1."), button sizes (16,16) and then image address for 'hot', 'cold' and 'dead' states of the button.

I've inserted here address of one random button from my installationbut you need to get or create specific bmp-file with needed icons, place it in skins\default folder and paste its filename in this macro command.

3) add the next line
$OnSetup=$OnSetup."QN_BuildToolbar;";
after this one
$OnInit=$OnInit."_QuickNote_BuildMenu;";

4) save your macro and restart KM if was running.

If you need additional explanation about buttons creation and handling - this will be Lesson 2.grinning smiley


Try K-Meleon-1.6db+NS by dugbug // KM-16-S2014 by Fred // 1.6beta2.6 by JamesD

K-Meleon Twin+ Download for modern browsers =//= Download for old ones =//= Discuss it!!!

New KM74.0 for test and feedback! Get it there!



Edited 5 time(s). Last edit at 12/03/2012 10:42PM by rodocop.

Re: help please
Posted by: cod983
Date: December 05, 2012 02:09AM

rodocop
I have tried all these things, but in my toolbar nothing has changed.
I will never know how to make toolbar. grinning smiley
I give up on this.

Re: help please
Posted by: JamesD
Date: December 05, 2012 09:24AM

@ code983

Don't give up. I have a model that you may use. It makes a toolbar with four buttons. All you have to do is find the macro that is currently called by each of the items in your menu.

You can find the bitmap image for this model at
https://dl.dropbox.com/u/1522294/Flip_PM.bmp

Just copy that bmp file into a folder called default under K-Meleon\skins. You may have that folder or you may have to create it.

Just put 'code983_model.kmm' into your macros folder and restart KM. I don't actually have any of the four items you wish to use so I don't know their structure or macro names.

Attachments: code983_model.kmm (3.7 KB)  
Re: help please
Posted by: cod983
Date: December 06, 2012 01:07AM

Ok JamesD
I have an icon in the toolbar, but I stuck with controls.
These are the extensions if you can do something with it

Attachments: Extensions.zip (82.7 KB)  
Re: help please
Posted by: JamesD
Date: December 07, 2012 05:41AM

I am working on it. Progress so far is two out of four finished. I have colors and dragging working. Javascript should be no problem.

I cannot seem to get QuickNotes to work. I am not talking about the button. I cannot get QuickNotes to work from the menu. What version of KM are you using? I ask because I see utils.dll in the extension and I think that has a problem with version 1.6 which I am using.

You are right that it is not as easy as I made it sound before. There is one more step when you have a menu with multiple items involved like the screen colors. At least I have learned a new thing from this. I always like to learn.

Let me know about your KM version and I will keep on working. Well, until my wife drags me off to do something with her.

Re: help please
Posted by: JamesD
Date: December 08, 2012 12:10AM

I think this may work. I have not done Javascript since F7 will do that one.

Note that the kmm file for QuickNote has an error in line 35. The function alert is spelled Alert. It should be all lowercase.

Attachments: code983_model.kmm (2.7 KB)  
Re: help please
Posted by: cod983
Date: December 08, 2012 01:29AM

Oh everything works great thanks a lot JamesD!grinning smiley

Re: help please
Posted by: JamesD
Date: December 08, 2012 01:53AM

Happy to help.

K-Meleon forum is powered by Phorum.