..: lorelei pepi . com :..

AppleScript Freelance Hours Reminder

Posted on December 18, 2011

 

I need a reminder when I’m working a freelance job to pop open my “hours logged” tracking document. I’m on a Mac, and I’ve finally been able to create a “folder action” for my jobs folder that will pop up a reminder when I open the folder and ask me if I’m logging my hours. If I say “no” then nothing happens. If I say “yes,” then it will open up MS Word and my document. Finally! Jeez, it took me way too long. I tried way too many other things, and this concoction finally worked.

Here’s the script for anyone that might want to use it. Alter the path to list to be your own folder structure.

– – – – – – – – – –

property dialog_timeout : 30 — set the amount of time before dialogs auto-answer.

on opening folder this_folder
try
tell application “Finder”
– -get the name of the folder- –
set the folder_name to the name of this_folder
end tell

– -create the alert string- –
set alert_message to (“Log Your Hours?” & return) as Unicode text

display dialog the alert_message buttons {“Yes”, “No”} default button 2 with icon 1 giving up after dialog_timeout
set the user_choice to the button returned of the result

if user_choice is “Yes” then
tell application “Microsoft Word”
– -go to the desktop- –
activate
– -open the document- –
open “Users:youraccount:folder:folder:Document.docx”
end tell
end if
end try
end opening folder