Page 1 of 1

Invalid AppleScript return value

PostPosted: Fri Dec 06, 2024 3:07 pm
by alex
Hi,

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

Re: Invalid AppleScript return value

PostPosted: Mon Dec 09, 2024 9:40 am
by Mr_Noodle
First off, please do not post Hazel questions in the Forum/Site discussion forum. That is for issues with this site.

I'm guessing "title" is a reserved word? Try using a different name.