To help organize my simple finances, I have written a series of AppleScripts to automatically generate iCal events and fill in the appropriate fields whenever a bill arrives via email and when I pay a bill.
For the payment process, once I make the payments via web browser, I print to PDF and use Hazel to automatically re-name the PDFs and sort them into the appropriate folders. At the end of this is where I want Hazel to simply run one of the scripts to create the iCal events. The scripts work perfectly on their own, but not from Hazel. Optimally, I would like the files to link to the events that are created, but I've read that is not possible with iCal via AppleScript. Instead, I just need the scripts to be activated by Hazel. Is there a way to just have Hazel run a script without it actually doing anything with the file after it has been placed in its final destination?
This is one of the scripts that I want to have activated by Hazel:
tell application "iCal" to activate
set temp to display dialog "Enter payment amount and any additional notes, separated by a comma..." default answer ""
set text_user_entered to the text returned of temp
set old_delimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to {","}
set variable1 to the first text item of text_user_entered
set variable2 to the second text item of text_user_entered
set AppleScript's text item delimiters to old_delimiters
set mainList to {"From checking", "From Credit Card1", "From Credit Card2", "From Credit Card3"}
choose from list mainList with prompt "Choose Payment Method"
set listchoice to result as text
set now to (current date)
set eStart to now + 1 * minutes
set eEnd to now + 2 * minutes
set eName to "AT&T PAYMENT MADE - $" & variable1
set theContent to listchoice & " - " & variable2
set eURL to "******"
set alarmTime to 30 -- alarm at the exact moment of the event
tell application "iCal"
set newEvent to make new event at end of events of calendar "Financial" with properties {summary:eName, description:theContent, url:eURL, start date:eStart, end date:eEnd}
end tell
display dialog "AT&T Payment of $" & variable1 & ", " & listchoice & " made and recorded."
tell application "iCal" to activate
tell application "iCal"
activate
set home_cal to calendar "Financial"
set the_event to first event of home_cal whose summary is eName
show the_event
end tell
tell application "Finder" to activate
I'm sure that this is a simple fix, but I've no clue yet. I've looked through dozens of the topics here, but there are none so far that address this.
Thanks!