Development :  K-Meleon Forum
K-Meleon development related discussions. 
Update Groups2?
Posted by: desga2
Date: May 10, 2010 03:19AM

I'm thinking in update Groups2 macro to do the next changes:
- Delete _Groups2_compat function, because I think anyone use the old 0.2c version of this macro.

- Add a new feature to Export and Import Groups2 to/from an ini file.
And in the future, when I know how, add the possibility to do it to a bookmark HTML file.
This new option can be useful to portable your Groups2 and like backup system of your Groups2.

Torically we can add this new feature easily, in pseudocode:
-EXPORT:
Ask for path to export file: $PATH = promptforfolder( CAPTION [, INITIAL_FOLDER] );
Loop to read all Groups2 prefs and write it in Groups2.ini file:
$VALUE = getpref( TYPE, "user.preference.variable" );
iniwrite( SECTION, KEY, VALUE, PATH );

-IMPORT:
Ask for ini file to import: $PATH = promptforfile( INITIAL_FOLDER, FILE_TYPE_DESCRIPTION, FILE_EXTENSION_PATTERN );

Loop to read all Groups2.ini file keys and save it in prefs:
$VALUE = iniread( SECTION, KEY, VALUE, PATH );
setpref( TYPE, "user.preference.variable", VALUE );

SECTION=Group
KEY1=URL1
KEY2=URL2

We need a first SECTION with info about the list of Sections/Gruops in file and how many keys/urls have each group/section.

What do you mind about this? Is it useful to the users of Groups2?

K-Meleon in Spanish

Options: ReplyQuote
Re: Update Groups2?
Posted by: JamesD
Date: May 10, 2010 05:36AM

I am sure you are right about the old compatibility function. By now, no one uses the old version.

The import/export idea sounds good. Would be a great way to backup the groups and install into a new instance of KM. Just remember that there is no way to delete a record in an ini file. I have not tried to overwrite an existing ini file with a new one. I know it is dangerous, but I would really like the ability to delete a record in an ini file.

If there is any part of this that you want me to work on, just ask.

Update:
Import could be complicated. Would import replace existing or add to existing? Replace is pretty easy. First delperf all existing groups2 lines and then write lines based on the ini file info.

Adding to existing groups is much more complicated. First check to see how many groups exist and the re-number the groups coming from the ini file so they fit it after the original groups.

For really complicated, check the groups from the ini file to see they are not exactly the same as an existing group. That way we would not have any duplicates.

Now would it not be very fancy to have the ability to sort the groups by name. I don't think we have a sort function in the macrolanguage.

I am not making this any more easy, am I?



Edited 1 time(s). Last edit at 05/10/2010 07:25AM by JamesD.

Options: ReplyQuote
Re: Update Groups2?
Posted by: JamesD
Date: May 10, 2010 08:28PM

A test version with export is available at http://dl.dropbox.com/u/1522294/groups2.7z

This is not for general use yet. It has only export and not import. The _Groups2_compat function has been removed.

Awaiting comments
JamesD

Update:
@ desga2

The export to bookmarks will have to come from you. I use Favorites and do not understand bookmarks.

The import function will be more complicated. I will likely await comments and directions before trying that.



Edited 1 time(s). Last edit at 05/11/2010 03:51AM by JamesD.

Options: ReplyQuote
Re: Update Groups2?
Posted by: ndebord
Date: May 11, 2010 05:49AM

desga2,

This would be extremely helpful. I do not use Sessions, instead find Groups much more useful for my needs. To be able to use it with an INI file and have export and import? A great improvement. I could then use one Groups file with multiple versions of KM.

Looking forward with great anticipation to this.

N

Options: ReplyQuote
Re: Update Groups2?
Posted by: JamesD
Date: May 11, 2010 07:01PM

An incremental update has be completed and is located here. http://dl.dropbox.com/u/1522294/groups2.7z

The translate function has been added to menus, prompts and alerts.
A check to see if groups exist has been added to export.
Progress is now written to statusbar for export.

