General
: K-Meleon Forum
General discussion about K-Meleon.
Goto:
Forum List
•
Message List
•
Search
•
Log In
Your Name:
Subject:
Help information
BBcode help
Smileys help
[quote=James] Can anyone advise me on the form of the exec statement in the macro language for calling wscript.exe and passing two arguments? Based on one example I am using the following statement: exec("wscript.exe\"".$_FavRenAdd_PathName."\" \"".$_FavRenAdd_CurURL."\"") ; I think it resolves to this: ""C:\\Documents and Settings\\Compaq_Owner.JIM-BARBARA\\Favorites\\Unfiled-New\\Group_3\\Something wicked.url" "http://www.perigee.net/"" That is two quoted strings inside a quoted string. Is this right? I am not having any luck so far with the jscript program. I think the macro language part of the project is done except for some cleanup of leftover comments and stuff. I will post here for anyone who cares to see how it looks to the user when run. NOTE: it does not yet actualy create a shortcut. I have to get the exec statement right and complete the jscript program for that. # K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage) # # ---------- FavRenAdd.kmm # ---------- K-Meleon Macro Language Rename/Add page to Favorites --------------- # # Dependencies : main.kmm, Favorites plugin active, JScript, Windows Scripting Host # Resources : - # Preferences : - # # -------------------------------------------------------------------------------- # _FavRenAdd_RnameTrue{ statusbar("Renaming"); $_FavRenAdd_NewItemFolder = getpref( string, "kmeleon.plugins.favorites.newitemFolder" ); #### 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_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) ; $_FavRenAdd_OutText =$_FavRenAdd_PathName.\n.$_FavRenAdd_CurURL ; $_FavRenAdd_PathName = gsub(\\ , \\\\, $_FavRenAdd_PathName); exec("wscript.exe\"".$_FavRenAdd_PathName."\" \"".$_FavRenAdd_CurURL."\"") ; setclipboard(\"".$_FavRenAdd_PathName."\" \"".$_FavRenAdd_CurURL."\" ); #setclipboard( $_FavRenAdd_OutText ); statusbar("Rename-Add COMPLETE"); } _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_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_NewItemFolder); $_FavRenAdd_SubFolder=$_FavRenAdd_SubFolder==""?":":index($_FavRenAdd_SubFolder,$_FavRenAdd_FavFolder)==0?substr($_FavRenAdd_SubFolder,length($_FavRenAdd_FavFolder)+1):"?"; } _FavRenAdd_RenameAdd{ $_FavRenAdd_CurrTitle = $TITLE; $_FavRenAdd_CurURL = $URL; statusbar("Rename Add in progress"); $_FavRenAdd_value=prompt($_FavRenAdd_CurrTitle,"Rename the Favorite Title here"); # 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 ? &_FavRenAdd_Cancelled :&_FavRenAdd_RnameTrue ; } _FavRenAdd_Cancelled{ statusbar(Rename-Add CANCELLED) $FavRenAdd_Button=confirm("Did you mean to cancel?","Confirm" ,YESNO,QUESTION); $FavRenAdd_Button == "YES" ? statusbar(Rename-Add CANCELLED): &_FavRenAdd_RenameAdd ; } _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; } _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]
[Please Enable JavaScript]
K-Meleon forum is powered by
Phorum
.
Home/News
Screenshots
Download
Documentation
Resources
Get Involved
Forum
Bugs
Development