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.
# 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;";
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\"") ;
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",....
# 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;";
# 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;";
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.
[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.
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.
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: but that may not be necessary at all.
_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\""); }
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.
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 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!
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%\....
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\""); }
# 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;";
/* 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)) } }
Quote
siria
Btw, is it intentional that there's no FavRenAdd when right-clicking a link...?
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"...