Can someone tell me where the Internet Explorer homepage URL is stored in Mac OS X? I need to see if there’s a way I can modify it via Applescript. There are lots of “Javascript” examples on the web that describe how to set the user’s default homepage URL. Unfortunately, I haven’t found one that works on the Mac. They all work only in Windows. There’s got to be a Mac way!
The stuff is in the plist file “com.apple.internetconfig.plist”. Quit IE and run the following from Smile (you need Smile and XMLLib.osax):
Hmmm… Just now I’m not sure that the XMLLib.osax is available for the current public release of Smile (2.5.9), perhaps it is still a semi-public release… (you could access it subscribing to the Smile Users List and asking directly to Emmanuel, or wait for the next release of Smile -coming soon-).
Otherwise, you can:
Quit IE.
Read the related file (“com.apple.internetconfig.plist”), search for the stuff:
<key>4D534945•WWWHomePage</key>
<dict>
<key>ic-data</key>
<data>
G2h0dHA6Ly93d3cubWFjc2NyaXB0ZXIubmV0Lw==
</data>
</dict>
Then substitute the current value between the tags to the new home page for IE (note that “4D534945” stands for “MSIE”):
-ASCII character (Length of string of new home page, eg: “foo.net” = ascii character 7)
-Home page as string
-Pick all this text and transform it to base64 (eg:
)
Write it back to its place ( tags) and save the file.
Relaunch IE.
The text encoding from the URL is working great! Thanks! The only part I’m having difficulty with is how to write an Applescript that will zoom down to the second WWWHomePage plist item (which is WAAAY down in the .plist file). When I do into the com.apple.internetconfig.plist file, the first “4D534945 WWWHomePage” string is for Safari it seems, and then a couple thousand lines lower is the one that determines IE’s homepage URL. (At least that’s how it is for me in 10.3.4) If I don’t want the user to have to install special XML additions, is there a way to do this natively in Applescript?
You can adaptate this one:
set LF to ASCII character 10
set allStuff to (read alias "foo:Users:foo:Library:Preferences:com.apple.internetconfig.plist")
--> define the text to search for, till it reaches your goal (just copy-paste before the homepage-data, and note the tabs and LF line-ends)
set del to "<key>4D534945‚Ä¢WWWHomePage</key>" & LF & ¬
" <dict>" & LF & ¬
" <key>ic-data</key>" & LF & ¬
" <data>" & LF & ¬
" "
set AppleScript's text item delimiters to del
set allStuff to allStuff's text items
set AppleScript's text item delimiters to {""}
set ourChunk to allStuff's item 2
set ourChunk to text (offset of LF in ourChunk) thru -1 of ourChunk
set newChunk to "G2h0dHA6Ly93d3cubWFjc2NyaXB0ZXIubmV0Lw==" & ourChunk --> use here your own base64-encoded home page
set allStuff's item 2 to newChunk --> replace old piece
--> recompose all the text
set AppleScript's text item delimiters to del
set allStuff to allStuff as text
set AppleScript's text item delimiters to {""}
set the clipboard to allStuff --> or whatever you like