Re: Searching for multiple instances of an application?
Re: Searching for multiple instances of an application?
- Subject: Re: Searching for multiple instances of an application?
- From: Paul Miller <email@hidden>
- Date: Tue, 08 Jul 2008 14:29:38 -0500
Mark Krenek wrote:
I've written an installer plugin to do this same thing - find all target
apps and let the user pick which one to update. This is done in code in
the plugin. NSMetadataQuery is Spotlight. I use it to find ALL
applications. Then I search through that list looking for
the specific apps I want (by bundle identifier or name). It may be
possible to configure a query that does that automatically. Here's
basically what I do:
query = [[NSMetadataQuery alloc] init];
[query setSearchScopes:[NSArray arrayWithObject:targetVolume]];
[query setPredicate:[NSPredicate
predicateWithFormat:@"kMDItemContentTypeTree =
'com.apple.application-bundle'"]];
[[NSNotificationCenter defaultCenter]
addObserver:self selector:@selector(_queryNotification:)
name:nil object:query];
[query startQuery];
My _queryNotification routine is where I scan the results.
Mark -
Got this all working and building a datasource for a NSTableView which
shows the supported applications. The first column uses a Checkbox
formatter so it can be toggled on/off.
I've implemented a tableView:setObjectValue:forTableColumn:row method
but when I click on one of the check-boxes, it is never called, and the
app crashes down in objc_msgSend in [NSCell setObjectValue:].
Any idea what I'm missing here?
Thanks!!
Mark
On Jul 7, 2008, at 5:50 PM, Paul Miller wrote:
Karl Kuehn wrote:
On Jul 7, 2008, at 3:35 PM, Paul Miller wrote:
I'm working on an Installer plugin that will install my stuff into
multiple copies of Photoshop (ie Photoshop CS1, CS2, CS3, CS4, etc).
So I want to search for and find all copies of an application named
"Photoshop" with a certain signature. I think
LSGetApplicationForInfo() will only get me the "default" one.
What's the best way to search for ALL of them, noting that they
might not all be in /Applications?
You probably want to use Spotlight (if you can afford to go 10.4
and above). You can do this in a script with mdfind. Building the
right find command can be a bit of an art, but you probably will only
want to look for applications with a name matching a pattern. But you
can do more, and even find things where the user has changed the
outside "name".
Yeah, we're shooting for 10.4 and up - sounds like a good approach.
Can you suggest how I could execute this script
(preinstall/preupgrade?) and query the results in my installer plugin?
Or should I just launch the script directly within the plugin and
parse the results (popen?)?
Thanks for any tips. This is all pretty new to me, though I am making
some decent progress on my installer plugin UI.
--
Paul Miller | email@hidden <mailto:email@hidden> |
www.fxtech.com <http://www.fxtech.com> | Got Tivo?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list (email@hidden
<mailto:email@hidden>)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Paul Miller | email@hidden | www.fxtech.com | Got Tivo?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden