how to reset another app's prefs

2014-11-20 Thread Scott Ribe
Now that the system is doing so much caching of preferences, and simply copying 
prefs files will not get the job done, is there any other way of forcibly 
setting another app's preferences? (FYI, neither of the apps in question is 
sandboxed.)

The situation is that an app is accessing a database, tracking events, managing 
a repository of files, and using AppleScript to drive MS Word to produce 
certain output. Every once in a while, Word just resets some of its prefs. 
Every once in a while, it corrupts its prefs. Every once in a while, it wedges 
itself due to (probably) resource leaks. And so on. So periodically (+ whenever 
it stops responding) I quit Word, copy preferences files from cached copies I 
keep that are set the way I want, and relaunch it.

So, any way to for certain replace prefs with a know good set previously saved?

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: how to reset another app's prefs

2014-11-20 Thread Ken Thomases
On Nov 20, 2014, at 3:21 PM, Scott Ribe scott_r...@elevated-dev.com wrote:

 Now that the system is doing so much caching of preferences, and simply 
 copying prefs files will not get the job done, is there any other way of 
 forcibly setting another app's preferences? (FYI, neither of the apps in 
 question is sandboxed.)
 
 The situation is that an app is accessing a database, tracking events, 
 managing a repository of files, and using AppleScript to drive MS Word to 
 produce certain output. Every once in a while, Word just resets some of its 
 prefs. Every once in a while, it corrupts its prefs. Every once in a while, 
 it wedges itself due to (probably) resource leaks. And so on. So periodically 
 (+ whenever it stops responding) I quit Word, copy preferences files from 
 cached copies I keep that are set the way I want, and relaunch it.
 
 So, any way to for certain replace prefs with a know good set previously 
 saved?

You could use -[NSUserDefaults setPersistentDomain:forName:].  You could also 
use defaults import domain path to plist.

Regards,
Ken


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: how to reset another app's prefs

2014-11-20 Thread Scott Ribe
On Nov 20, 2014, at 3:14 PM, Ken Thomases k...@codeweavers.com wrote:
 
 You could use -[NSUserDefaults setPersistentDomain:forName:].  You could also 
 use defaults import domain path to plist.

I never knew about that import subcommand--thanks for pointing it out. 

I suppose I could *try* reading in the dictionary and then using 
NSUserDefaults, but frankly I've found the whole caching/syncing thing to be 
buggy lately.

Has anyone actually successfully done anything like this?

Oh well, the one thing I've got on my side is that the preference which used to 
be the single most important one, is no longer important at all. (Show document 
gallery on launch. It used to be that as long as MS Word was showing the 
document gallery for the user to choose a template, it was deaf to Apple 
Events. In fact, if that was enabled in preferences, and you launched it with 
an Apple Event to open a document, it would not even open that document. All of 
which is no longer true, so at least MS straightened out that little bit of 
dementia.)

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: how to reset another app's prefs

2014-11-20 Thread Shane Stanley
On 21 Nov 2014, at 8:21 am, Scott Ribe scott_r...@elevated-dev.com wrote:
 
 Every once in a while, Word just resets some of its prefs. Every once in a 
 while, it corrupts its prefs. Every once in a while, it wedges itself due to 
 (probably) resource leaks. And so on. So periodically (+ whenever it stops 
 responding) I quit Word, copy preferences files from cached copies I keep 
 that are set the way I want, and relaunch it.

FWIW, this is a not-uncommon problem with AppleScript formatting preferences. 
It happens even if people lock the .plist. Someone plagued with it recently 
came up with this Terminal solution on the AppleScript mailing list:

do shell script asprefs=$(defaults read com.apple.applescript) ; defaults 
write com.apple.applescript \$asprefs\

Looks odd, but it might be worth a try.

-- 
Shane Stanley sstan...@myriad-com.com.au
www.macosxautomation.com/applescript/apps/


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com