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.
Goto:
Forum List
•
Message List
•
Search
•
Log In
Your Name:
Subject:
Help information
BBcode help
Smileys help
[quote=JamesD] @ 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. [code] # 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;"; [/code][/quote]
[Please Enable JavaScript]
K-Meleon forum is powered by
Phorum
.
Home/News
Screenshots
Download
Documentation
Resources
Get Involved
Forum
Bugs
Development