@ desga2
I did not mean to completely take over your project. Do you wish me to continue with import function?

Update:

Questions for users -

1. The current export function allows the user to select the location but not the name for the ini file. Should the user be able also to select the file name? It would mean a second prompt and then some checking to see that the filename meets Windows standards. A decision must be made on this before the import function can be finished.

2. Plan for the import function is to verify that the file selected for import does have groups. Also there is to be a check to see if groups already exist in the user's profile. Should a backup of the existing groups be offered or automatic? Should a backup of existing groups prior to an import be done at all?

JamesD



Edited 1 time(s). Last edit at 05/12/2010 12:31AM by JamesD.

Options: ReplyQuote
Re: Update Groups2?
Posted by: desga2
Date: May 12, 2010 02:59AM

Quote
JamesD
The import/export idea sounds good. Would be a great way to backup the groups and install into a new instance of KM. Just remember that there is no way to delete a record in an ini file. I have not tried to overwrite an existing ini file with a new one. I know it is dangerous, but I would really like the ability to delete a record in an ini file.

That I known, at this moment you only can created an ini file and add/modify his content. You can set a key value to empty "" or a blank space " " or change to some unused character like "¬" or "*" to check an empty or deleted key value.

Quote
JamesD
Import could be complicated. Would import replace existing or add to existing? Replace is pretty easy. First delperf all existing groups2 lines and then write lines based on the ini file info.

Adding to existing groups is much more complicated. First check to see how many groups exist and the re-number the groups coming from the ini file so they fit it after the original groups.

For really complicated, check the groups from the ini file to see they are not exactly the same as an existing group. That way we would not have any duplicates.

- Import proccess:
Groups with different name to existed groups names are added, groups with same name are replaced. I think this is the better solution to avoid duplicates and not complicate a lot of the macro code.

Quote
JamesD
Now would it not be very fancy to have the ability to sort the groups by name. I don't think we have a sort function in the macrolanguage.

It's not easy, but I can tried to do something to sort groups by name.

Quote
JamesD
The export to bookmarks will have to come from you. I use Favorites and do not understand bookmarks.

I was thinking possibilities to do Groups2 export to Bookmarks or Favorites, but this need the help of an external tool (AutoIt). Better for more future version because with this feature will needed to be distributed like a K-Meleon Extension.
At this moment I want Groups2 work only with macro code, without external helper tools.

Quote
JamesD
I did not mean to completely take over your project. Do you wish me to continue with import function?

No problem, this is I like it, a Workgroup project. smiling smiley
(You can remember Groups2 is a workgroup macro since the begining)

- Replys about Questions for users:

1) I think for the moment ask for target folder is enought, and use a standard file named Groups2.ini (for example). To add a new prompt for file name we will time when the rest of code work fine. (Avoid problems with file names; spaces, system reserved characters, and other language characters)

2) Backup is responsability of the users, if an user like a backup before an import, user must know to do an export like backup before. (This is the informatic education)
We are not the user's mammy to go after picking up his toys. tongue sticking out smiley

But if you like automate a backup you can add a checkeable option in Groups2 menu to make a backup in profile folder before exit K-Meleon (OnQuit event). But this can delayed the K-Meleon closed time.

@ JamesD:
Thank you for your macro code, now I need some time (a pair of days) to work with the macro code. I'll notice you my advances with the code.

K-Meleon in Spanish

Options: ReplyQuote
Re: Update Groups2?
Posted by: JamesD
Date: May 13, 2010 07:45PM

@ desga2

I have sent some completed code to you by e-mail. It does replace but not merge. Let me know if you got it.

Options: ReplyQuote
Re: Update Groups2?
Posted by: desga2
Date: May 14, 2010 05:02AM

@ JamesD:
Yes, I have your mails, thanks for your help with the code.
I'll worked in it this weekend.

K-Meleon in Spanish

Options: ReplyQuote
Re: Update Groups2?
Posted by: desga2
Date: May 18, 2010 06:49PM

Changelog for next version of Groups2 macro: (currently testing the macro code, coming soon to test in this forum)

