Re: Script to get default browser?
Re: Script to get default browser?
- Subject: Re: Script to get default browser?
- From: Philip Aker <email@hidden>
- Date: Thu, 09 Jan 2003 22:42:59 -0800
On Thursday, January 9, 2003, at 04:01 PM, Mr Tea wrote:
Can I use AppleScript to find out what the current default browser is?
I peeped into the Terminal and had a look at man defaults, but was
quickly overwhelmed and had to retire.
You'll have to do some work to suck the path out of the result but this
is what I've got so far. The 'hex2num' is a tcl script which does the
obvious. I think Arthur posted a Knappian Way Script to do exactly
that just a few days ago. I just gave up on this weirdness and wrote a
Scripting Addition which does the job much better. You can have a copy
if you want.
set s to ""
set fpath to (((path to desktop) as string) & "adata.txt")
set datafile to "~/Desktop/adata.txt"
set res to (do shell script "defaults read com.apple.internetconfig
'Version 2.5.3' | grep -C2 DownloadFolder")
set adata to ((characters 74 thru -17 of res) as string)
set AppleScript's text item delimiters to space
set ti to (text items of adata)
set AppleScript's text item delimiters to ""
set s to ti as string
set ss to ""
set len to (length of s) - 2
repeat with i from 1 to len by 2
set str to ((characters i thru (i + 1) of s) as string)
if (str is not "00") then
set ss to ss & str & space
end if
end repeat
set s to (do shell script "~/bin/hex2num " & ss)
set ss to ""
repeat with w in (words of s)
set num to w as number
if (num is less than 31) then
set num to 32
end if
set ss to ss & (ASCII character num)
end repeat
set AppleScript's text item delimiters to space
set wrds to (words of ss)
set AppleScript's text item delimiters to ""
wrds
Philip Aker
http://www.aker.ca
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.