I don't know of a way to do this with the beforeOpen event. But if you try afterOpen, you'll see that it fires twice: the first time the target is a Document object; the second time it is a LayoutWindow. If the user has opened a copy, the title of the window (target.name) will contain the word "untitled".
So maybe the best you can do is spot the problem in the afterOpen stage, which is still before the user has a chance to do anything. If you determine that he/she has opened the original, you could close it and issue a new Open() command using the OPEN_COPY.
Hope this helps.
Upon further review, maybe there is a way:
Your beforeOpen handler stores target.fullName in a variable. Then it uses preventDefault(). Always. Then it uses the open() method with the OPEN_COPY option to open target.fullName in an Untitled window.
So the users who do things the right way are treated as if they did it the wrong way. Something weird about that, but I don't think they would ever notice.
Thanks, that's a creative idea!
My plan was to give them a dialog box giving the option of opening a copy or not opening the file at all.
I could still give them this option even if they selected open a copy already. They would sometimes already have selected open as copy and it would say, "would you like to open a copy?" It would be annoying, but probably workable, it's a small workgroup.
I don't know how to set a variable that persists (using VBScript), but I can read write and read a temporary file to flag when they opted to open as copy.
Are you aware of any better way than via the file system to persist a value between event handlers in InDesign's VBScript environment?
If it were me, I'd probably stick with the afterOpen event. Then if I see something other than an Untitled window, I'd ask "Do you want to open a copy?" If the answer is Yes, then I close the document and reopen it with the OPEN_COPY option. I wouldn't want to annoy the folks who selected Copy in the first place.