Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

10.4: Add Programming to the Unit Converter widget System 10.4
This AppleScript patches the Apple-provided Unit Converter Widget to support a new Programming category that allows you to convert between Hex, Decimal, Octal, Binary and Char (ASCII). Simply paste it into your Script Editor and click Run. (If you ask yourself what those long lists of letters are in the source -- they are a diff file and a png encoded in base64.)

You'll then have to select the location of the stock Unit Converter Widget (which should be /Library/Widgets), select where to store the enhanced widget (just click OK for your home directory), and that's it. When you see three patch messages, select whether or not to install the new widget, and then click OK to install or click Cancel to keep it where you stored it.

Update: The script has been fixed -- sorry for the error!

[robg adds: I've tested this, and it worked as described. The modified widget is stored in your user's Library -> Widgets folder, so it doesn't overwrite the original.]
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[7,319 views]  

10.4: Add Programming to the Unit Converter widget | 10 comments | Create New Account
Click here to return to the '10.4: Add Programming to the Unit Converter widget' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
10.4: Add Programming to the Unit Converter widget
Authored by: kainewynd2 on Wed, Jan 24 2007 at 5:38AM PST
I had an issue with compiling this script. It turned out that I needed to comment out the on error block. After that it seemed to work fine.

on patch(basedir, posixFilename, patchdata)
	try
		set patchResult to do shell script "cd " & (quoted form of basedir) & " ; (uudecode -p | patch -p0 ) <<-''" & return & patchdata
		
		(*on error errmsg number errnum
		if errnum ? 2 then
			display dialog errnum as string
		end if
		set patchResult to posixFilename & " is missing."
	end try*)
		return patchResult & return
	end try
end patch


[ Reply to This | # ]
10.4: Add Programming to the Unit Converter widget
Authored by: anonon on Wed, Jan 24 2007 at 8:41AM PST
i tried replacing the '?' with '=' in the errnum test
... i'm no applescript pro but it seemed logical

and it worked great

[ Reply to This | # ]
10.4: Add Programming to the Unit Converter widget
Authored by: kainewynd2 on Wed, Jan 24 2007 at 10:30AM PST
And, lo and behold, you were right. How novell...

[ Reply to This | # ]
10.4: Add Programming to the Unit Converter widget
Authored by: kainewynd2 on Wed, Jan 24 2007 at 10:32AM PST
or rather novel. Woo-hoo.

[ Reply to This | # ]
CORRECT FIX! Use option-equals!!
Authored by: Lectrick on Wed, Jan 24 2007 at 1:57PM PST
In the above referenced txt there is a question mark due to a possible encoding error of the character that is formed when you hold down option and press equals (≠). This is a standard applescript "not equals" operator.

So, if you really want to fix this without commenting out the error handling as suggested by others, change

if errnum ? 2 then

to

if errnum ≠ 2 then

Enjoy!

---
In /dev/null, no one can hear you scream

[ Reply to This | # ]

CORRECT FIX! Use option-equals!!
Authored by: Skeeve on Thu, Jan 25 2007 at 1:52AM PST
Oops! Didn't see that you already posted a correct fix. Thanks for that. Unfortunately a not-equal sign seems to be undisplayable here.

[ Reply to This | # ]
10.4: Add Programming to the Unit Converter widget
Authored by: Skeeve on Thu, Jan 25 2007 at 1:50AM PST
Actually it should have been a not-equal sign. It can be entered using /=.

That on-error part is for errors that might occure and which are not "File Exists" type of errors.

[ Reply to This | # ]
10.4: Add Programming to the Unit Converter widget
Authored by: robg on Thu, Jan 25 2007 at 5:17AM PST
I fixed the script; sorry for the error.

regards,
-rob.

[ Reply to This | # ]
10.4: Add Programming to the Unit Converter widget
Authored by: graemeaustin on Wed, Jan 24 2007 at 7:23AM PST
I had the same problem. But followed your patch and everything works fine.

Thanks!

Graeme

[ Reply to This | # ]
10.4: Add Programming to the Unit Converter widget
Authored by: fresler on Wed, Jan 24 2007 at 8:34AM PST
Very nice! I will find this extremely useful. Thanks!

[ Reply to This | # ]