|  09-09-2009, 03:20 AM | #1 | 
| Connoisseur            Posts: 78 Karma: 2260 Join Date: Jan 2006 Device: TX | 
				
				Clip Sunrise XP With Google Chrome?
			 
			
			Greetings everyone!  I'm still using a Palm TX, still using Sunrise XP and still love it. I also now love Google Chrome. The only thing I can't do with it is clip webpages to Sunrise XP with it. So I have to copy the URL and open Firefox. Oh, how I wish there was an extension for Chrome... Laurens, you still out there?  By the way, Chrome really is great if any of you are interested... | 
|   | 
|  09-21-2009, 03:44 PM | #2 | 
| Jah Blessed           Posts: 1,295 Karma: 1373 Join Date: Apr 2003 Location: The Netherlands Device: iPod Touch |  Might not be very difficult to do 
			
			I've switched to a Mac and iPod Touch, so no Sunrise for me anymore.  That said, all that the IE and Firefox extensions actually do is invoke sunrisexp.exe with specific command-line parameters to trigger the "clip" functionality. It should be relatively easy to write a similar extension for Chrome or Safari. The basic outline of what the script should do is: 
 Example: Code: sunrisexp.exe -clip https://www.mobileread.com/ MobileRead Code: function clipWithSunriseXp() {
	var url = content.document.URL;
	if (url == "about:blank" || url == null) {
		alert("Cannot clip this page. URL not available.");
		return;
	}
	var title = content.document.title;
	var selectionFile = saveSelection();
	
	var sunrisexp = getSunriseXp();
	if (sunrisexp == null) {
		alert("Could not find Sunrise XP executable.");
		return;
	}
	
	var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
	process.init(sunrisexp);
	
	var args = new Array(3);
	args[0] = "-clip";
	args[1] = title;
	args[2] = url;
	if (selectionFile != "") {
		args[3] = selectionFile;
	}
	process.run(false, args, args.length);
}
function getSunriseXp()
{
	var nsIWindowsRegKey = Components.interfaces.nsIWindowsRegKey;
	var registry = Components.classes["@mozilla.org/windows-registry-key;1"].getService(nsIWindowsRegKey);
	registry.open(nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE, "SOFTWARE\\DistantChord\\Sunrise XP", nsIWindowsRegKey.ACCESS_READ);
	var installDir = registry.readStringValue("InstallDir");
	
	var sunrisexp = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
	sunrisexp.initWithPath(installDir + "\\sunrisexp.exe");
	if (sunrisexp.exists()) {
		return sunrisexp;
	} else {
		return null;
	}
}
function saveSelection()
{
	var selection = content.getSelection();
	if (selection.rangeCount == 0) {
		return "";
	}
	
	var range = selection.getRangeAt(0);	
	var span = content.document.createElement("span");
	span.appendChild(range.cloneContents());	
	var html = span.innerHTML;
	
	var file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties)
		.get("TmpD", Components.interfaces.nsILocalFile);
	file.append("sunrisexp_selection.html");
	var out = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
	out.init(file, 0x02 | 0x08 | 0x20, 0664, 0);
	out.write(html, html.length);
	out.close();
	
	return file.path;	
} | 
|   | 
|  09-21-2009, 03:56 PM | #3 | 
| Jah Blessed           Posts: 1,295 Karma: 1373 Join Date: Apr 2003 Location: The Netherlands Device: iPod Touch | 
			
			BTW, it's amazing that you're still using it.
		 | 
|   | 
|  10-21-2009, 02:07 PM | #4 | 
| Junior Member  Posts: 1 Karma: 10 Join Date: Oct 2009 Device: Samsung SPH-i500 |  I just started using Sunrise XP this year... 
			
			... after AvantGo died. I have really enjoyed SunriseXP until today, when I installed the October batch of Windows XP security fixes and one of them broke its web clipping capability! Now I get a message I recognize from having seen it a lot over the weekend, when I was fighting to get TiVo Desktop/Server running on my new Windows 7 PC: ------------------------------------------------------------- Runtime Error! Program C:\Program Files\Sunrise XP\sunrisexp.exe This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. ------------------------------------------------------------- This happens whether I call it using the Javascript or from the command line. Apparently, one of the C++ runtime libraries was upgraded and it broke SunriseXP clipping, though it still fetches CSM and BBC updates via its own scripts just fine. On the Windows 7 machine, I was able to overcome the error message by running the TiVo server in Windows XP Service Pack 2 compatibility mode -- but with SunriseXP, I'm running it on a Windows XP Service Pack 2 PC!! Anyone have any clues to offer about which October security update I should try removing? | 
|   | 
| Thread Tools | Search this Thread | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| HTC Google Chrome OS tablet - more info | SameOldStory | News | 5 | 08-23-2010 07:05 PM | 
| Chrome tablet | anahid | News | 1 | 02-02-2010 02:37 PM | 
| Wierd warning from google chrome!! | mklynds | Feedback | 3 | 06-13-2009 02:30 AM | 
| New Google Chrome Browser | kesey | News | 111 | 09-08-2008 01:12 PM |