Hi,
How can I output variables (not a query) from jsx?
I want to output two separate variables from this script:
const frontmost_app_name = Application('System Events').applicationProcesses.where({ frontmost: true }).name()[0]
const frontmost_app = Application(frontmost_app_name)
function run() {
if (['Google Chrome','Google Chrome Canary','Chromium','Opera','Vivaldi'].indexOf(frontmost_app_name) > -1) {
var current_tab_title = frontmost_app.windows[0].activeTab.name()
var current_tab_url = frontmost_app.windows[0].activeTab.url()
} else if (['Safari','Safari Technology Preview','Webkit'].indexOf(frontmost_app_name) > -1) {
var current_tab_title = frontmost_app.documents[0].name()
var current_tab_url = frontmost_app.documents[0].url()
} else {
throw new Error('You need a supported browser as your frontmost app')
}
console.log({"alfredworkflow": {"variables": {"var1": current_tab_url, "var2": current_tab_title}}})
}
These are then sent to a notification: https://www.dropbox.com/s/6jpnigr1g6vd1g3/Screenshot 2018-03-27 10.45.57.png?dl=0