- Delete _Groups2_compat function, unused and old.
+ Add Export groups to ini file function.
+ Add Import from an ini file function, with two options; Replace and Merge.
+ Backup your groups in ini file before Import from an ini file.
+ Open a group in K-Meleon startup.
+ Sort function to sort in alphabetical order your list of groups.
+ Other minor fixes, corrections, documentation and comments in code.

Total above 500 lines of macro code.

K-Meleon in Spanish

Options: ReplyQuote
Re: Update Groups2?
Posted by: desga2
Date: May 18, 2010 10:06PM

Quote
JamesD
... Just remember that there is no way to delete a record in an ini file. I have not tried to overwrite an existing ini file with a new one. I know it is dangerous, but I would really like the ability to delete a record in an ini file.

You can try with this freeware tool: IniFIle 1.6

K-Meleon in Spanish

Options: ReplyQuote
Re: Update Groups2?
Posted by: ndebord
Date: May 19, 2010 07:43PM

Quote
desga2
Changelog for next version of Groups2 macro: (currently testing the macro code, coming soon to test in this forum)

- Delete _Groups2_compat function, unused and old.
+ Add Export groups to ini file function.
+ Add Import from an ini file function, with two options; Replace and Merge.
+ Backup your groups in ini file before Import from an ini file.
+ Open a group in K-Meleon startup.
+ Sort function to sort in alphabetical order your list of groups.
+ Other minor fixes, corrections, documentation and comments in code.

Total above 500 lines of macro code.

desga2,

Drool.


;-)

N

Options: ReplyQuote
Re: Update Groups2?
Posted by: JamesD
Date: May 23, 2010 01:36AM

Here is some updated beta code from desga2. http://dl.dropbox.com/u/1522294/groups2_5_21_060b.7z

He is doing some work on his ops sys and asked me to upload for him. Please test and post results here.

I plan to get started on my testing tonight after I get the lawn mowed.

Options: ReplyQuote
Re: Update Groups2?
Posted by: JamesD
Date: May 23, 2010 07:26AM

@ desga2

There might be some crossover between import/replace and import/merge. I started my test and export went well. However my next test was an import/replace and I got a message about replacing a group with the same name as an existing group. Have you changed replace to do anything except replace? Also it only asked about one group. Five groups were being replaced. I tried this twice with same results. Wanted to make sure I did not have mouse pointer on wrong item in menu. Included below is the test script to the point I encountered the problem.

Test plan for Groups2 0.6.0b

Tests conducted using KM 1.6.0a4 on XP-SP3 with the user profile in the path with the

program.

First back up the profile using Resprofile.kmm and then create sub-folders under 'macros'

with the names g2test_1, g2test_2, g2test_3, g2test_[number as needed].

Remove any current Groups2.kmm, Groups2.ini, or G2BkUp.ini files.

Copy into 'macros' the Groups2.kmm file to be tested.

Start KM and verify that all previous groups show in the Groups menu and that each one

works. Seven groups show and all URLs did load.

Export the current groups to an ini file in the folder 'macros'. A file named

'Groups2.ini' was created and contains the original seven groups and their URLs.
EXPORT WORKS.

Delete two of the original seven groups. Five groups remaining are exported to

'macros/g2test_1'. Verify that there are only five groups remaining in the menu.
FIVE GROUPS REMAIN.

Clear the cache from preferences.
DISK CACHE IS EMPTY.

Do an Import/ Replace from the ini file in 'macros' which contains the original seven

groups.
ASKED IF I WANTED TO REPLACE ONE OF THE GROUPS [COMEDY]. This was un-expected, but desga2

may have changed some of the code that I wrote. However the prompt title did have the word

'merge' in it. Why only ask about 'comedy'? Five groups were being replaced.

Since seven groups are back in the menu, I will try to replace with the ini file which is

in 'macros/g2test_1'. I want to make sure that I picked the correct choice from the import

menu.
SAME RESULTS AS BEFORE. ASKED ABOUT [COMEDY] BUT ONLY COMEDY. The title of the prompt was

