Application Handler Question

Hey all,

I’m pretty new to applescript and I was wondering how to make a handler for an application to detect when the application is opened by double clicking on a connected document. For example if i was using this with microsoft word it would detect when word was opened by double clicking on a text document.



An AppleScript app like this:

on open file_list
set first_item to item 1 of file_list
set t to read first_item
run script t
end open

can be set to open a text file like this:

tell app “Finder”
set f to exists process “Microsoft Word”
end tell
display dialog (f as string)

by setting the text file’s app to open to the script app.