Hi
Is it possible to, for example, have a script run whenever TextEdit opens a document having a certain word in it’s name?
Thanks
Guy
Hi
Is it possible to, for example, have a script run whenever TextEdit opens a document having a certain word in it’s name?
Thanks
Guy
Hi,
I’m sure that there’re lots of different ways of doing this but here is a simple way:
on idle
tell application "Finder" to name of processes
set the_result to the result
if the_result contains "TextEdit" then
tell application "TextEdit"
set doc_name_list to name of every document
repeat with this_docs_name in doc_name_list
if this_docs_name contains "test doc" then
display dialog this_docs_name giving up after 1
end if
end repeat
end tell
end if
return 5
end idle
If you save this as a Stay Open application when you run it it’ll first check if TextEdit is running and then if it is it’ll check to see if there’s a document open called “test doc” and if there is it’ll display a dialog. Not exactly what you asked for but kind of a work around in case nobody has any better ideas!!
Thanks,
Nik