Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does any one of you know if it's possible to call a script right after opening a file.

For example : I want to relocate QuickTime in the top-left corner right next to my dock.

I know how to do it with AppleScript (the location thing) but how can I call this script automatically ?

share|improve this question

This is a bit of a hack, but try watching for changes to some file that is modified when the application opens a document.

Using launchd, you could save this as ~/Library/LaunchAgents/test.plist and run launchctl load ~/Library/LaunchAgents/test.plist.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN>
<plist version="1.0">
tell app "System Events" to tell process "QuickTime Player"
set position of window 1 to {500, 500}

It won't work if you open multiple documents in a row, because launchd runs programs only at most every 10 seconds.

share|improve this answer
Yep it works but after 10 sec. But not very practical. – Matthieu Riegler Jan 14 '13 at 18:09

Have you tried this?

Do Something When - Project

It seems like what you want...I have never personally used it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.