- Code: Select all
-- Need to get the Statement Date from the user in yyyy-mm-dd format
-- Current Date for default value
set currentYear to year of (current date) as string
set monthAsNum to month of (current date) as integer
set currentMonth to monthAsNum as string
set currentDay to day of (current date) as string
set curDate to (currentYear & "-" & currentMonth & "-" & currentDay) as string
tell application "System Events"
set statementDate to text returned of (display dialog "What is the statement date?" default answer curDate buttons "OK")
end tell
return {hazelPassesScript:true, hazelOutputAttribute:statementDate}
This runs, provides me with a dialog box (and a default date of today), and does everything except return a value. I've defined a custom attribute StatementDate as a text attribute in the names of custom attributes the script exports. When I run this code from Script Editor, I see the result:
- Code: Select all
{hazelPassesScript:true, hazelOutputAttribute:"2018-10-31"}
But in Hazel, the StatementDate is blank. I have added a condition to check that it is not blank, and that condition always fails. I'm fairly new to AppleScript and Hazel, so this may be easy, but I can't seem to find any entry in the forum explaining this. Any help would be much appreciated.
Thanks,
Carl