Development :  K-Meleon Web Browser Forum
K-Meleon development related discussions. 
macro questions
Posted by: lerneree
Date: September 17, 2011 08:50AM

Hi!
Please, help. How I can
1 Get information from current site (source, links...)
2 Fill and send forms. What kind of fileds I can filed?
3 Can I store information to file?
Tahks

Options: ReplyQuote
Re: macro questions
Posted by: JamesD
Date: September 17, 2011 11:32AM

Quote
lerneree
1 Get information from current site (source, links...)
2 Fill and send forms. What kind of fileds I can filed?
3 Can I store information to file?

1) Right click on page and choose Page Properties from the popup menu.

2) Look for macros and extensions here http://kmeleon.sourceforge.net/wiki/MacroLibrary and here http://kmext.sourceforge.net/ and also here http://dl.dropbox.com/u/1522294/StoreFS.kmm

3) I am not sure what you mean. Can you describe your requirements in more detail?

Options: ReplyQuote
Re: macro questions
Posted by: lerneree
Date: September 23, 2011 07:15AM

1) Right click on page and choose Page Properties from the popup menu.
I need get source frm macros


3) I am not sure what you mean. Can you describe your requirements in more detail?
Any way to save information on hard drive

Options: ReplyQuote
Re: macro questions
Posted by: JamesD
Date: September 25, 2011 08:21PM

Quote
lerneree
1) Right click on page and choose Page Properties from the popup menu.
I need get source frm macros


3) I am not sure what you mean. Can you describe your requirements in more detail?
Any way to save information on hard drive

1) If you mean the source code of a macro, then there are two places to look. Macros are plain text files with an extension of kmm. They are found in k-meleon/macrso or your profile folder/macros.

3) There are several ways to save data to disk. Under the file menu, you may save the source code of the current page to your local disk such that you can view the page offline. The macrolanguage has commands such that you can create and read a file of the type and structure known as ini. There are some extensions and macros which will let you save screenshots or highlighleted text to disk.

I will need more information on what you need to save in order to provide more detailed instructions.

Options: ReplyQuote
Re: macro questions
Posted by: lerneree
Date: October 01, 2011 04:58PM

Thank you for answers. Sorry my English, I am from russia

1) If you mean the source code of a macro, then there are two places to look.
Macros are plain text files with an extension of kmm. They are found in k-meleon/macrso or your profile folder/macros.
I need to get source of page using commands of macrolanguage and work with this source code

2)
- The macrolanguage has commands such that you can create and read a file of the type and structure known as ini.
Where can I see description of reading/wrriting ini files?
- There are some extensions and macros which will let you save screenshots
save screenshots in image format?
Where can I see description of saving screenshots?

Options: ReplyQuote
Re: macro questions
Posted by: JujuLand
Date: October 01, 2011 06:58PM

For inifiles :

$VALUE = iniread( SECTION, KEY, VALUE, PATH ); Since version 1.5.3
Since version 0.6

Returns the value of the specified key in the specified section from the ini file in the path.

iniwrite( SECTION, KEY, VALUE, PATH ); Since version 1.5.3

Writes the key and value in the section to the ini file specified in path. If the file, section, or key does not exist, it is created. If the key exists the value is overwritten. An ini file has the following format.

[SECTION]
KEY=VALUE

Kept on this page

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: macro questions
Posted by: JamesD
Date: October 01, 2011 08:41PM

Quote
lerneree
I need to get source of page using commands of macrolanguage and work with this source code
That is possible. If you right click on an empty area of a page, you will get a pop-up menu. One of the items on that menu is "Page Properties" which is also a pop-up menu. On that menu is an item named "Source Code". That will open a window so that you can view the source code of the current page.

If you wish to edit and save that source code, there is an option under EDIT - PREFERENCES - PAGE DISPLAY - GENERAL so that you can specify an editor of your choice. The default is, I think, only a viewer. I have put Notepad++ as my choice for viewing source code.

