Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > Miscellaneous > Archive > Sunrise

Notices

 
 
Thread Tools Search this Thread
Old 09-09-2009, 04:20 AM   #1
doogie68
Connoisseur
doogie68 knows what time it isdoogie68 knows what time it isdoogie68 knows what time it isdoogie68 knows what time it isdoogie68 knows what time it isdoogie68 knows what time it isdoogie68 knows what time it isdoogie68 knows what time it isdoogie68 knows what time it isdoogie68 knows what time it isdoogie68 knows what time it is
 
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...
doogie68 is offline  
Old 09-21-2009, 04:44 PM   #2
Laurens
Jah Blessed
Laurens is no ebook tyro.Laurens is no ebook tyro.Laurens is no ebook tyro.Laurens is no ebook tyro.Laurens is no ebook tyro.Laurens is no ebook tyro.Laurens is no ebook tyro.Laurens is no ebook tyro.Laurens is no ebook tyro.Laurens is no ebook tyro.
 
Laurens's Avatar
 
Posts: 1,295
Karma: 1373
Join Date: Apr 2003
Location: The Netherlands
Device: iPod Touch
Lightbulb 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:
  1. Obtain the current document's title and URL.
  2. Find the path of the sunrisexp.exe executable in the Windows Registry. (Alternatively, use a hard-coded path, so you can skip this step.)
  3. Invoke sunrisexp.exe with the -clip option followed by the URL and the title.

Example:
Code:
sunrisexp.exe -clip https://www.mobileread.com/ MobileRead
I've attached the Firefox extension's JavaScript code for inspiration. Good luck.

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;	
}
Laurens is offline  
Advert
Old 09-21-2009, 04:56 PM   #3
Laurens
Jah Blessed
Laurens is no ebook tyro.Laurens is no ebook tyro.Laurens is no ebook tyro.Laurens is no ebook tyro.Laurens is no ebook tyro.Laurens is no ebook tyro.Laurens is no ebook tyro.Laurens is no ebook tyro.Laurens is no ebook tyro.Laurens is no ebook tyro.
 
Laurens's Avatar
 
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.
Laurens is offline  
Old 10-21-2009, 03:07 PM   #4
tbetz
Junior Member
tbetz began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Oct 2009
Device: Samsung SPH-i500
Unhappy I just started using Sunrise XP this year...

Quote:
Originally Posted by Laurens View Post
BTW, it's amazing that you're still using it.
... 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?
tbetz is offline  
 


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTC Google Chrome OS tablet - more info SameOldStory News 5 08-23-2010 08:05 PM
Chrome tablet anahid News 1 02-02-2010 03:37 PM
Wierd warning from google chrome!! mklynds Feedback 3 06-13-2009 03:30 AM
New Google Chrome Browser kesey News 111 09-08-2008 02:12 PM


All times are GMT -4. The time now is 05:28 PM.


MobileRead.com is a privately owned, operated and funded community.