Problem with SD8 and Spotlight

I realized today that Spotlight stops to find any search string in compiled scripts’s text content.
Don’t know when it starts. Maybe when I re-installed SD7 next to SD8?

.scpt files can be found by their names.
.scptd and .applescript files’s content is searchable.
If I convert a scpt to scptd, Spotlight can read its content.

It seems I have an issue with SDimporter.mdimporter.
How can I fix it?
Re-install SD8?

[I’ve restarted my Mac half a dozen of times]


MacOS 12.6.1 (21G217)
Script Debugger 8.0.5 (8A61)

1 Like

I can reproduce the problem here. I saved a new script in .scpt format and SD’s Open Quickly couldn’t see it, but when I saved the same script in .scptd format SD’s Open Quickly could see it immediately.

I suspect you are right that its an importer issue, but we’ll have to investigate to figure out why SD’s importer isn’t being used for .scpt files.

1 Like

For a compiled script that isn’t being found by Script Debugger’s Open Quickly, please use this Terminal command to identify the importer being used on your system:

mdimport -t -d2 /path/to/script-name.scpt

Here’s the result:

Imported ‘/Users/Shared/Scripts partagés/Scripts User/Scripts/Applications/Finder/10)Affichage/01)Fenêtre Active Position 1.scpt’ of type ‘com.apple.applescript.script’ with plugIn /Applications/Script Debugger.app/Contents/Library/Spotlight/SDImporter.mdimporter.

Thank you - that is the correct importer. This confirms that the importer is somehow not indexing this type of file correctly. We’ll look into the problem further at this end.

1 Like

Thanks. Hope this is not a macOS issue.

Probably. There’s no way of controlling which importer is loaded by the system.

1 Like

What I meant was: is it possible that SD7 importer has corrupted SD8 one?
Because SD7 is no longer installed and the issue is still there.
I’ve restarted macOS, reset Spotlight, cleaned everything related to SD7 I could find, used Cocktail to clean user caches… all that without any success.

Can you reproduce the issue at your end?

No.

Yes, I have at various times. It’s easy to confuse the system, and sometimes I’ve had to resort to using lsregister to fix things. Last I tried, the system kept wanting to use an rtf importer.

Hi Mark & Shane, have you made any progress on this issue?
Are we sure it’s an importer problem?

No luck so far – and yes, it looks like an importer issue.

This is very bad news for me.
I’m constantly using Spotlight to pick-up snippets when creating or updating scripts.
And there is more of a thousand of scripts to search in…

We continue to try and figure out what’s going wrong.

It appears as though Script Debugger’s Spotlight importer is not being invoked for some file types despite Spotlight indicating that Script Debugger’s importer is the one it will use for these file types. This is confounding and debugging is difficult under current macOS versions where security restrictions don’t permit direct invocation of Spotlight importers.

Mark, I’m sure you’re doing your best. No doubt.
What I’m afraid of, is that we’ll find that the culprit is macOS (as you seem to suggest).
Will Apple make it easy to debug any issue related to AppleScriptObjC?
Or must we plan to save all scripts in text format and compile them on opening?

I have to imagine that in some way Script Debugger’s importer isn’t packaged correctly and has fallen afoul of some rule we are not yet aware of.

If we are talking about Spotlight queries then I don’t see any reason Apple would prevent your script’s use of the public APIs. The problem is that spotlight depends on meta-data generated by importers and if importers are failing, your search results will be incomplete. Despite the fact that this causes your script to fail, this isn’t your bug.

There’s something I discovered today:
I’m using HoudahSpot to make my Spotlight queries.
Here is how it sees some of my scripts:


After some investigations, I can say this happens only for scripts that were saved by SD 8.0.5.
All other compiled scripts (saved with versions <= 7.0.13) are displaying normally (even if their textual content remains inaccessible by Spotlight).
Maybe it can help to find what’s going on?

1 Like