Re: Two applications, one preference file
Re: Two applications, one preference file
- Subject: Re: Two applications, one preference file
- From: Bill Cheeseman <email@hidden>
- Date: Wed, 30 Nov 2005 17:31:58 -0500
- Thread-topic: Two applications, one preference file
on 2005-11-30 4:13 PM, Andrew Bush at email@hidden wrote:
> so I have two applications, a management app and a background daemon
> that is always running.
>
> I would like both applications to be using the same preference file for
> the UserDefaults.....is it possible to set this up?
Sure. I do that in PreFab UI Actions.
To spell it out a little more, I have a standard GUI app and a separate
background-only app that does double-duty as a sort of scripting addition as
well as an observer of notifications from the accessibility API. Both apps
have their own separate preferences files for the usual purposes, but they
also have a shared preferences file that they both use to share information.
Each of the applications sends a notification to the other when it changes
the shared preferences file, using NSDistributedNotificationCenter, and that
triggers the other to read it to get the latest information. This happens in
the GUI app when the user changes its settings, and it happens in the other
app when AppleScript changes its settings. That way, the GUI app always
reflects the status of the background app in real time, even when
AppleScript is the cause of a change to the background app; and the
background app's AppleScript properties always reflect the status of the GUI
app, even when user interaction causes a change to the GUI app. They both
read the shared preferences file when they're launched.
I use standard Cocoa facilities to do all this. There's a lot of
coordination going on to make sure it all hangs together.
If I could remember any more than that, I would spell it out even
further....
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden