If Apple Script Returns True

Hi, looking at the "Action Sequence Flow Control" category I've found interesting actions like "If Condition" and "If Java Script Returns True".
Since a lot of people still use Apple Script, and I use it a lot in BTT too, it would be great a command like "If Apple Script Returns True", or maybe add a condition in the "If Condition" action related to a "Run Apple Script" that you have to add immediately after.

Thanks

+1

It would be useful to me also

You can easily run Apple Script from within the Java Script:

let appleScript = `
    set theDialogText to "The curent date and time is " & (current date) & "."
    set result to display dialog theDialogText
    return result
`;

let result = await runAppleScript(appleScript);

Or shell scripts:

let shellScript = `say hello world`;


let shellScriptWrapper = {
    script: shellScript, // mandatory
    launchPath: '/bin/bash', //optional - default is /bin/bash
    parameters: '-c', // optional - default is -c. If you use multiple parameters please separate them by ;; e.g. -c;;date
    environmentVariables: '' //optional e.g. VAR1=/test/;VAR2=/test2/;
};

// this will execute the Apple Script and store the result in the result variable.
let result = await runShellScript(shellScriptWrapper);

Or even shortcuts from the shortcuts app:

  let shortcut = "some name";
  let input = "some input";
  let result = await runAppleShortcut({name: shortcut, input: input});
2 Likes

Thank you! I will try it soon!!