Using Script Editor in OS X (10.3) I try:
set x to name of document 1 of application "Microsoft Word"
while Word is running and with a new black document open (unsaved). I get, when I evealuate this: “Document1”
But now I try to abstract a little and create a function:
on topDoc(prog)
return document 1 of application prog
end topDoc
set x to name of topDoc("Microsoft Word")
and I get an error: ‘Microsoft Word got an error. Can’t get name of document “Document1”.’
Can anyone explain this?