Improvement requests :  K-Meleon Forum
Use this forum to talk about a feature you're missing. Use the bug tracker to report it if necessary. 
Pages: Previous123Next
Current Page: 2 of 3
Re: Name to save an IE fav
Posted by: JamesD
Date: September 09, 2008 12:53AM

Quote
Macrolibrary description
The user may cancel from the rename prompt and the process will be aborted. A cancel from the folder prompt will result in the default folder being used. That will be the Favorites folder.

This is way it has always been. Are you requesting an "abort" if the user does not choose a location?

That could be done, but I would have to see some buy in from other users first.

Options: ReplyQuote
Re: Name to save an IE fav
Posted by: Rodger
Date: September 15, 2008 12:34AM

I think the following would be the best:
When I click on cancel at "rename prompt" the promt will be closed, without any message.
When I click on cancel at the "choose a location prompt" the promt will be closed, without any message.

I don`t know why there should come a prompt, i think this is unnessary

Options: ReplyQuote
Re: Name to save an IE fav
Posted by: JamesD
Date: September 16, 2008 05:04AM

@ Roger

I have tinkered a bit with the international version and I think I have a copy the way you wish. This is not going in the MacroLibrary. It is just for users who do not like the original version.

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- FavRenAdd.kmm
# ---------- K-Meleon Macro Language Rename/Add page to Favorites ---------------
# ---------- INTERNATIONAL VERSION
#
# Dependencies        : - main.kmm, Favorites plugin active, JScript, Windows Scripting Host
# Resources           : - Registry keys "HKCU\\Software\\KMELEON\\FavRenAdd\\URLname"
#                 	            and "HKCU\\Software\\KMELEON\\FavRenAdd\\URLdisc"
# Preferences         : -
# Version             : -  3.1.5   2008-09-15
# --------------------------------------------------------------------------------
#
_FavRenAdd_RnameTrue{
$_fmax=258 ; $_FavRenAdd_ExVal = 0 ;
####   look three places for the favorites directory
$_FavRenAdd_FavFolder=getpref(STRING,"kmeleon.plugins.favorites.directory");
$_FavRenAdd_FavFolder==""?$_FavRenAdd_FavFolder=readreg("HKCU","Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Favorites"):0;
$_FavRenAdd_FavFolder==""?$_FavRenAdd_FavFolder=readreg("HKLM","Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Favorites"):0;
####   $_FavRenAdd_FavFolder should have the path for the favorites folder   c:\something\favorites
####   call _FavRenAdd_RnameTrue_loop until $_FavRenAdd_SubFolder is no longer a "?"
$_FavRenAdd_SubFolder="?";   while($_FavRenAdd_SubFolder=="?") &_FavRenAdd_RnameTrue_loop;
$_FavRenAdd_SubFolder== "X" ? &_FavRenAdd_FolderCancel : 0;
$_FavRenAdd_Title = substr($_FavRenAdd_value,1);
macros(_FavRenAdd_Sanitize_Title) ;                                
$_FavRenAdd_PathName = $_FavRenAdd_FavFolder."\\".$_FavRenAdd_SubFolder."\\".$_FavRenAdd_Title.".url" ;
$_FavRenAdd_Ext_Interger = 1;
while ($_FavRenAdd_Ext_Interger > 0 ) &_FavRenAdd_Duplicates_loop ;
## enclosure of a parameter in double quotes is only necessary when the parameter can contain whitespace
## therefor the 1, 2, and 3 in the next "exec" lines do not have double quotes
## first check the line lengths
$_fcmd = "(wscript.exe \"".$_FavRenAdd_Path."\" 1 \"".$_FavRenAdd_PathName.")" ;
length($_fcmd)>$_fmax ? &_FavRenAdd_Error1:0;
$_fcmd = "(wscript.exe \"".$_FavRenAdd_Path."\" 2 \"".$_FavRenAdd_CurURL.")" ;
length($_fcmd)>$_fmax ? &_FavRenAdd_Error2:0;
$_FavRenAdd_ExVal < 2 ? &_FavRenAdd_RunScript:0;
}

_FavRenAdd_RunScript{
exec("wscript.exe \"".$_FavRenAdd_Path."\" 1 \"".$_FavRenAdd_PathName."\"");
exec("wscript.exe \"".$_FavRenAdd_Path."\" 2 \"".$_FavRenAdd_CurURL."\"");
exec("wscript.exe \"".$_FavRenAdd_Path."\" 3 \""execute"\"") ;
}

_FavRenAdd_Error1{
alert(_("Unable to create favorite - data too long!  Line length, "). length($_fcmd). _(" and line are displayed\n\n"). $_fcmd, _("String length too long!"), EXCLAIM) ;
$_FavRenAdd_ExVal = $_FavRenAdd_ExVal + 2;
}

_FavRenAdd_Error2{
alert(_("Unable to create favorite - data too long!  Line length, "). length($_fcmd). _(" and line are displayed\n\n"). $_fcmd, _("String length too long!"), EXCLAIM) ;
$_FavRenAdd_ExVal = $_FavRenAdd_ExVal + 3;
}

_FavRenAdd_FolderCancel{
$_FavRenAdd_ExVal = 6;
}

_FavRenAdd_Sanitize_Title{
$_FavRenAdd_RevTitle = gsub( "?"," ",$_FavRenAdd_Title); 
$_FavRenAdd_RevTitle = gsub( ":"," ",$_FavRenAdd_RevTitle); 
$_FavRenAdd_RevTitle = gsub( "*"," ",$_FavRenAdd_RevTitle); 
$_FavRenAdd_RevTitle = gsub( "<"," ",$_FavRenAdd_RevTitle); 
$_FavRenAdd_RevTitle = gsub( ">"," ",$_FavRenAdd_RevTitle); 
$_FavRenAdd_RevTitle = gsub( "/"," ",$_FavRenAdd_RevTitle); 
$_FavRenAdd_RevTitle = gsub( "|"," ",$_FavRenAdd_RevTitle); 
$_FavRenAdd_RevTitle = gsub( "\\","",$_FavRenAdd_RevTitle);
$_FavRenAdd_Title = gsub( "\"","^",$_FavRenAdd_RevTitle);
}

_FavRenAdd_Duplicates_loop{
$_FavRenAdd_Exists=readfile($_FavRenAdd_PathName);
$_FavRenAdd_Exists=1.$_FavRenAdd_Exists ;
$_FavRenAdd_Len2=length($_FavRenAdd_Exists);
$_FavRenAdd_Len2 == 1 ? $_FavRenAdd_Ext_Interger=0 : &_FavRenAdd_Extend;
}

_FavRenAdd_Extend{
$_FavRenAdd_Wrk_Int = $_FavRenAdd_Ext_Interger - 1 ;
$_FavRenAdd_Ext_Interger == 1 ? $_FavRenAdd_PathName = gsub(".url" , "[".$_FavRenAdd_Ext_Interger."].url",$_FavRenAdd_PathName):0;
$_FavRenAdd_Ext_Interger > 1 ? $_FavRenAdd_PathName = gsub("[".$_FavRenAdd_Wrk_Int."].url" , "[".$_FavRenAdd_Ext_Interger."].url" , $_FavRenAdd_PathName):0;
$_FavRenAdd_Ext_Interger = $_FavRenAdd_Ext_Interger + 1 ;
}

_FavRenAdd_RnameTrue_loop{
$_FavRenAdd_SubFolder=promptforfolder(_("Specify where to add the new shortcut. Select your Favorites folder or one of its subfolders:"),$_FavRenAdd_FavFolder);
$_FavRenAdd_SubFolder=$_FavRenAdd_SubFolder=="" ? "X" : index($_FavRenAdd_SubFolder,$_FavRenAdd_FavFolder) == 0 ? substr($_FavRenAdd_SubFolder,length($_FavRenAdd_FavFolder)+1) : "?";
}

_FavRenAdd_RenameAdd{
$_FavRenAdd_CurrTitle = $TITLE;
$_FavRenAdd_CurURL = $URL;
$_FavRenAdd_value=prompt($_FavRenAdd_CurrTitle,_("Rename the Favorite Title here"),$_FavRenAdd_CurrTitle);
###  cancel from prompt will return a length of zero to which we add one
$_FavRenAdd_value = 1.$_FavRenAdd_value;
$_FavRenAdd_Len=length($_FavRenAdd_value);
###  if the length is 1 cancelled was pressed on the prompt box
$_FavRenAdd_Len == 1 ? 0 :&_FavRenAdd_RnameTrue ;
}

_FavRenAdd_ModMenu{
### add another option to Favorites menu if favorites plugin is active
$kFavorites=="true"?setmenu("F&avorites",macro,_("&Rename-Add"),_FavRenAdd_RenameAdd,1):0;

### show in Document Popup ;
$kFavorites=="true"?setmenu("DocumentSave",macro,_("&Rename-Add to Favorites"),_FavRenAdd_RenameAdd,1):0;
}

_FavRenAdd_GetPath{
### FavRenAdd.js is supposed to be located in the same folder as FavRenAdd.kmm (this file).
### If it isn't, Windows Script Host will notify the user.
$_FavRenAdd_Data=readfile(getfolder(MacroFolder)."\\FavRenAdd.kmm");
$_FavRenAdd_Path=getfolder($_FavRenAdd_Data==""?UserMacroFolder:MacroFolder)."\\FavRenAdd.js";
}

$OnStartup=$OnStartup."_FavRenAdd_GetPath;";
$OnInit=$OnInit."_FavRenAdd_ModMenu;";
$macroModules=$macroModules."FavRenAdd;";


Options: ReplyQuote
Re: Name to save an IE fav
Posted by: Rodger
Date: September 18, 2008 11:56PM

Hi thanks,

I have changed the lines

_FavRenAdd_RunScript{
exec("wscript.exe \"".$_FavRenAdd_Path."\" 1 \"".$_FavRenAdd_PathName."\"");
exec("wscript.exe \"".$_FavRenAdd_Path."\" 2 \"".$_FavRenAdd_CurURL."\"");
exec("wscript.exe \"".$_FavRenAdd_Path."\" 3 \""execute"\"") ;
}

with

_FavRenAdd_RunScript{
$_FavRenAdd_Execute = "execute" ;
exec("wscript.exe \"".$_FavRenAdd_Path."\" 1 \"".$_FavRenAdd_PathName."\"");
exec("wscript.exe \"".$_FavRenAdd_Path."\" 2 \"".$_FavRenAdd_CurURL."\"");
exec("wscript.exe \"".$_FavRenAdd_Path."\" 3 \"".$_FavRenAdd_Execute."\"") ;
}

And now it works perfect !!!

Thanks

Options: ReplyQuote
Re: Name to save an IE fav
Posted by: Rodger
Date: January 07, 2009 12:01AM

Hello,
why are links which I can save limited on "$_fmax=258" characters???

Options: ReplyQuote
Re: Name to save an IE fav
Posted by: JamesD
Date: January 07, 2009 01:21AM

There is a limit on how many characters can be passed using the exec statement in the macro language. Some site names and some site URLs have very long names. FavRenAdd can help by allowing a shorter name for the site but it cannot change the URL.

One version of FavRenAdd does bypass this limit but the method used will not adapt to languages that require UTF-8.

Options: ReplyQuote
Re: Name to save an IE fav
Posted by: siria
Date: December 31, 2009 07:45AM

Finally I've figured out the reason, why FavRenAdd never worked for me!! It can easily be reproduced, and for a change, win98 is innocent grinning smiley

Since I'm using KM for a couple years already, my favorites folder has always been in the prefs! But unlike the folders in the registry, as a pref it has a \ at the end. This difference is not expected by the macro and causes the bug. A little alert-test shows that the first character of the subfolder is missing.

On the other hand, KM insists on that \, or a click on the Favorites-Menu can't open that folder. (Other folders in the pref also have a backslash, as can be seen when typing "dir" in about:config)
Since I happen to use the same favorite folder as IE, the "cure" is ridiculously simple:
Removing that pref, that's all tongue sticking out smiley

But it would be a nice twist, to be able to use different folders for different profiles, e.g. for a portable browser. This is fully supported by the favorites.dll, except that it can't rename-add tongue sticking out smiley
And I really love now kko's old macro to open the original 'IE-link-adder' ("FavoritesIE_Add" currently), but of course this will never allow either to use different favorite folders for different browser profiles (or so I suppose, since IE doesn't allow it, but perhaps a macro with some heavy programming still could, no idea)

One last weird thing, although FavRenAdd is actually working now (with the pref removed), the error console still shows five errors at browser startup, all in the last line of: _FavRenAdd_RunScript
exec("wscript.exe \"".$_FavRenAdd_Path."\" 3 \""execute"\"") ;
console: ) expected but found <name>



Edited 1 time(s). Last edit at 12/31/2009 08:10AM by siria.

Options: ReplyQuote
Re: Name to save an IE fav
Posted by: desga2
Date: January 01, 2010 02:16AM

I think the line code corrected must be:
exec("wscript.exe \"".$_FavRenAdd_Path."\" 3 \"execute\"");

K-Meleon in Spanish

Options: ReplyQuote
Re: Name to save an IE fav
Posted by: siria
Date: January 01, 2010 03:04AM

Quote
JamesD
Small steps first. There were too many pairs of quotes around "execute" in line 41. Replace line 41 with the following code.
exec("wscript.exe \"".$_FavRenAdd_Path."\" 3 \"execute\"") ;

Okay, did that and it seems to work now, at any rate no error! smiling smiley
I don't get it really, had tried it before too when desga had posted and there it didn't help - or so I thought... *completelyconfused*

But after taking a closer look in your .kmm, there was a line with substracting, that was exactly what I needed, a syntax to substract cool smiley And after studying also the macro help for substracting, it looked like it could work... Well, as usual not right away, but after a bunch of trials and restarts. Now when you add the bold line, the external favorites from the directory-pref work fine (must have "\" at end), and after deleting that pref again, the "normal" favorites immediately are back ;-)

_FavRenAdd_RnameTrue{
#### look two places for the favorites directory
$_FavRenAdd_FavFolder=getpref(STRING,"kmeleon.plugins.favorites.directory");
$_FavRenAdd_FavFolder=substr($_FavRenAdd_FavFolder,0,length($_FavRenAdd_FavFolder)-1);
$_FavRenAdd_FavFolder==""?$_FavRenAdd_FavFolder=readreg("HKCU",....

I think that has probably already worked for years with the native Add-command, but the lack of renaming and 'foldering' is just way too bothersome, makes it nearly unusable :-(

But this is cool now! One can put a favorites folder into the KM profile and put the whole thing on a USB-stick, then when working on a foreign computer, only needs to adjust the path in the pref (d:, e:, etc.) and restart. And then can work with his own favorites. Or can use different favorites folders in different profiles, e.g. job and private or such ;-)

Edit: There is one situation that I don't get: When switching back to "default folder and empty pref", restarting, then switching to "default folder but written in pref", restarting: Then it gets somehow caught in a subfolder loop... But after choosing an external path again, restart, back to §default path but also in pref§ - then it seems to work again....



Edited 7 time(s). Last edit at 01/01/2010 08:30AM by siria.

Options: ReplyQuote
Re: Name to save an IE fav
Posted by: JamesD
Date: January 01, 2010 09:19PM

@ siria

Good work. I see that I have some catching up to do.

Am I correct in that you are changing the pref by hand and not with a macro?

I am having a little problem with my computer so that is slowing me down.

Options: ReplyQuote
Re: Name to save an IE fav
Posted by: JamesD
Date: January 02, 2010 09:23AM

@ siria

I have created a macro which allows switching between the default location and an alternate location for the "Favorites" folder. FavRenAdd will work with it, but both versions, ASCII and international, require your modification noted below.

Quote
siria
_FavRenAdd_RnameTrue{
#### look two places for the favorites directory
$_FavRenAdd_FavFolder=getpref(STRING,"kmeleon.plugins.favorites.directory");
$_FavRenAdd_FavFolder=substr($_FavRenAdd_FavFolder,0,length($_FavRenAdd_FavFolder)-1);
$_FavRenAdd_FavFolder==""?$_FavRenAdd_FavFolder=readreg("HKCU",....

Adding the substr to remove the trailing "\" when the value comes from the pref is the only change needed to FavRenAdd. Thank you very much for your research and work on this.

The following macro allows a user to switch locations. It does require a KM restart because the location is appearently only read at startup.

I will get the updated FavRenAdd code to the MacroLibrary soon.

FavAltDir.kmm

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- FavAltDir.kmm
# ---------- For changing the pref which holds the location of "Favorites".
#----------- Note the "windows standard" location does not use the pref. 
#
# Dependencies        : KM 1.5.x or later, main.kmm
# Resources           : ie favorites plugin  
# Preferences         : "kmeleon.plugins.favorites.directory"
# Version             : 1.0   2010-01-01  
# --------------------------------------------------------------------------------

_FavAltDir_Action {
$_FavAltDir_AltDir =  getpref(STRING, "kmeleon.plugins.favorites.directory");
if ( length($_FavAltDir_AltDir) == 0) { $_FavAltDir_AltDir = "DEFAULT"; }
$_FavAltDir_Change = confirm( $_FavAltDir_AltDir, "Change from location shown?  Cancel resets default", YESNOCANCEL, QUESTION );
#alert($_FavAltDir_Change, "$_FavAltDir_Change DEBUG", INFO);
if ($_FavAltDir_Change == "YES") { 
	$_FavAltDir_AltDir = promptforfolder(_("Select an alternate Favorites folder"), getfolder(ProfileFolder));
	$_FavAltDir_AltDir =  $_FavAltDir_AltDir."\\" ;
	setpref(STRING, "kmeleon.plugins.favorites.directory", $_FavAltDir_AltDir);
	alert("K-Meleon must be restarted\n\nfor the change to\n\n".$_FavAltDir_AltDir."\n\n to take effect.", "RESTART REQUIRED", EXCLAIM) ;
	}
if ($_FavAltDir_Change == 0) {
	#alert($_FavAltDir_Change, "Running delpref DEBUG", INFO);
	delpref("kmeleon.plugins.favorites.directory");
	alert("K-Meleon must be restarted\n\nfor the change to\n\nDEFAULT\n\n to take effect.", "RESTART REQUIRED", EXCLAIM) ;
	}
}

_FavAltDir_BuildMenu {
	# add another option to Favorites menu
	setmenu("F&avorites",macro,"Alternate Directory",_FavAltDir_Action,3);
}



## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$OnInit=$OnInit."_FavAltDir_BuildMenu;";
$macroModules=$macroModules."FavAltDir;";



Edited 1 time(s). Last edit at 01/02/2010 09:27AM by JamesD.

Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: siria
Date: January 02, 2010 07:59PM

Great, very cool!! grinning smiley
The only thing that I'd suggest to add is a note in the popup box for the default location, something like "DEFAULT = Share favorites with IE" or "Use favorites folder of IE" or such. Just doubting that many people out there would suspect that the location of a folder could have such important consequences, I sure wouldn't...

As a side note, I'm still riddling why something as fundamental as favrenadd isn't in the kmext collection, or perhaps I just overlooked it? Must admit I've lost a little overview in the tons of macros meanwhile <blush> And seeing that FavRenAdd is still updated occasionally, an additional link to the wiki-page from kmext would definitely make sense...
Thinking about it, this thread here would also be easier to be found in the extensions forum ;-P And for the same reason perhaps creating an own post for FavAltDir *nagnagnag* sorry grinning smiley

Ah, almost forgot, one more thing, LOL! Have no idea about the reasons for different versions, but seeing that the international version works fine on an ancient german win98-machine (which has lots of updates admittedly), it makes me wonder if pure "english" computers wouldn't be able to use it too, if a separate branch for the ascii-version is really needed?

Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: JamesD
Date: January 03, 2010 03:29AM

@ siria

I agree that FavRenAdd should be in the KM Extentions. The thing is that I have never done an extension. I am used to the "MacroLibrary" http://kmeleon.sourceforge.net/wiki/KmmFavRenAdd being the share point for these types of things.

A bit of history will perhaps help here. FavRenAdd (ASCII) was my first big macro. It is old. I had to ask for and was given quite a bit of help during its creation. The first version went into the MacroLibrary in August of 2007. Right away there were user problems because of limit on the length of the string passed in the "exec" statement. I updated to the method currently in use for the ASCII version. Not having any language skills except English, I did not know that method would not work for users requiring UTF-8. Later I created the international version which passes the strings in a different method. There has been no updates on the code until the change you found to make alternate locations work.

If we are to create an extension for FavRenAdd then I think it should also include FavAltDir.kmm for alternate locations, and Reload_IE_Fav.kmm for reloading the favorites view.

I have, as you suggested, added "[Share favorites with I.E.]" in the two places where only "Default" was used before. Very good suggestion, thank you.

I think you might have the more complete code for Reload_IE_Fav.kmm. Did I not see some code in your post that automatically selects between cmd.exe and command.com? Do we need desga2 to sign off on using Reload_IE_Fav in the extension? I am sure he would not mind, but I would like to ask anyway.

I have looked for some solution to the flashing of the cmd/command window, but I have not found a way to run it completely in the background. In cmd, one can right click on the bar at the top of window and get to the properties where the color and position can be changed. I do not know if that is available in command. Perhaps you could check. This not something a program could do.

Another thing is our target audience. If we limit ourselves to users of KM 1.5.x then no change is necessary. However if we wish to allow users of older versions, then I would have to change the "if" statements in FavAltDir.kmm and use instead the old conditional statement. Also the "macroinfo" statements in FavAltDir.kmm and Reload_IE_Fav.kmm would have to be removed.

Updated macro
FavAltDir.kmm

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- FavAltDir.kmm
# ---------- For changing the pref which holds the location of "Favorites".
#----------- Note the "windows standard" location does not use the pref. 
#
# Dependencies        : KM 1.5.x or later, main.kmm
# Resources           : ie favorites plugin  
# Preferences         : "kmeleon.plugins.favorites.directory"
# Version             : 1.1   2010-01-02
# Author			  : JamesD  
# --------------------------------------------------------------------------------

_FavAltDir_Action {
macroinfo="Change location of Favorites folder";
$_FavAltDir_AltDir =  getpref(STRING, "kmeleon.plugins.favorites.directory");
if ( length($_FavAltDir_AltDir) == 0) { $_FavAltDir_AltDir = "DEFAULT [Share favorites with I.E.]"; }
$_FavAltDir_Change = confirm( $_FavAltDir_AltDir, "Change from location shown?  Cancel resets default", YESNOCANCEL, QUESTION );
if ($_FavAltDir_Change == "YES") { 
	$_FavAltDir_AltDir = promptforfolder(_("Select an alternate Favorites folder"), getfolder(ProfileFolder));
	$_FavAltDir_AltDir =  $_FavAltDir_AltDir."\\" ;
	setpref(STRING, "kmeleon.plugins.favorites.directory", $_FavAltDir_AltDir);
	alert("K-Meleon must be restarted\n\nfor the change to\n\n".$_FavAltDir_AltDir."\n\n to take effect.", "RESTART REQUIRED", EXCLAIM) ;
	}
if ($_FavAltDir_Change == 0) {
	delpref("kmeleon.plugins.favorites.directory");
	alert("K-Meleon must be restarted\n\nfor the change to\n\nDEFAULT [Share favorites with I.E.]\n\n to take effect.", "RESTART REQUIRED", EXCLAIM) ;
	}
}

_FavAltDir_BuildMenu {
	# add another option to Favorites menu
	setmenu("F&avorites",macro,"Alternate Directory",_FavAltDir_Action,3);
}

## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$OnInit=$OnInit."_FavAltDir_BuildMenu;";
$macroModules=$macroModules."FavAltDir;";


Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: jsnj
Date: January 03, 2010 04:38AM

Quote
JamesD
I agree that FavRenAdd should be in the KM Extentions. The thing is that I have never done an extension. I am used to the "MacroLibrary" [kmeleon.sourceforge.net] being the share point for these types of things.

It's not hard:

1) Place the macro module (kmm file) and in this case the js file in a new empty folder named macros.

2) Use the following as a template to create a new FavRenAdd.ini file for the extension manager. It lists the files you created directly beneath the folders that they will be placed in upon installation. Additionally, write a brief description about your extension underneath [info].

[macros]
1=FavRenAdd.kmm
2=FavRenAdd.js
[chrome]

[components]

[kplugins]

[plugins]

[pref]

[locales]

[tools]

[scripts]

[skins]

[stylesheets]

[profile]

[root]

[strings]

[info]
1=Allows a user to change the name and choose which folder to add a new favorite to.

3) Place the ini file in a new empty folder named kmextensions.

4) Zip or 7z the new folders (macros & kmextensions) and add to the K-Meleon Extensions forum. disrupted will them come and add your new extension to its applicable section @ K-Meleon Extensions Central smiling smiley

Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: JamesD
Date: January 03, 2010 05:22AM

@ jsnj

Thanks for the information. It does not look so very hard. Once I hear back from siria and desga2, I will try that.

Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: siria
Date: January 03, 2010 07:30AM

Very nice now with the info at the DEFAULT smiling smiley

Quote
JamesD
I updated to the method currently in use for the ASCII version. Not having any language skills except English, I did not know that method would not work for users requiring UTF-8. Later I created the international version which passes the strings in a different method.

Well, I understand it has historical reasons, but if the international version works for you too, I'm not sure if the ascii-version is really still needed as a separate branch...? But just wild guessing, am completely clueless there ;-P

Yep, IMHO it would certainly make a lot of sense to group those macros together smiling smiley Disrupted can probably tell whether it's possible with his installer to use multiple macros. So far I always assumed there's 1 kmm per macro/extension/addon cool smiley but that may not be necessary at all. Alternatively one could "melt" them all into 1 kmm, but seeing how complex it already is, gets perhaps too confusing... Then again, Reload and AltDir are rather short and don't need any additional files, so why not. Frankly, after glancing over the bookmarks-section in kmext and the macros-wiki, there doesn't seem such a "flood" for Favorites macros, actually just about nothing, so IMHO there's not much need to have Reload and AltDir as separate macros. As for the one I've picked from kko, for the native IE-adder, I'm already going to integrate the refresh function too (just for simplicity), but will make sure it's hidden if Reload_IE_Fav is already present, or if you integrate that command into FavRenAdd, I'd simply add a condition for that one too, no prob smiling smiley

If you find something useful of my little modifications in the Reloader, I'd of course be happy if you use it smiling smiley Must admit the first lines are more complicated in my version, but that was for the reason that I wanted to have a variable if the folder is in the default location or not. Because I modified this macro especially for the native IE-adder, and that one can't seem to use any other folder (so far), so in this case I wanted to hide the refresh-button too. Perhaps for FavRenAdd the original lines are easier, no idea.

On NT/XP that cmd-window flashes too?? Oh... And there I assumed that 'new' command-line parameter would really hide it, oops ;-)

Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: jsnj
Date: January 03, 2010 07:55AM

Quote
siria
Disrupted can probably tell whether it's possible with his installer to use multiple macros. So far I always assumed there's 1 kmm per macro/extension/addon cool smiley but that may not be necessary at all.

You can have as many separate macros modules as you want in the extension installer/manager. Just specify the separate *.kmm files underneath [macros] in the ini file as indicated above in my last post.



Edited 1 time(s). Last edit at 01/03/2010 07:58AM by jsnj.

Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: siria
Date: January 03, 2010 08:29AM

Ah okay, so that wouldn't be a problem smiling smiley

On a side note, I just dabbled a bit with the macro library page in the wiki (added a few lines at the bottom cool smiley), and discovered the entry for FavRenAdd there goes as follows:

FavRenAdd 2007-08-20 - Rename Internet Shortcuts (*.url) to Favorites.

Errr.. Guess could use a little update too, like current update-date, and a word about choosing folders and such ;-) Especially, if I didn't know better, "renaming internet shortcuts to favorites" would leave me rather confused...

Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: JamesD
Date: January 03, 2010 08:44AM

The only reason I use the ASCII version is that it allows much longer URL's to be added. The international version still has a string length constraint.

I will have a look at combining all the macros into one. I also need to update the description. I think I will leave the "if" and "macroinfo" statements. Most people should be on a modern version of KM.

Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: JamesD
Date: January 03, 2010 09:44AM

I am working on combining the three macros and I have some code I don't understand. There seems to be a difference in the pref/registry items used to find the current favorites folder. I will list the code that I am working from. Hope someone can point me to correct set of pref/registry items. Where does "kmeleon.plugins.favorites.menuFolder" come from? I would like to use the same method to find the folder in both rename_add and reload.

_FavRenAdd_Reload {
macroinfo="Reload Favorites list";
###  from original favrenadd
$_FavRenAdd_FavFolder=getpref(STRING,"kmeleon.plugins.favorites.directory");
$_FavRenAdd_FavFolder=substr($_FavRenAdd_FavFolder,0,length($_FavRenAdd_FavFolder)-1);
$_FavRenAdd_FavFolder==""?$_FavRenAdd_FavFolder=readreg("HKCU","Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Favorites"):0;
$_FavRenAdd_FavFolder==""?$_FavRenAdd_FavFolder=readreg("HKLM","Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Favorites"):0;

###  from reload_ie_fav
$_favdir=readreg(HKCU,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\\Favorites");
$_favdir==""?$_favdir=readreg(HKCU,"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Favorites"):0;
$_favmenu=getpref(STRING,"kmeleon.plugins.favorites.menuFolder");
$_favmenu==""?0:$_favdir=$_favdir . "\\" . $_favmenu;

###
plugin(favorites,"AddLink");

###  auto select code from siria
$_FavRenAdd_winver=readreg(HKLM,"Software\\Microsoft\\Windows\\CurrentVersion\\VersionNumber");
$_FavRenAdd_winver=""? $_FavRenAdd_winfam="winNT" : $FavRenAdd__winfam="win9x" ;
$_FavRenAdd_winfam=="winNT" ? exec("cmd.exe /q /c del \"".$_favdir."\\.url\"") : exec("command.com /c del \"".$_favdir."\\.url\"");
}


Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: desga2
Date: January 03, 2010 08:29PM

Quote
JamesD
I think you might have the more complete code for Reload_IE_Fav.kmm. Did I not see some code in your post that automatically selects between cmd.exe and command.com? Do we need desga2 to sign off on using Reload_IE_Fav in the extension? I am sure he would not mind, but I would like to ask anyway.

@ JamesD and siria;
No problem for me if you like use, change/modify or add my Reload_IE_Fav macro code to some extension, it's Open Source. smiling smiley

About cmd flashing you can use an AutoIt tool to delete the favorites dummy files, by this way you can avoid cmd flashing.

But I think that really the most easy is modify the Favorites kplugin code to add a Reload function in it. This only take 5 minutes and is the better solution.
I can add the needed code to sources but I can't build the kplugin because I haven't the needed environment.

K-Meleon in Spanish

Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: siria
Date: January 03, 2010 11:47PM

Okay, so I'll take it, thanks guys.
That's really what I'm thinking all those weeks, brooding endlessly over (for me) complicated macro stuff, while each day the new KM version can appear and have all that stuff already included! Basically simple functions which may just take a couple minutes for a developer, but weeks of struggling for us tongue sticking out smiley

Regarding the reload path: Quoting myself from the other "reloading" thread

Quote
siria
kmeleon.plugins.favorites.directory : Full path, alas with \ at the end
kmeleon.plugins.favorites.newitemFolder : Only folder name, no path, no \ at end
kmeleon.plugins.favorites.menuFolder : dto.

The menu-folder is the one shown in the toolbar, if enabled, no use in refreshing.

The newitem-folder is where new faves are tossed in by the dll. This pref seems to vanish, if none is set.

The directory-folder (with full path) has priority over Registry, if it exists. Secret tip today, not mentioned in menus or configs otherwise (unless I've overlooked it).

Quote
siria
if the path would be loaded on setup only, then a user can change his newitems folder and forget to restart the browser, and the macro still works.

-----------------------------------------------------
Okay, it's tedious tongue sticking out smiley but I've now checked myself those endless reg-paths
on win98se, xp-home and vista-business.

windows family in registry:
----------
HKLM,"Software\\Microsoft\[b]Windows[/b]\\CurrentVersion\\VersionNumber": "4.10.2222"
HKLM,"Software\\Microsoft\[b]WindowsNT[/b]\\CurrentVersion": -- (no keys with any version)
----------
HKLM,"Software\\Microsoft\[b]Windows[/b]\\CurrentVersion": -- (no keys with any version)
HKLM,"Software\\Microsoft\[b]WindowsNT[/b]\\CurrentVersion\\CurrentVersion": "5.1"/"6.0"
----------

Favorites path in registry:

Whether user-set or default, the path is always in "Shell Folders", and in clear text! smiling smiley
HKCU,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Favorites": "c:\....\Favorites"

In the "USER Shell Folders" is always the identical path as above, but in XP and Vista with variables:
%userprofile%\....\Favorites
Except in Windows98, there "User Shell Folders" contains only the customized entries, others are simply missing.

Since the favorites are always in "HKCU....Shell Folders", if the user changed anything or not, I'd just stick with that one...
Other paths don't make too much sense, e.g.:
In HKLM\...\User shell\Common Favorites: %alluserprofiles%\....


Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: siria
Date: January 03, 2010 11:57PM

Quote
JamesD
_FavRenAdd_Reload {
macroinfo="Reload Favorites list";
###  from original favrenadd
$_FavRenAdd_FavFolder=getpref(STRING,"kmeleon.plugins.favorites.directory");
$_FavRenAdd_FavFolder=substr($_FavRenAdd_FavFolder,0,length($_FavRenAdd_FavFolder)-1);
$_FavRenAdd_FavFolder==""?$_FavRenAdd_FavFolder=readreg("HKCU","Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Favorites"):0;
$_FavRenAdd_FavFolder==""?$_FavRenAdd_FavFolder=readreg("HKLM","Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Favorites"):0;

###  from reload_ie_fav
$_favdir=readreg(HKCU,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\\Favorites");
$_favdir==""?$_favdir=readreg(HKCU,"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Favorites"):0;
$_favmenu=getpref(STRING,"kmeleon.plugins.favorites.menuFolder");
$_favmenu==""?0:$_favdir=$_favdir . "\\" . $_favmenu;

###
plugin(favorites,"AddLink");

###  auto select code from siria
$_FavRenAdd_winver=readreg(HKLM,"Software\\Microsoft\\Windows\\CurrentVersion\\VersionNumber");
$_FavRenAdd_winver=""? $_FavRenAdd_winfam="winNT" : $FavRenAdd__winfam="win9x" ;
$_FavRenAdd_winfam=="winNT" ? exec("cmd.exe /q /c del \"".$_favdir."\\.url\"") : exec("command.com /c del \"".$_favdir."\\.url\"");
}

IMO the red lines are not needed...
The blue lines deal with the menu folder, but the newitems folder contains the dummy url...
The green line is missing a "=" smiling smiley

Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: JamesD
Date: January 04, 2010 02:46AM

@ siria

I hope I have it complete now. Thanks for the info on prefs and registry keys. I have found that "newitem" is needed but not "menufolder". I have dropped the un-needed registry key.

One observation I would make is that if the user uses the preferences panels to have a new items folder or a menu folder within their Favorites folder then it is necessary to have the folders also exist in the alternate Favorites location.

I don't know if we should keep the name FavRenAdd for the combined macro or not. For now I have changed the name. In any case here are the new combined macro and js files for testing.

FRA_combo.kmm

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- FRA_combo.kmm
# ---------- K-Meleon Macro Language Rename/Add page to Favorites ---------------
# ---------- also select alternate directory for Favorites and reload Favorites
#
# Dependencies        : main.kmm, Favorites plugin active, FRA_combo.js
# 		        KM version 1.5.x or higher, JScript, Windows Scripting Host
# Resources           : Registry keys "HKCU\\Software\\KMELEON\\FRA_combo\\URLname"
#                                 and "HKCU\\Software\\KMELEON\\FRA_combo\\URLdisc"
# Preferences         : "kmeleon.plugins.favorites.directory"
#  		      : "kmeleon.plugins.favorites.newitemFolder"
# Version             : 4.0.0   2010-01-03
# Authors	      : JamesD, desga2, siria, jsnj
# --------------------------------------------------------------------------------

_FRA_combo_RnameTrue {
$_FRA_combo_FavFolder=getpref(STRING,"kmeleon.plugins.favorites.directory");
$_FRA_combo_FavFolder=substr($_FRA_combo_FavFolder,0,length($_FRA_combo_FavFolder)-1);
$_FRA_combo_FavFolder==""?$_FRA_combo_FavFolder=readreg("HKCU","Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Favorites"):0;
$_FRA_combo_SubFolder="?";   while($_FRA_combo_SubFolder=="?") &_FRA_combo_RnameTrue_loop;
$_FRA_combo_Title = substr($_FRA_combo_value,1);
macros(_FRA_combo_Sanitize_Title) ;                                
$_FRA_combo_PathName = $_FRA_combo_FavFolder."\\".$_FRA_combo_SubFolder."\\".$_FRA_combo_Title.".url" ;
$_FRA_combo_Ext_Interger = 1;
while ($_FRA_combo_Ext_Interger > 0 ) &_FRA_combo_Duplicates_loop ;
$_fmax=258 ; $_FRA_combo_ExVal = 0 ;
$_fcmd = "(wscript.exe \"".$_FRA_combo_Path."\" 1 \"".$_FRA_combo_PathName.")" ;
length($_fcmd)>$_fmax ? &_FRA_combo_Error1:0;
$_fcmd = "(wscript.exe \"".$_FRA_combo_Path."\" 2 \"".$_FRA_combo_CurURL.")" ;
length($_fcmd)>$_fmax ? &_FRA_combo_Error2:0;
$_FRA_combo_ExVal < 2 ? &_FRA_combo_RunScript:0;
}

_FRA_combo_RunScript {
exec("wscript.exe \"".$_FRA_combo_Path."\" 1 \"".$_FRA_combo_PathName."\"");
exec("wscript.exe \"".$_FRA_combo_Path."\" 2 \"".$_FRA_combo_CurURL."\"");
exec("wscript.exe \"".$_FRA_combo_Path."\" 3 \"execute\"") ;
}

_FRA_combo_Error1 {
alert(_("Unable to create favorite - data too long!  Line length, "). length($_fcmd). _(" and line are displayed\n\n"). $_fcmd, _("String length too long!"), EXCLAIM) ;
$_FRA_combo_ExVal = $_FRA_combo_ExVal + 2;
}

_FRA_combo_Error2 {
alert(_("Unable to create favorite - data too long!  Line length, "). length($_fcmd). _(" and line are displayed\n\n"). $_fcmd, _("String length too long!"), EXCLAIM) ;
$_FRA_combo_ExVal = $_FRA_combo_ExVal + 3;
}

_FRA_combo_Sanitize_Title {
$_FRA_combo_RevTitle = gsub( "?"," ",$_FRA_combo_Title); 
$_FRA_combo_RevTitle = gsub( ":"," ",$_FRA_combo_RevTitle); 
$_FRA_combo_RevTitle = gsub( "*"," ",$_FRA_combo_RevTitle); 
$_FRA_combo_RevTitle = gsub( "<"," ",$_FRA_combo_RevTitle); 
$_FRA_combo_RevTitle = gsub( ">"," ",$_FRA_combo_RevTitle); 
$_FRA_combo_RevTitle = gsub( "/"," ",$_FRA_combo_RevTitle); 
$_FRA_combo_RevTitle = gsub( "|"," ",$_FRA_combo_RevTitle); 
$_FRA_combo_RevTitle = gsub( "\\","",$_FRA_combo_RevTitle);
$_FRA_combo_Title = gsub( "\"","^",$_FRA_combo_RevTitle);
}

_FRA_combo_Duplicates_loop {
$_FRA_combo_Exists=readfile($_FRA_combo_PathName);
$_FRA_combo_Exists=1.$_FRA_combo_Exists ;
$_FRA_combo_Len2=length($_FRA_combo_Exists);
$_FRA_combo_Len2 == 1 ? $_FRA_combo_Ext_Interger=0 : &_FRA_combo_Extend;
}

_FRA_combo_Extend {
$_FRA_combo_Wrk_Int = $_FRA_combo_Ext_Interger - 1 ;
$_FRA_combo_Ext_Interger == 1 ? $_FRA_combo_PathName = gsub(".url" , "[".$_FRA_combo_Ext_Interger."].url",$_FRA_combo_PathName):0;
$_FRA_combo_Ext_Interger > 1 ? $_FRA_combo_PathName = gsub("[".$_FRA_combo_Wrk_Int."].url" , "[".$_FRA_combo_Ext_Interger."].url" , $_FRA_combo_PathName):0;
$_FRA_combo_Ext_Interger = $_FRA_combo_Ext_Interger + 1 ;
}

_FRA_combo_RnameTrue_loop {
$_FRA_combo_SubFolder=promptforfolder(_("Specify where to add the new shortcut. Select your Favorites folder or one of its subfolders:"),$_FRA_combo_FavFolder);
$_FRA_combo_SubFolder=$_FRA_combo_SubFolder=="" ? "" : index($_FRA_combo_SubFolder,$_FRA_combo_FavFolder) == 0 ? substr($_FRA_combo_SubFolder,length($_FRA_combo_FavFolder)+1) : "?";
}

_FRA_combo_RenameAdd {
macroinfo = _("Edit favorite's title during the add process and allow for selection of folder.");
$_FRA_combo_CurrTitle = $TITLE;
$_FRA_combo_CurURL = $URL;
$_FRA_combo_value=prompt($_FRA_combo_CurrTitle,_("Rename the Favorite Title here"),$_FRA_combo_CurrTitle);
###  cancel from prompt will return a length of zero to which we add one
$_FRA_combo_value = 1.$_FRA_combo_value;
$_FRA_combo_Len=length($_FRA_combo_value);
###  if the length is 1 cancelled was pressed on the prompt box
$_FRA_combo_Len == 1 ? &_FRA_combo_Cancelled :&_FRA_combo_RnameTrue ;
}

_FRA_combo_Cancelled {
$FRA_combo_Button=confirm(_("Did you mean to cancel?"),_("Affirm cancel") ,YESNO,QUESTION);
$FRA_combo_Button == "YES" ? 0 : &_FRA_combo_RenameAdd ;
}

_FRA_combo_Reload {
macroinfo="Reload Favorites list";
$_FRA_combo_FavFolder=getpref(STRING,"kmeleon.plugins.favorites.directory");
$_FRA_combo_FavFolder=substr($_FRA_combo_FavFolder,0,length($_FRA_combo_FavFolder)-1);
$_FRA_combo_FavFolder==""?$_FRA_combo_FavFolder=readreg("HKCU","Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Favorites"):0;
$_FRA_combo_NIF=getpref(STRING,"kmeleon.plugins.favorites.newitemFolder");
$_FRA_combo_NIF==""?0:$_FRA_combo_FavFolder=$_FRA_combo_FavFolder . "\\" . $_FRA_combo_NIF;
plugin(favorites,"AddLink");
$_FRA_combo_winver=readreg(HKLM,"Software\\Microsoft\\Windows\\CurrentVersion\\VersionNumber");
$_FRA_combo_winver==""? $_FRA_combo_winfam="winNT" : $FRA_combo__winfam="win9x" ;
$_FRA_combo_winfam=="winNT" ? exec("cmd.exe /q /c del \"".$_FRA_combo_FavFolder."\\.url\"") : exec("command.com /c del \"".$_FRA_combo_FavFolder."\\.url\"");
}

_FRA_combo_AltDirRun {
macroinfo="Change location of Favorites folder";
$_FRA_combo_AltDir =  getpref(STRING, "kmeleon.plugins.favorites.directory");
if ( length($_FRA_combo_AltDir) == 0) { $_FRA_combo_AltDir = "DEFAULT [Share favorites with I.E.]"; }
$_FRA_combo_Change = confirm( $_FRA_combo_AltDir, "Change from location shown?  Cancel resets default", YESNOCANCEL, QUESTION );
if ($_FRA_combo_Change == "YES") { 
	$_FRA_combo_AltDir = promptforfolder(_("Select an alternate Favorites folder"), getfolder(ProfileFolder));
	$_FRA_combo_AltDir =  $_FRA_combo_AltDir."\\" ;
	setpref(STRING, "kmeleon.plugins.favorites.directory", $_FRA_combo_AltDir);
	alert("K-Meleon must be restarted\n\nfor the change to\n\n".$_FRA_combo_AltDir."\n\n to take effect.", "RESTART REQUIRED", EXCLAIM) ;
	}
if ($_FRA_combo_Change == 0) {
	delpref("kmeleon.plugins.favorites.directory");
	alert("K-Meleon must be restarted\n\nfor the change to\n\nDEFAULT [Share favorites with I.E.]\n\n to take effect.", "RESTART REQUIRED", EXCLAIM) ;
	}
}

_FRA_combo_ModMenu {
### add options to Favorites menu if favorites plugin is active
$kFavorites?setmenu("F&avorites",macro,_("&Rename-Add"),"_FRA_combo_RenameAdd",1):0;
$kFavorites?setmenu("F&avorites",macro,_("Reload"),"_FRA_combo_Reload",2):0;
$kFavorites?setmenu("F&avorites",macro,_("Alternate Directory"),"_FRA_combo_AltDirRun",3):0;
### show in Document Popup ;
$kFavorites=="true"?setmenu("DocumentSave",macro,_("&Rename-Add to Favorites"),_FRA_combo_RenameAdd,1):0;
}

_FRA_combo_GetPath{
### FRA_combo.js is supposed to be located in the same folder as FRA_combo.kmm (this file).
### If it isn't, Windows Script Host will notify the user.
$_FRA_combo_Data=readfile(getfolder(MacroFolder)."\\FRA_combo.kmm");
$_FRA_combo_Path=getfolder($_FRA_combo_Data==""?UserMacroFolder:MacroFolder)."\\FRA_combo.js";
}
## = = = = = = = = = = = = = = = = = = = = 
$OnStartup=$OnStartup."_FRA_combo_GetPath;";
$OnInit=$OnInit."_FRA_combo_ModMenu;";
$macroModules=$macroModules."FRA_combo;";

And the js code here.

FRA_combo.js

/* FRA_combo.js by JamesD, version  4.0  2010-01-03

   This script is a helper application for the K-Meleon Macro Module FRA_combo.kmm that
   enables you to rename a favorite, select a folder, and write the favorite to that folder.

   Windows Script Host 1.0 (or better) required!

   WSH is part of Microsoft Internet Explorer 5.0 and newer. Latest version of WSH is
   available at http://msdn.microsoft.com/scripting/
*/

if(WScript.Arguments.count()==2)
{
        var WshShell = new ActiveXObject("WScript.Shell")
        if (WScript.Arguments(0) == 1)
                {
                        WshShell.RegWrite ("HKCU\\Software\\KMELEON\\FRA_combo\\URLname", WScript.Arguments(1), "REG_SZ");
                }
        if (WScript.Arguments(0) == 2)
                {
                        WshShell.RegWrite ("HKCU\\Software\\KMELEON\\FRA_combo\\URLdisc", WScript.Arguments(1), "REG_SZ");
                }                
        if (WScript.Arguments(0) == 3)
                {
                        WScript.Sleep(1000);
                        var $_FRA_combo_PathName = WshShell.RegRead ("HKCU\\Software\\KMELEON\\FRA_combo\\URLname") ;
                        var $_FRA_combo_CurURL   = WshShell.RegRead ("HKCU\\Software\\KMELEON\\FRA_combo\\URLdisc") ;
                        var oShellLink = WshShell.CreateShortcut($_FRA_combo_PathName);
                        oShellLink.TargetPath = $_FRA_combo_CurURL;
                        oShellLink.Save();
                        WshShell.RegDelete ("HKCU\\Software\\KMELEON\\FRA_combo\\URLname") ;
                        WshShell.RegDelete ("HKCU\\Software\\KMELEON\\FRA_combo\\URLdisc") ;
                }                
}
else
{
objArgs = WScript.Arguments ;
WScript.Echo(WScript.Arguments.Count());
for (i=0; i<objArgs.length; i++)
{
    WScript.Echo(objArgs(i))
}
}



Edited 2 time(s). Last edit at 01/04/2010 02:49AM by JamesD.

Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: JamesD
Date: January 05, 2010 02:58AM

I have cleaned up the code some and added translate for text, _(). I have also started some work on Localizations. The translations are not complete. They came from FavRenAdd and the FRA_combo has much more text.

I have put the FRA_combo.7z file here.

http://dl.dropbox.com/u/1522294/FRA_combo.7z

Any help on Localizations will be appreciated.

Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: siria
Date: January 05, 2010 04:43AM

Like your style, looks very neat and clean smiling smiley And the "combo" grinning smiley Or perhaps simply FAV_combo... Then again, that would probably be too general for the variables... yeah not easy, sigh!
Btw, is it intentional that there's no FavRenAdd when right-clicking a link...? cool smiley

Alas don't have enough time the next days, so only took a very quick glance over the new macro, and made a little test. Hmm, something seems a little buggy, when I have a folder in the dir-pref, then click on "alternate", then cancel the new path, the dir-pref is not removed, but changed to "\"
Something I noted before: The newitems-folder should be set at browser start only, otherwise the Reload-macro takes a changed newitem-folder instantly, while the browser still throws the dummy-URL into the old folder, if the user forgets or can't restart instantly.

Regarding translation:
Not sure: What "DATA" are too long? URL? Title? Both? Would it perhaps be ok to just translate to "too many characters" or "line too long?" For the "string" below I'd prefer to just translate into "Favorite too long"...

My translation below is not 100% literally in a few lines, but IMHO sounds better in german that way - Guenter? Sonstwer? smiling smiley Noch kleine Anmerkung zu "Wollten Sie abbrechen?" - Irgendwie würd mir "Wirklich abbrechen?" besser gefallen, das "Sie" ist immer so steif... Aber ist natürlich Geschmacksache.

~~~~~~~~~~~~~~~~~~
Localizations
\locales\de-DE\FavRenAdd.kml (German/Deutsch)

? * * * Unable to create favorite - data too long! Line length,=Kann Favoriten nicht erzeugen - zu viele Zeichen! (Adresse/Name/Eingabe/Zeile zu lang?) Zeilenlänge,
and line are displayed=und Zeile werden angezeigt
String length too long!=Neuer Favorit zu lang!
Specify where to add the new shortcut. Select your Favorites folder or one of its subfolders:=Geben Sie an, wo die neue Verknüpfung erstellt werden soll. Wählen Sie Ihren Favoritenordner oder einen seiner Unterordner aus:
Edit favorite's title during the add process and allow for selection of folder.=Neuen Favoriten vor dem Hinzufügen umbenennen und Ordner auswählen
Rename the Favorite Title here=Ändern Sie hier den Titel des Favoriten
Did you mean to cancel?=Wollten Sie abbrechen?
Affirm cancel=Abbruch bestätigen
Reload Favorites list=Ansicht aktualisieren
Change location of Favorites folder=Favoriten-Verzeichnis wechseln
Change from location shown? Cancel resets default=Angezeigtes Verzeichnis wechseln? Abbruch setzt auf Standard zurück
Select an alternate Favorites folder=Neues Favoriten-Verzeichnis auswählen
K-Meleon must be restarted for the change to=K-Meleon muss neu gestartet werden, damit der Wechsel zu
to take effect.=wirksam werden kann.
RESTART REQUIRED=NEUSTART ERFORDERLICH
DEFAULT [Share favorites with I.E.]=STANDARD [Gemeinsame Favoriten mit I.E.]
Rename-Add=Umbenennen-Hinzufügen
Reload=Aktualisieren
Alternate Directory=Verzeichnis wechseln
Rename-Add to Favorites=Seite zu Favoriten hinzufügen (umbenennen)

Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: JamesD
Date: January 05, 2010 05:36AM

Quote
siria
Btw, is it intentional that there's no FavRenAdd when right-clicking a link...?

Not intentional that it is not there. I just never thought of it. I will see what can be done.

I will run more tests on the macro to find any errors. The prefs for new items and menu folder complicate things. It almost needs a help file.

Thanks for the translation.

Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: siria
Date: January 05, 2010 06:02AM

grinning smiley Help file? Actually in my stylebuttons macro I've included two menu entries "HELP", and when clicking them an alert() window pops open. It's gotten rather big I must admit, but somehow I find this fun cool smiley The only problem is, that the menu gets longer and longer... ;-) If there were a way to turn the Fav-"options..." into a submenu, then one could place the Dir-change, the FRA-help, and the KM options there, but if that's possible...? And even if, what if the new KM-version comes out tomorrow and has all that already included in the favorites.dll??

Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: siria
Date: January 05, 2010 07:02AM

Uff... still a bit sweating... Try restarting the browser if the fav-dir is set to "\" in the prefs... then take a look at View>Toolbars cool smiley

Options: ReplyQuote
Re: FavRenAdd and FavAltDir (rename favorites + choose folder)
Posted by: JamesD
Date: January 05, 2010 08:18PM

Quote
siria
Regarding translation:
Not sure: What "DATA" are too long? URL? Title? Both? Would it perhaps be ok to just translate to "too many characters" or "line too long?" For the "string" below I'd prefer to just translate into "Favorite too long"...

The message displayed has the length of the string, length($_fcmd), and the text string, $_fcmd, itself included.

I am very unsure about the title. Should I continue with the original title of FavRenAdd? There are two versions of that already in the MacroLibrary. I agree that I don't like "combo".

The thing about right clicking a link is the name. If you are already on a page then you have a title. That is the name with which FavRenAdd starts. That is not available from AddLink. That uses a version of the URL. I don't think I will do anything with this.

I have made a change to handle the cancel from selecting a new directory. I have updated the German localization file. I have no idea how to test it.

The new code is here. http://dl.dropbox.com/u/1522294/FRA_combo.7z

Options: ReplyQuote
Pages: Previous123Next
Current Page: 2 of 3


K-Meleon forum is powered by Phorum.