If you wish to use the source code with the macro language, you could specify an editor, save the source code and use the "readfile" statement of the macro language to input the source code. The readfile statment can only handle files up to 32k in size.

Options: ReplyQuote
Re: macro questions
Posted by: JamesD
Date: October 01, 2011 08:54PM

Quote
lerneree
Where can I see description of reading/wrriting ini files?

How about a demo? Look in this thread http://kmeleonbrowser.org/forum/read.php?4,93841,94122#msg-94122

Go forward in the thread until my post of June 26, 2009 11:07PM. That included a macro named "ini_demo.kmm". You can put that code into your KM and run it.

Options: ReplyQuote
Re: macro questions
Posted by: lerneree
Date: October 02, 2011 09:59AM

Thanks. But I need to do it from macros, not mannually, authomatically

Options: ReplyQuote
Re: macro questions
Posted by: lerneree
Date: October 02, 2011 11:47AM

Thank you very much.I've got ini_demo.kmm.
And stupid quiestion- how to run macros after saving text in dir?



Edited 1 time(s). Last edit at 10/02/2011 11:48AM by lerneree.

Options: ReplyQuote
Re: macro questions
Posted by: JamesD
Date: October 02, 2011 04:35PM

Quote
lerneree
And stupid quiestion- how to run macros after saving text in dir?

No question is stupid. I should have explained.

For a macro whose code is displayed in the forum, use these steps to prepare it for use in your KM.

1) Open the editor of your choice.

2) Change focus to the forum page and copy the displayed code. Usually the code begins with the following line.
#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage[2])
Older code may reference MacroLanguage and newer code may reference Macrolanguage2. Most of the time the code is in a slightly different font and often ends with a statement like this.
$macroModules=$macroModules."ini_Demo;";
3) Save the file as macro name with the extension "kmm". In the case of ini_demo the name should be "ini_demo.kmm". Special note - if using Notepad. You must change the Save as type to "All files" so Notepad will not add the extension "txt". Sometimes the file name is found just above the code and other time it is located within the comment block. It should be the same name that appears in the $macroModules line.

4) The newly saved file should be put in one of two places in KM. The first place could be the folder named "macros" which is in the KM root folder. ( The root folder is the folder which contains k-meleon.exe ) The second place could be the folder named "macros" in your profile folder. You can find your profile folder from within KM by using EDIT - CONFIGURATION - PROFILE DIRECTORY.

5) After putting the macro file into the macros folder, you must re-start KM so that it will be read. All macros are read at KM startup unless specifically excluded.

6) There are two ways to check to see if the macro was read in correctly. The first is obvious. You will see the menu item(s) that you expect the macro to add. In the case of ini_demo a new item appears under the HELP menu. The second way to see what macros are running is to use EDIT - PREFERENCES - K-MELEON PLUGINS - MACRO EXTENSION. A listing of macros is provided there. You may exclude a macro from running by removing the check mark by its name.

I hope this helps. If any part seems un-clear please ask for more information. I make no claim on my abilities as a teacher.

Options: ReplyQuote
Re: macro questions
Posted by: lerneree
Date: October 02, 2011 05:43PM

what do you think can I get text of page (not source, just text on window)
id( ID_EDIT_SELECT_ALL );
id( ID_EDIT_COPY );
$TEXT = getclipboard();

Options: ReplyQuote
Re: macro questions
Posted by: JamesD
Date: October 02, 2011 07:07PM

You are right. That code will work. I added some lines just to check the results in a code testing macro that I have on my KM.
_Snippet_RunCode {
id( ID_EDIT_SELECT_ALL );
id( ID_EDIT_COPY );
$_Snippet_TEXT = getclipboard();

$_Snippet_len = length($_Snippet_TEXT);
alert($_Snippet_len);
if ($_Snippet_len < 32000) {
alert($_Snippet_TEXT);
}
}

The page that I tested was only 4416 in length but that ran way past the ability of the alert statement to display. Note that the alert statement does allow scrolling.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.