Trialing Script Debugger - Help would be appreciated - Part 1

Hi, and so far liking what I see.

Help would be appreciated. My apologies if the terminology I use is incorrect.

I am able to use the expression pane to see some properties but not others.
name and path of myRec works but not plain text.

The screen shots of the variables show it and the contents of the variable.

Why isn’t it working by expressions? Maybe because it is 2 words.

Thanks

Steven

Part 2 - because of 1 image limit to new user

The screen shots of the variables show it and the contents of the variable.

Part 3 - because of 1 image limit to new user

Why isn’t it working by expressions? Maybe because it is 2 words.

Let me begin by applogizing for the complexity of my answer to your question. You have stumbled into one of the more confusing and complicated areas of AppleScript.

The problem is that the term plain text has multiple meanings. AppleScript considers this term to be a data type and a synonym for the string data type. DEVONthink is using the term plain text to refer to a property within it’s content object - an unfortunate choice by the application’s developer.

The Expressions area of the Script Debugger script window evaluates all expressions in the default AppleScript context where plain text is a data type. You’ll notice that AppleScript has changed plain text to string in the error message shown.

You can make the context explicit by using the expression tell app "DEVONthink" to get plain text of myRec.

Another approach may be to do these evaluations in-line in your script:

tell application "DEVONthink"
	set myRec to ... -- the expression use used to locate the content object instance
	plain text of myRec --> content of the property
end

You can then single-step through these statements to see the results.

1 Like

Thanks for your very detailed yet understandable answer. It helped me a lot and furthered my understanding.

I tried that and it failed with the same error as before.

This worked.

I’ve run into syntax collisions in other contexts as well. The example below shows another workaround method, in this case to resolve a conflict between AppleScript’s and Adobe Illustrator’s name property. The command requires Illustrator’s «property bAl9» version of name, but AppleScript usurps and changes it to its own «property pnam» version of name.

-- get list of artboards
-- keep 'name' «property bAl9» from changing to «property pnam»
set artboardNames to run script "
tell application id \"com.adobe.illustrator\"
	«property bAl9» of artboards of current document
end tell"

I’m sure this method requires a lot of overhead, but it seems to be foolproof and works well for my purposes.

It’s not simple to resolve these collisions. Of course, Debugger’s abilities to ‘Show Raw (Chevron) Syntax’ and ‘Lookup Definition’ are fantastic tools for sorting them out. To do so, one must determine the correct raw syntax from the application’s dictionary, then see whether it survives in the raw syntax of the compiled code. If not, then the run script command can save the day.

This illustrates another reason why Debugger is invaluable for AS development.

Stan C.

@StanC

Sorry for late replay.

Appreciate very much the clarity and detail of your post.

Steven