Improvement requests
: K-Meleon Web Browser Forum
Use this forum to talk about a feature you're missing.
Go to:
Forum List
•
Message List
•
Search
•
Log In
Your Name:
Subject:
Help information
BBcode help
Smileys help
Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
[Please, enable JavaScript to see the code]
Enter code:
[quote=JamesD] @ 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. [b]FRA_combo.kmm[/b] [code] # 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;"; [/code] And the js code here. [b]FRA_combo.js[/b] [code] /* 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)) } } [/code][/quote]
[Please Enable JavaScript]
K-Meleon forum is powered by
Phorum
.
Home/News
Screenshots
Download
Documentation
Resources
Get Involved
Forum
FAQ
English