• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Making a folder in the user's library
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making a folder in the user's library


  • Subject: Re: Making a folder in the user's library
  • From: John Delacour <email@hidden>
  • Date: Sat, 5 Apr 2003 10:47:53 +0100
  • Mac-eudora-version: 6.0a14

At 3:54 pm -1000 4/4/03, Reinhold Penner wrote:

Yes, but it's easy enough to get the folder from com.apple.internetconfig.plist using 'defaults' in the shell, isn't > it.

Well, I have tried, but it's a jungle out there. I couldn't see an easy way to parse that xml file...

Can you remind us how?

This is a real challenge and I don't think it can be done.

It can easily be done for Safari but for internetconfig I haven't worked out the best routine and the one below is posted simply to encourage our NeXT friends to give the right solution. The binary data returned from the routine does contain the Download Folder, as you'll see if you paste it into ResEdit, and there are several ways to extract the info, but there's no point using a sledgehammer to crack a nut.




do shell script "defaults read com.apple.safari NSDefaultOpenDirectory"
(*
=> "~/Downloads0303"
*)
-----
set s to do shell script "defaults read com.apple.internetconfig"
set {info_, write_} to {"", false}
repeat with p in paragraphs of s
if write_ then set info_ to info_ & p
if p contains "DownloadFolder =" then set write_ to true
if write_ and p contains ">" then set write_ to false
end repeat
set {x, y} to {offset of "<" in info_, offset of ">" in info_}
text (x + 1) through (y - 1) of info_
(* =>
"0264783b 00000000 01b87c40 35305a58 4a68636d 4e6f6552 524a626e 526c0a09 b9b377ca ff9c0001 f3dc0d44 6f776e6c 6f616473 30333033 01b87c40 55535735 300a0909 09090909 5a584a68 636d4e6f 6553424a 626e526c 636d5a68 5932553d 0a090909 0909093c 2f640000 0000012c 00020001 02647800 00000000 00000000 00000000 00000000 00000000 00000000 b9b377ca 482b0000 0001f3dc 0d446f77 6e6c6f61 64733033 30330000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000dbc73 ba8686e0 00000000 00000000 ffffffff 00000120 00000000 00000000 00000000 00000002 6a640010 00080000 b9b369ba 00000011 00080000 ba8686e0 00000001 00080001 f3dc0000 22430002 00196478 3a557365 72733a6a 643a446f 776e6c6f 61647330 33303300 000e001c 000d0044 006f0077 006e006c 006f0061 00640073 00300033 00300033 000f0006 00020064 00780012 00165573 6572732f 6a642f44 6f776e6c 6f616473 30333033 00130001 2f00ffff 0000"
*)
_______________________________________________
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.
References: 
 >Re: Making a folder in the user's library (From: Reinhold Penner <email@hidden>)

  • Prev by Date: Re: Space in POSIX path/Terminal shell
  • Next by Date: Re: Making a folder in the user's library
  • Previous by thread: Re: Making a folder in the user's library
  • Next by thread: Re: Making a folder in the user's library
  • Index(es):
    • Date
    • Thread