I'm new to the plugins and I just want to create a very basic plugin to create a new document from any content. I will use the clipboard for demo purposes.
I know this can be done as a macro, but I want to have it as a plugin, since I want to write some other later.
this is my Keyboard Maestro Action.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Author</key>
<string>Eduardo</string>
<key>Icon</key>
<string>icon.png</string>
<key>Name</key>
<string>BBEdit - new file</string>
<key>Script</key>
<string>main.scpt</string>
<key>Parameters</key>
<array>
<dict>
<key>Label</key>
<string>content</string>
<key>Type</key>
<string>TokenText</string>
</dict>
</array>
</dict>
</plist>
this is my main.scpt content
#!/usr/bin/osascript -l JavaScript
'use strict';
(function run(argv) {
// arguments
const command = argv[0];
const tabName = argv[1];
// get app
const BBEdit = Application('BBEdit');
BBEdit.includeStandardAdditions = true;
// content
//--- GET A REFERENCE TO THE KM ENGINE ---
var kme = Application("Keyboard Maestro Engine");
var content = kme.getvariable('KMPARAM_content');
// let content = BBEdit.theClipboard();
// activate
BBEdit.activate();
// new document
BBEdit.make({
"new": "document",
"withProperties": {
"text": content
}
});
})();
whenever I run it I get the following
Library/Application Support/Keyboard Maestro/Keyboard Maestro Actions/BBEdit - new file/main.scpt:5:6: script error: Expected end of line, etc. but found “/”. (-2741)
or Library/Application Support/Keyboard Maestro/Keyboard Maestro Actions/BBEdit - new file/main.scpt:1:2: script error: Expected end of line, etc. but found unknown token. (-2741)
any ideas what could be happening?