Jump to content

Conditional Utility 'is equal to' operator not matching string values correctly


Recommended Posts

Posted (edited)

I have a workflow with a 'Run Script' object set to 'osascript'


 

tell application "System Events"
    set frontApp to name of first application process whose frontmost is true
end tell

if frontApp is "Agenda" then
    return "Agenda"
else
    return "Other"
end if

 

This is connected to an Args and Vars object that stores {query} in {var:active_app} 

 

Conditional Utility:

if '{var:activeapp}' 'is equal to' 'Agenda' (Ignoring Case) then 'Agenda' 'else' 'Other'

After this, I have 'Copy to Clipboard' objects connected to the two outputs of the Conditional Utility, and they both print {var:active_app} as well as some text identifying the path ('Agenda Output' and 'Other Output'). However, even when {var:active_app} is 'Agenda', I get the 'else' path. I don't understand why 'Agenda' is not being evaluated as equal to 'Agenda'? 

 

For now, I've changed my script to return 1 when the frontApp is "Agenda"
 

tell application "System Events"
    set frontApp to name of first application process whose frontmost is true
end tell

if frontApp is "Agenda" then
    return 1
else
    return 0
end if

 

And then the Conditional Utility to evaluate if '{var:active_app)' 'is true'

 

This works and I get the 'Agenda' path when Agenda is active and the 'else' path when any other app is active.

 

Perhaps I'm missing something, but it feels like there's a bug in the way that 'is equal to' is being evaluated, because if the variable prints as 'Agenda', and 'is equal to' is set to 'Agenda', why is it not matching?

 

Thanks

 

Edited by Alex
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...