Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: kMDItemTextContent... where is it?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: kMDItemTextContent... where is it?



I'm still trying to get the kMDItemTextContent from files. In particular applescript files are particularly important as I mentioned below. Since yesterday I found a spotlight importer for applescripts found here... http://code.google.com/p/google-toolbox-for-mac/wiki/GTMSpotlightImporters

So now I can search the code of applescripts using spotlight, but I still can't get the kMDItemTextContent into my project. But the importer has that information because I can use "mdimport -n -d2 filePath" from the Terminal and see the kMDItemTextContent. My question is this:

How can I ask the importer directly to return the kMDItemTextContent to me? I want to bypass spotlight and go straight to the importer. I know the importer has a function called GetMetadataForFile() but I don't know how to use functions from an importer. Can anyone help with that?

Thanks,
Hank



On Mar 5, 2009, at 1:24 PM, HAMSoft Admin wrote:

Thanks you Jonah and Adam for the quick responses. Now I understand that it's probably most efficient to read in the contents my self manually.

One final question pertaining to applescript files in particular. I can use NSApplescript to get the code of them. One problem I've found is that when NSApplescript gets their code that applications launch. As you probably know when you open a script with Script Editor, it will often launch the applications inside of a "tell application" blocks of that script in order to read in the dictionary of those applications.

Well when I use NSApplescript to get the code of applescripts it does the same thing. Applications launch! So Adam, you mentioned how QuickLook uses a plugin to generate its preview, is there a way to use that plugin to help me get applescript file code? Or maybe someone knows a better way because the way I'm doing it is unacceptable because it greatly disrupts the user experience when seemingly random applications start launching.


Thanks, Hank



On Mar 5, 2009, at 1:07 PM, Maxwell, Adam R wrote:

On 03/05/09 09:57, "HAMSoft Admin" <email@hidden> wrote:

Hi all,

I'm new to the list so please bear with me. I don't know anywhere I can search
the previous posts of this discussion board and google hasn't been any help.

http://www.google.com/search?ie=utf8&oe=utf8&q=site:lists.apple.com+spotligh t-dev+kMDItemTextContent

I'm writing a program and I need to access the contents of the files that are
returned after an MDQuery. I can get the file paths from the query and then
just read in the file contents manually, but I'm wondering if I can get this
information directly from the query results.

No, you have to read it in yourself.

http://lists.apple.com/archives/spotlight-dev/2008/Mar/msg00024.html

I'm also looking at how QuickLook can display the file contents. For example,
with an applescript file spotlight does not index their code without a 3rd
party plugin. But if I pull up the QuickLook window for an applescript file
the code is displayed. So I'm wondering how QuickLook gets the text of a file
too.

Spotlight and Quick Look are orthogonal. A Quick Look plugin reads the
content of the file and generates the preview.


--
adam



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

_______________________________________________ Do not post admin requests to the list. They will be ignored. Spotlight-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: kMDItemTextContent... where is it? (From: "Maxwell, Adam R" <email@hidden>)
 >Re: kMDItemTextContent... where is it? (From: HAMSoft Admin <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.