No preview of some .applescript files

I have a folder of external files indexed in DT 3.5.2
many of the files do not show a preview
Mainly .applescript files. DT lists the Kind: Text OSA Script and has a character count.

I have moved the indexed file to the database and still no preview.

Also: How can I use prism.js to preview syntax?

DT lists the Kind: Text OSA Script

.applescript files are just Text. What do you see when you select the .applescript file in the Finder and press the Spacebar?

Also: How can I use prism.js to preview syntax?

This is only used in pre and code blocks in Markdown. It is not used in other formats.

I see a quicklook preview in the finder fine.

Document Display menu item has Text Alternative checked but they are all dis-abled.

Maybe I answered my own question…
It appears as though the applescript file must compile to show a preview.

something i had not checked yet.
If an app is not available as in tell app adobe then no preview?
So is DT decompiling to get the text for scpt?
This apparently happens when it indexes the files?

That’s probably what macOS does (as DEVONthink doesn’t handle this on its own).

Are you using Script Debugger or some app other than Script Editor?

Exporting text from filemaker…
But still have a problem with some files, but they DO compile fine.
The same result if I rewrite them with ScriptDebugger or script editor.
This fails to preview

set MyDatabase to current application's NSArray's arrayWithArray:{{|name|:"Spot", hair:"Black", Height:{|feet|:1, |inches|:2, totalInches:14}, weight:43}, {xxx:"xx"}}

and this fails to preview

set TheDate to TheMatch's |date| as date

But if its commented out it does preview

--set MyDatabase to current application's NSArray's arrayWithArray:{{|name|:"Spot", hair:"Black", Height:{|feet|:1, |inches|:2, totalInches:14}, weight:43}, {xxx:"xx"}}

this also previews

set MyDatabase to current application's NSArray's arrayWithArray:{{}}

Also, if I change the file extension to txt they preview fine!
I need them in applescript files so ScriptDebugger can use them as clippings, without trying to keep them up to date.

BUT I was thinking about using a Markdown wrapper to view them with prism so I get syntax highlighting. I am aware the builtin prism does include applescript.

Is anyone else using DT for applescript source code?

Have you been able to test this?

A zipped copy of the script would be useful.

There is more to this story…
I have a external folder indexed.
It shows previews on applescript, scpt and scptd files.
DT allows changing the text of any of these files and then saves it.

I changed a scptd file, just a comment to see what happened.
It saved with the same file extension and the date changed.
When I opened the file with ScriptDebugger it said the file extension was wrong.


The file SD was opening still had the .scptd extension.
I saved the file as a .applescript file from SD to the same directory.
It did not show in the DT indexed files.
I deleted both files from DT, then resaved to the same directory.
DT would not show the files again even after “update index files”

I did not expect to be able to edit the scpt or scptd files but maybe the applescript files since its just text.
Now I know to NOT change anything other than .applescript files.
I am glad DT3 shows a preview of all script files, even files which makes it great for searching code. Especially being able to copy the text directly from them.

BTW The new interface is Great!

So here is one of the files zipped.
Testing DT preview (1.0 KB)

The others can just be copied from the previous post and pasted into Script Editor and save as applescript text files.


The standard QuickLook mechanism in DEVONthink is working but the view/edit pane is not…

Also, edits can be made in DEVONthink but still don’t preview after reselecting the file. And the edits are happening, as shown here…

Thanks for setting the terminology straight “view/edit pane” is blank.

edit: BTW did you happen to paste the exact same text into that blank window?
It will return to a blank window!

When adding an explicit tell block (which should be in all AppleScripts), the file previews fine.

I have a suspicion what may be happening here but @cgrunenberg would have to confirm or deny my theory.
Perhaps .applescript files like you’ve constructed here are being treated as Markdown and the first line is parsed as MultiMarkdown metadata.

PS: What are you doing in the script?

These are all just code snippets. about 600 of them.
All of the “view/edit pane” blanks are AsObjc code however.

What you posted does NOT show in the view/edit pane for me.
But then It did another time so will have to get back to you on that.

The source of scripts which can’t be compiled by Cocoa is empty, the next release will fix this.

On further investigation…
Indexing 4000 scripts it happens (blank view/edit pane) on all types.
It tries to launch the target applications from the scripts as they are indexed.

Hi @georgeorwell, on the Script Debugger forum a user has published a AppleScriptObjC database in 2017 which I tried to open with his FileMaker runtime app but it crashes after start.

I’ve now downloaded a FileMaker demo and started to export as HTML manually (to access the database’s contents after the demo expired). Is exporting the current view scriptable?

File Menu Export Records is what you want.

I have done that… and rebuilt my own db in FileMaker.
The file ASObj-C Database.fmpur should be able to be opened with Filemaker 14+, and maybe its a problem with the current version 19 but I know it works in FM18.
You wont be able to change the database structure or modify the security etc, that was stripped out with the making of a runtime.
BUT you can “Export Records” data from each layout. If you use Filemaker as the type it will have all the field names just as the original was. You will have to export the other 3 or 4 layouts as well. If you have the Filemaker demo you can then rebuild the relations from file to file.
But if you are not familiar with FileMaker it could take you awhile to figure it all out. I have thousands of hours over 25 years of experience with FM so its simple to me.
You should however be able to get at the raw data fairly quickly.
Basically you will create a new calc field and concatenate many fields together in one text field then export that single field as a file.
You can also simply go record by record choose Send Sample to “Script Debugger” from the menu.
But that is not ALL of the data that is there.

I may post it in clip form on the SD Forum soon.

1 Like

I’ve done that, even filtered for each class. Took some time but worked out well via UI scripting the export dialog.

Unfortunately it doesn’t seem to be possible to send samples to Script Debugger with the FileMaker demo. When I try I get an error window saying “Either the front window is not a samples window or the script failed to recognize the window was a samples window.”

So it would be really great if you post them on the Script Debugger forum :slight_smile:

Forgot to ask: Is there other ASObjC documentation you would recommend? I have Xcode and Dash, but is there more?