How are you calling the code in AppleScript Studio? Remember, in ASStudio apps there is a Obj-C application task managing the run-loop, that is what gets the open command. I am not sure how you wire it up to receive the open event (I am sure there is a way, and it is probably very easy, but I have always focused on non-document projects... my guess is that there is delegate command involved). How that helps point you in the right direction for an answer.