'Import Merge existing group'.

Options: ReplyQuote
Re: Update Groups2?
Posted by: JamesD
Date: May 23, 2010 08:16AM

@ desga2

I have used the 'sort' and 'startup group' options and they worked without any problem.

Options: ReplyQuote
Re: Update Groups2?
Posted by: desga2
Date: May 24, 2010 02:19AM

I think the before problem is solved in this last revision: 0.6.0b 2010-05-24
Download link: Groups2.zip

K-Meleon in Spanish



Edited 1 time(s). Last edit at 05/26/2010 02:55AM by desga2.

Options: ReplyQuote
Re: Update Groups2?
Posted by: JamesD
Date: May 25, 2010 05:56AM

If you got a version of Groups2.kmm dated 2010-05-23, you should go back to the previous post and get the version dated 2010-05-24. There has been a bug fix update. New version is at the same link.

I think everything is working now.

Options: ReplyQuote
Re: Update Groups2?
Posted by: ndebord
Date: May 26, 2010 06:06AM

Quote
JamesD


I think everything is working now.


JamesD and Desga2,

I'd say so. Have just used it to sync two computers with zero problems. IMO, this is one of the best addons for KM ever.


Much thanks.

N

Options: ReplyQuote
Re: Update Groups2?
Posted by: JamesD
Date: June 03, 2010 08:02AM

Groups2 version 0.6.3 is ready.

New version can be found here. http://dl.dropbox.com/u/1522294/groups2_063.7z

Changelog

- Delete _Groups2_compat function, unused and old.
+ Add Export groups to ini file function.
+ Add Import from an ini file function, with two options: Replace and Merge.
+ Backup your groups in ini file before Import from an ini file.
+ Open a group in K-Meleon at startup.
+ Sort function to sort in alphabetical order your list of groups.
+ Report status of operations in the statusbar.
+ Option to remember Export, Import, and Backup paths.
+ Translate function added to all displayed text.
+ Other minor fixes, corrections, documentation and comments in code.

Options: ReplyQuote
Re: Update Groups2?
Posted by: SoerenB
Date: June 06, 2010 02:46PM

Hi,

and thanks a lot, desga2 & JamesD & ndebord, this is a true enhancement of an extension which was very good even before.

There's just one thing which I changed here and which I would suggest:
the menu items used most ( -the Groups) should appear topmost in the menu, with the administrative items & options below the separator.

Cheers
SoerenB

is: I'm back, on wine in some (!) linuxes - speaking of addiction ...

was: No more own machines, because of addiction.
Don't know when I'll be back to normal ...

Options: ReplyQuote
Re: Update Groups2?
Posted by: SoerenB
Date: June 06, 2010 03:04PM

Hi,

one suggestion for all who use the Hotlinks macro with one of siria's skins, or with other buttons similar to these.

Right- or LongClicking the chevron** in this toolbar is set to open the Toolbars submenu, which I don't use very often.
You can replace that by the Groups2 menu, thus having your most important sites all reachable from that one toolbar.

How it is done:

With the toolbar installed and the chevron visible, go to

-> Edit -> Configuration -> Toolbars

in the "toolbars.cfg" file, search for this line:
macros(kmPrefs(hotlinks))|Tool&bars
and replace by:
macros(kmPrefs(hotlinks))|&Groups


** "chevron" button: 2 "down" arrows on top of each other

Cheers
SoerenB

is: I'm back, on wine in some (!) linuxes - speaking of addiction ...

was: No more own machines, because of addiction.
Don't know when I'll be back to normal ...

Options: ReplyQuote
Re: Update Groups2?
Posted by: ndebord
Date: June 08, 2010 11:57AM

Quote
SoerenB
Hi,

and thanks a lot, desga2 & JamesD & ndebord, this is a true enhancement of an extension which was very good even before.

SoerenB,

Thanks for the thanks, but not me, just desga2 and JamesD. I just like what they've created! :-)

N

Options: ReplyQuote


K-Meleon forum is powered by Phorum.