Spotlight importer: how to hide the actual file name? - macos

I have a Mac shoebox app with a custom data format. I'd like to add Spotlight support.
From what I read, the recommendation seems to be to define a custom UTI file type and create one file of that type for each "record" in my app as a reference to the actual "record" that my app can then make sense of when the user clicks on a search result.
So far so good. My custom Spotlight importer works and indexes my "reference" files. They show up in Spotlight.
However, the file name reveals that this is my custom "reference" file. From a user's perspective that does not make sense.
Is there a way to hide or replace what is shown as file name and path in Spotlight?
Also, if a users presses Command while clicking on the search result, the file is revealed in Finder. In my case in the Library/Caches/Metadata/MyApp folder. That's not what I want… I don't want users to see this folder, because it reveals internals about the app.
EDIT:
In a way, my app is similar to a Core Data app with a database, only that I'm using a custom data format. With Core Data, the user also does not see the actual database file.

Try providing a value for kMDItemDisplayName

Related

Is there a way to get table contents from 3rd party UWP application?

There is UWP application which has a table with data and no built-in way to export it anyhow.
Is there a way to "spy" on the window to at least get raw text content of the table, or all text of whole window?
Can WinAPI be used here, I wonder? Even the most "perverted" way will do.
EDIT: To clarify,
acceptable case: to get table contents "manually" as temporary measure;
desired case: to get table contents from within my own application.
If you just need a tool to see the UI contents, Windows SDK Inspect.exe could help you.
https://msdn.microsoft.com/en-us/library/dd318521(v=vs.85).aspx
If you want to write a program to interact with UI contents, use the Windows UIAutomation library. https://msdn.microsoft.com/en-us/library/windows/desktop/ee684009(v=vs.85).aspx. Previous url also shows some info on UIAutomation.

Generate custom Finder thumbnails for some file types

I'd like to be able to generate my own thumbnails for some image files with custom extensions (say, a .canon file that is really a TIFF), so that Finder would use them.
I don't want to change the file contents (nor am I interested in the embedded tiff thumbnail).
Creating the thumbnail from the file's contents would be easy, the tricky part is integration. Does anyone know if it's possible?
The custom extensions won't be associated to any/other app.
I've done a lot of iOS development but know very little about OS X components.
If it's not possible to use Finder at all, is it at least possible to store the thumbnails in resource forks and have them used by, say, a custom filesystem browser?
File thumbnails, as well as full-size previews (which are displayed when you tap the space bar), can be generated dynamically by Quick Look plugins for any file type that they're registered for. The thumbnails do not need to be stored in the file, although you can certainly use pregenerated thumbnails if they're already in there.
For more information on Quick Look, please refer to Apple's Quick Look Programming Guide.

How to show photos in Dropbox Chooser window by default?

My application accepts photographs from end-users. They will most likely select pictures that are recently taken. The initial view of Chooser, which shows the file structure of the user's Dropbox folder is therefore far less useful compared to the Photos view. Is there a parameter than can be passed to make the window opens to that view? Just a matter of saving an inevitable click.
I tried to examine the source code but the library appears to be written in Coffee.
There's no way to open a specific folder in the Dropbox Chooser. You can make the UI a bit nicer by using the extensions option to specify only image file types.

Why does previously saved data not appear in opened document of Core Data app?

I have created the Core Data app that is outlined in this tutorial by Apple using XCode 4. All works fine however when I save the document and reopen it the document window is empty and no data is shown.
When I check the data file, I can actually see the saved data in the file (only for XML format as other formats are unreadable). This problem rises for all of the supported save formats (XML, binary and SQLLITE).
There are no stacktraces in the debugger. All looks fine...
Found it. You need to check the "Prepares content" checkbox on the controller (attributes inspector pane of the Array Controller) otherwise data is not shown.

Can I inspect a Core Data model from Xcode?

Can I inspect a Core Data model from Xcode?
I want to see if the data are correctly stored into the database.
You can use this tool http://christian-kienle.de/CoreDataEditor
You can inspect all datas from your persistent store
There's no direct "show me some data stored at some path I specified somewhere in my code or at runtime that happens to use this model" feature.
If you want to view a file easily in Xcode, you'll need to add the file to your project (don't let it copy into project - just reference it in place) so you can select it in the navigator.
Caveat: This only works for text-based store types (like XML or some custom text-based store type you cooked up). If you use binary or SQLite store types, all you'll see is binary. There's no SQLite database browsing/editing functions in Xcode.
I have not come across a way to check the Core Data Modal directly from Xcode... right now I use "SQlite Database Browser" to check my database... its a good way to check your data in the database.. you can also execute queries on it...
P.S. If you do come across a way to check the Core Data Modal directly from Xcode, please do post it as an answer here...

Resources