Calling a script right after opening a type of file?
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.

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;test&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt; 
        &lt;string&gt;osascript&lt;/string&gt;
        &lt;string&gt;-e&lt;/string&gt;
        &lt;string&gt;try
tell app "System Events" to tell process "QuickTime Player"
set position of window 1 to {500, 500}
end
end&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;WatchPaths&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;/Users/username/Library/Preferences/com.apple.QuickTimePlayerX.LSSharedFileList.plist&lt;/string&gt;
    &lt;/array&gt;
&lt;/dict&gt;
&lt;/plist&gt;


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