Skip to content

Issue with the JXA Application.currentApplication() Object #27

@JMichaelTX

Description

@JMichaelTX

I get an error in VSC using Code Runner with this script:

#!/usr/bin/env osascript -l JavaScript

var app = Application.currentApplication();
app.includeStandardAdditions = true;

console.log("Test Get app name");
var appProp = app.properties();  // <== fails on this line
appProp.name;

/*
ERROR MSG:
117:148: execution error: Error on line 6: Error: Message not understood. (-1708)

NOTE:  Even though it says "line 6", the actual line is 7, as line 6 outputs correctly.
For completeness here's the entire Code Runner output:

[Running] /usr/bin/env osascript -l JavaScript "/Users/Shared/Dropbox/SW/DEV/JXA/VSC/Test Using CodeRunner Ext.js"
Test Get app name
/Users/Shared/Dropbox/SW/DEV/JXA/VSC/Test Using CodeRunner Ext.js:117:148: execution error: Error on line 6: Error: Message not understood. (-1708)

[Done] exited with code=1 in 0.11 seconds

*/

This same script, without the shebang, runs fine in Script Editor.

image

What am I doing wrong in VSC?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions