This is related to the 3.5 preview builds (I’m running 237).
I have an AppleScript which creates a new entry and as the last JavaScript statement it has return true. But the value that gets assigned to the AppleScript variable is missing value.
My script looks like this (I’ve removed the body of the function which is using the API to create a set of new nodes):
tell application TaskPaper
tell front document
set theResult to evaluate script "function(editor, options) { return true; }"
end tell
end tell
I wonder if it’s just that the double quotes around “TaskPaper” are missing ?
These all seem to be working here (build 237):
AppleScript:
tell front document of application "TaskPaper"
evaluate script "function(editor, options) {return true;}"
end tell
tell application "TaskPaper"
tell front document
set theResult to evaluate script "function(editor, options) {return true;}"
end tell
end tell
theResult
JavaScript
function TaskPaperContext(editor, options) {
return true;
}
var tp3 = Application('TaskPaper'),
ds = tp3.documents;
if (ds.length > 0) {
var doc = ds[0];
var result = doc.evaluate({
script: TaskPaperContext.toString(),
withOptions: {}
});
}
result;