Hmm... correct me if I'm wrong Carson, but when I read that I get the idea that Drakhen is talking about a different kind of shortcut there. It's the kind of shortcut that some programmes install that by clicking upon it gets you to their webpage. Some will use the default browser, some internet shortcuts on the computer insist on using the IE engine. Apparently the new breakthrough is that the build with the 1.8b2 GRE will handle even those.
Of course, as I so frequently am, I could be all wet behind the ears...
view image - copy image and then use e. g. irfan view which has that function.
(paste from clipboard & next set as background )
else make macro that calls application to do that can do that
else try to make macro that invokes that function from xul - because Gecko xul has that or calls that.
(but we are possibly hamperd again - by other download procedure of k-m)
K-Meleon can send a URL to internet explorer or to an email client. It must be possible to make K-Meleon send a URL to a textfile called (website).url . But how?
hi, I don't think km has the ability to do that at the moment (someone correct me if I'm wrong). As you noticed, it doesn't have a problem to paste a URL into the clipboard and use it from there, but to save this url as shortcut-file it would need an extra function which tolds him to do that. A dll-plugin could easily solve this I think.
I got a vague idea how to write it, wouldn't have a prob to write the function that saves the file, but since there are different windows-versions and also different folder names for specific languages (eg. xp: documents and settings/desktop, xp: Dokumente und Einstellungen/desktop (german vers.), w98: windows/desktop) and perhaps different user-accounts o_O, I'm not really sure how to solve this (without getting headaches ;O) ). Maybe the easiest solution (at least for me ;OÞ) would be to make it like its done with the Mailclient-inquiry(?) macro (e.g. let the user input the path where shortcuts should go himself a single time and store this value as a km-preference). The plugin-function could then use this config-setting for the save part every time. I'm going to play a bit with this in my spare time to see if it works.
You can make bookmark.
actually You could use detour via favourites plugin to create ...
(but that is not a single click thing ... but can be probably automated as macro)
Bookmarks are good for sites that you visit often (especially when your bookmarks are stored as plain HTML and you set the bookmark file as your homepage).
But I often find myself at sites with interesting stuff that I want to read once, but later, not now. Having a shortcut on my desktop to remind me beats adding a bookmark to my overcrowded bookmark list.
After I've read the page, deleting a shortcut from my desktop is a lot faster than deleting a bookmark entry from within my browser.
Right now my options are:
1) copy URL from address bar, leave browser window and go to desktop, right-click to make new shortcut, paste in URL, enter a name, click OK.
If the location of the page differs from the URL in the address bar (frames, dynamic content, cloaked URLs, etc.) this trick doesn't work.
So therefore I usually resort to:
2) Right-click page, hit 'view page in IE,' right-click page in IE, click 'create shortcut.'
A method to avoid the detour through my desktop (or worse: IE) would make things a lot easier. Especially for sites that you don't trust enough to allow to load in IE.
If you don't use Favorites as bookmarks in K-Meleon, you can go to
Preferences-->Plugins-->IE Favorites Plugin -->configure and enter manually
your Desktop as location for Favorites, depending on your system
for example C:\Documents and Settings\All Users\Desktop\
(don't forget the last backslash), and save the URL as a favorite.
Then you can't use the other favorites as bookmarks obviously.
You can add K-Meleon to your "Send to"-menu to open the URL.
Hope that it works.
Fred
P.S.
If you want to use your existing Favorites, you can import them
into Netscape bookmarks before changing the location.
Go to Edit bookmarks and press the button "Import Favorites",
to integrate them into bookmarks.
Fred
Well, sure, that is an excellent way to do it. As 666 says, the re is a need to do it very fast (so not to interrupt a train of thought), plus a need to keep these "references in passing" separate from really important bookmarks.
I suppose you could use Opera's system too? Anything that is NOT Bookmarks. And, as long as the second system is handy, it no longer matters whether these things go to desktop or not. The file could point anywhere that's quick to access.
Thanx for the suggestion. Didn't really work for me, though, because I use IE favorites for three reasons:
1. Some sites that I visit regularly (like my online banking account) only work in IE.
2. I share my IE favorites between IE and K-M. IE doesn't see Netscape bookmarks so I can't do it the other way around.
3. My favorites folder is a toolbar on my taskbar for easy 2-click access to my bookmarked sites (which open in K-M when I open them from my taskbar; editing 'folder options' took care of that).
Converting my favorites to bookmarks is not an option.
When I change the favorites location in the plugin config screen, K-Ms favorites menu mixes the contents from my favorites folder AND my desktop in one big menu. And not just the shortcuts: every file or folder on my desktop ends up in K-Ms favorites menu too.
Trying to send shortcuts to my desktop didn't work: K-M just ignored my "E:\desktop\" entry and sent them to the default IE favorites folder instead - the very place I tried to keep those links away from!
Any possibility of a script or batch file which converts a 'mailto' link to a desktop shortcut? If yeah, setting that script as K-Ms email protocol app would do the trick.
I can offer a solution using Windows Script Host. All work described below takes place in your profile directory.
1) Creating the script
Create a new text file in your profile directory, paste the following lines and rename it to "Shortcut.js".
if (WScript.Arguments.length) {
var Arg = WScript.Arguments;
var WSS = new ActiveXObject("WScript.Shell");
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var LnkName = (Arg.length > 1) ? Arg(1) : "New Internet Shortcut";
var LinkLoc = WSS.SpecialFolders("Desktop") + "\\";
var i=0; for (; FSO.FileExists(LinkLoc+LnkName+((i)?(" ("+i+").url"):".url")); i++);
LnkName += (i) ? (" ("+i+").url") : ".url";
var Lnk = WSS.CreateShortcut(LinkLoc+LnkName);
Lnk.TargetPath = Arg(0);
Lnk.Save();
}
Half of the script is to make sure, that we do not overwrite existing files. The script won't do anything, if no parameters are passed to it.
2) Defining macros
Open macros.cfg with a text editor and paste the following lines (wherever you want, I suggest at the end):
These macros will execute the script "Shortcut.js" in your profile directory. First parameter is the URL (required). Second parameter is the file name (optional).
3) Defining menu entries
Open menus.cfg with a text editor. Search for "Save{". You should find the following lines (about line 700):
Save{
bookmarks(Add, Bookmark This Page)
favorites(Add, Add Page to Favorites)
hotlist(Add, Add Page to Hotlist)
%ifplugin macros
macros(SavePage, Save Page As...)
macros(EmailURL, Send Page As Link...)
%else
Save Page &As... = ID_FILE_SAVE_AS
%endif
-
}
Before the line "%else" add the line "macros(PageToDesktop, Send Page To Desktop)". This will give you a new entry "Send Page To Desktop" in the context menu of a page. When this entry is selected, the macro "PageToDesktop" is executed.
Search for "Link{". You should find the following lines (about line 775):
Link{
%ifplugin layers
layers(OpenLink, Open in New Layer)
layers(OpenLinkBg, Open in Background Layer)
-
%endif
Open in &New Window = ID_OPEN_LINK_IN_NEW_WINDOW
Open in Back&ground Window = ID_OPEN_LINK_IN_BACKGROUND
-
bookmarks(AddLink, Bookmark This Link)
favorites(AddLink, Add Link to Favorites)
hotlist(AddLink, Add Link to Hotlist)
&Copy Link URL = ID_COPY_LINK_LOCATION
%ifplugin macros
macros(SaveLink, Save Link As...)
macros(LinkInfo, View Link URL...)
macros(LinkInIE, View Link In IE)
%else
Save &Link As... = ID_SAVE_LINK_AS
%endif
}
Before the line "%else" add the line "macros(LinkToDesktop, Send Link To Desktop)".
Search for "Frame{". You should find the following lines (about line 840):
Frame{
Open Frame = ID_OPEN_FRAME
%ifplugin layers
macros(FrameInLayer, Open Frame in New Layer)
%endif
Open Frame in New Window = ID_OPEN_FRAME_IN_NEW_WINDOW
macros(FrameInBack, Open Frame in Background)
-
%ifplugin macros
macros(ReloadFrame, Reload Frame)
macros(SaveFrame, Save Frame As...)
macros(EmailFrameURL, Send Frame As Link...)
%else
Save Frame As... = ID_FILE_SAVE_FRAME_AS
%endif
-
View Frame Info = ID_VIEW_FRAME_INFO
V&iew Frame Source = ID_VIEW_FRAME_SOURCE
}
Before the line "%else" add the line "macros(FrameToDesktop, Send Frame To Desktop)".
Nice! Works on all the pages I tested except for movies.yahoo.com. Strange that it works on that page if saved from a link. Might have something to do with the page title($TITLE) because when that was removed from the macro, it saved it but with no title whatsoever, not even 'New Shortcut'. But anyway, works well on all others I tested. :-)
Yes, jsnj, setting the title of a page as filename is indeed a potential source of strangenesses. The reason is, that a page's title can contain characters, that are invalid for a filename (like colons). I forgot about that - nobody's perfect ;-)
Here is an updated version of "Shortcut.js":
if (WScript.Arguments.length) {
function Sanitize(string) {
// replace invalid characters by whitespaces
var invalid = new Array('*','"','<','>','|','\\','/',':','?');
for (var i in invalid) string = string.replace(invalid," ");
return string;
}
var Arg = WScript.Arguments;
var WSS = new ActiveXObject("WScript.Shell");
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var LnkName = (Arg.length > 1) ? Sanitize(Arg(1)) : "New Internet Shortcut";
var LinkLoc = WSS.SpecialFolders("Desktop") + "\\";
var i=0; for (; FSO.FileExists(LinkLoc+LnkName+((i)?(" ("+i+").url"):".url")); i++);
LnkName += (i) ? (" ("+i+").url") : ".url";
var Lnk = WSS.CreateShortcut(LinkLoc+LnkName);
Lnk.TargetPath = Arg(0);
Lnk.Save();
}
if (WScript.Arguments.length) {
function Sanitize(string) {
// replace invalid characters by whitespaces
var invalid = new Array('*','"','<','>','|','\\','/',':','?');
for (var t in invalid) string = string.replace(invalid[t]," ");
return string;
}
var Arg = WScript.Arguments;
var WSS = new ActiveXObject("WScript.Shell");
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var LnkName = (Arg.length > 1) ? Sanitize(Arg(1)) : "New Internet Shortcut";
var LinkLoc = WSS.SpecialFolders("Desktop") + "\\";
var i=0; for (; FSO.FileExists(LinkLoc+LnkName+((i)?(" ("+i+").url"):".url")); i++);
LnkName += (i) ? (" ("+i+").url") : ".url";
var Lnk = WSS.CreateShortcut(LinkLoc+LnkName);
Lnk.TargetPath = Arg(0);
Lnk.Save();
}
When I tried to send http://vowe.net/archives/001639.html to my desktop, it created a dead shortcut with an invalid name that couldn't be changed or deleted.
The problem is with the page title: it contains '::' and the script only removed a single ':'.
Is there a way to fix this? Simply adding '::' to the list of invalid characters in the script didn't work.
The solution is, to use regular expressions instead of string representations in Sanitize().
function Sanitize(string) {
// replace invalid characters by whitespaces
var invalid = new Array(/\*/g,/"/g,/</g,/>/g,/\|/g,/\\/g,/\//g,/:/g,/\?/g);
for (var i in invalid) string = string.replace(invalid," ");
return string;
}
I hope, we have it now! Have you found a way to get rid of the corrupted file, yet?
function Sanitize(string) {
// replace invalid characters by whitespaces
var invalid = new Array(/\*/g,/"/g,/</g,/>/g,/\|/g,/\\/g,/\//g,/:/g,/\?/g);
for (var j in invalid) string = string.replace(invalid[j]," ");
return string;
}
if (WScript.Arguments.length) {
function Sanitize(string) {
// replace invalid characters by whitespaces
var invalid = new Array(/\*/g,/"/g,/</g,/>/g,/\|/g,/\\/g,/\//g,/:/g,/\?/g);
for (var j in invalid) string = string.replace(invalid[j]," ");
return string;
}
var Arg = WScript.Arguments;
var WSS = new ActiveXObject("WScript.Shell");
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var LnkName = (Arg.length > 1) ? Sanitize(Arg(1)) : "New Internet Shortcut";
var LinkLoc = WSS.SpecialFolders("Desktop") + "\\";
var i=0; for (; FSO.FileExists(LinkLoc+LnkName+((i)?(" ("+i+").url"):".url")); i++);
LnkName += (i) ? (" ("+i+").url") : ".url";
var Lnk = WSS.CreateShortcut(LinkLoc+LnkName);
Lnk.TargetPath = Arg(0);
Lnk.Save();
}
Works great!
Had to put all files from my desktop that I wanted to keep in a folder, close explorer, and purge my desktop with del *.* to get rid of the ghost shortcut, but it's gone now.
I guess the only way to improve the script now is to put it all in an installer that copies the .js to the right place and plugs the right bits into the .cfg files, then drop it on http://kmeleon.sourceforge.net/wiki/index.php?id=KPlugins : )
Had to ... purge my desktop with del *.* to get rid of the ghost shortcut...
That's exactly what I did, too!
I guess the only way to improve the script now is to put it all in an installer...
Yes! Would be nice if somebody would do that
Thank you for 'beta testing', 666! Enjoy!
If all proofs stable the next weeks, I will post it to the official macro page...
PS: Somehow based on this one, I've experimented with another macro (script) recently. It would empower you to use Internet Explorer's own "Add to Favorites..." function instead of K-Meleon's i.e. you could select the folder where your bookmark is stored and so on. The only problem is: K-Meleon's favorites plugin does not synchronize the menu. What a pity! :´-(