Invalid AppleScript return value

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Invalid AppleScript return value 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
alex
 
Posts: 10
Joined: Mon Sep 12, 2011 3:49 pm

Re: Invalid AppleScript return value 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.
Mr_Noodle
Site Admin
 
Posts: 11685
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support