• 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: setting a preference with do Shell Script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setting a preference with do Shell Script


  • Subject: Re: setting a preference with do Shell Script
  • From: KOENIG Yvan <email@hidden>
  • Date: Sat, 28 Jan 2012 19:06:28 +0100


Le 28 janv. 2012 à 18:14, Doug McNutt a écrit :


At 17:41 +0100 1/28/12, KOENIG Yvan wrote:
I'm trying to use a script to change a preference setting.
It's the preference FormatXML dedicated to Pages, an iWork application.

The default setting is NO but I wish to set it to YES.

I thought that

do shell script "defaults write com.apple.iWork.Pages FormatXML -string YES"

would do the trick.

It seems to do because if I run

do shell script "defaults read com.apple.iWork.Pages FormatXML"

do shell script "defaults write com.apple.iWork.Pages FormatXML -string YES"

do shell script "defaults read com.apple.iWork.Pages FormatXML"


the log report claim :
--> "NO"
--> ""
--> "YES"

SNIP by DPM

Those do shell script lines may need some quoting, "quoted from of"  style.

It just might be that defaults read and write are going to some new file that has nothing to do with :

"com.apple.iWork.Pages FormatXML"  or  com.apple.iWork.Pages\ FormatXML

Modification date/time for the file?

Are you in the users Library directory?  Or in the system side of things with proper access permissions?

Thanks 

I discovered what is behaving.

I'm running Lion.

I used the search tool which revealed two com.apple.iWork.Pages.plist files.

When I execute :

do shell script "defaults write ~/Library/Preferences/com.apple.iWork.Pages FormatXML -string YES"
or

do shell script "defaults write com.apple.iWork.Pages FormatXML -string YES"

The value is not stored in the file defined by the instruction :

Macintosh HD:Users:yvankoenig:Library:Preferences:com.apple.iWork.Pages.plist

It's stored in :

Macintosh HD:Users:yvankoenig:Library:Containers:com.apple.Preview:Data:Library:Preferences:com.apple.iWork.Pages.plist

It seems that the file Macintosh HD:Users:yvankoenig:Library:Preferences:com.apple.iWork.Pages.plist
is read during the startup process and copied in :
Macintosh HD:Users:yvankoenig:Library:Containers:com.apple.Preview:Data:Library:Preferences:com.apple.iWork.Pages.plist
It's this one which is used.

I think that the first one is read during the startup process because I have a script which is ran at this time and which replace it by a clean one stored elsewhere.
Changes which I apply by hand are killed (it's deliberate) when I reboot.
If I want to keep new settings, I copy the edited file to the 'clean' one.

Yvan KOENIG (VALLAURIS, France) samedi 28 janvier 2012 19:05:55




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >setting a preference with do Shell Script (From: KOENIG Yvan <email@hidden>)
 >Re: setting a preference with do Shell Script (From: Doug McNutt <email@hidden>)

  • Prev by Date: Re: setting a preference with do Shell Script
  • Next by Date: Re: Reformatting a string
  • Previous by thread: Re: setting a preference with do Shell Script
  • Next by thread: Apple Mail and Forward
  • Index(es):
    • Date
    • Thread