• 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
Creating a plist file (Tiger)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Creating a plist file (Tiger)


  • Subject: Creating a plist file (Tiger)
  • From: Stephen Jonke <email@hidden>
  • Date: Mon, 13 Jun 2005 10:57:31 -0400

I've figured out how to use the new Property List Suite in Tiger's System Events to read from a plist file (for an example see my Laserlight applet: http://www.macupdate.com/info.php/id/18364), but does anyone have an example of how to create a new plist file and to modify an existing one? Is this possible? I can't do this:

  tell app "System Events"
      make new property list file with properties {name:"test.plist"}
  end tell

That gives an "internal script error", which doesn't bode well for creating one even with more details filled in.

I tried the following as a test, but the ending "get" always produces an empty list (looking at the file it does have contents):

tell application "System Events"
get property list file ":~:Library:Preferences:com.apple.spotlight.plist"
set theProps to property list items of result


set thePropsFile to file ":~:Library:Preferences:com.sjonke.laserlight.plist"
set fileRef to open for access thePropsFile with write permission
try
repeat with x in theProps
write x to fileRef
end repeat
close access fileRef
on error errtxt number errnum
close access fileRef
error errtxt number errnum
end try


get property list file ":~:Library:Preferences:com.sjonke.laserlight.plist"
get property list items of result
end tell



If I change the "write" line to this:

    write x to fileRef as property list item

I get an error saying it can't make the property list item into property list item!

Steve

_________________________________________________________________
Stephen Jonke                                  email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Printing a window
      • From: Steve Suranie <email@hidden>
  • Prev by Date: Unscriptable window bounds
  • Next by Date: Printing a window
  • Previous by thread: Unscriptable window bounds
  • Next by thread: Printing a window
  • Index(es):
    • Date
    • Thread