I am trying to use the Passes AppleScript rule to also get some user input, but this results in an error that is confusing.
- Code: Select all
tell application "System Events"
set theResponse to display dialog "Add name for file: " & theFile default answer "" with icon note buttons {"Continue"} default button "Continue"
set theTitle to (text returned of theResponse)
return {hazelPassesScript:true, hazelOutputAttributes:{title:theTitle}}
end tell
From the log:
- Code: Select all
2024-12-06 20:59:29.841 hazelworker[29580] Error while matching rule Name zoom against file [filename]: Invalid AppleScript return value: <NSAppleEventDescriptor: { 'usrf':[ 'utxt'("hazelPassesScript"), 'true'("true"), 'utxt'("hazelOutputAttributes"), { 'titl':'utxt'("") } ] }>.
There are multiple problems I'm noticing:
1. the value entered in the dialog is lost (theTitle)
2. the return value has the name of the attribute title truncated
3. even if hazelPassesScript is set to true, executing this results in an error
How can I fix this? thank you