Re: save documents problem (reprise)
Re: save documents problem (reprise)
- Subject: Re: save documents problem (reprise)
- From: Charles Bennett <email@hidden>
- Date: Thu, 01 Aug 2002 20:49:59 -0400
Paul Berkowitz wrote:
On 8/1/02 3:40 PM, "Charles Bennett" <email@hidden> wrote:
Here it is. All that is running is script editor, Word and Finder
tell application "System Events"
set theApps to the name of every process whose visible is true
end tell
repeat with i from 1 to (count theApps)
set theAppName to item i of theApps
if theAppName is not "Finder" and theAppName is not "Script Editor" then
tell theAppName to save documents
end if
end repeat
NOW I get the 'Can't get every document of "Microsoft Word"' error
and if Text Edit is running instead of Word then it tosses the error.
You're just telling a NAME (a string), not an application. You have to tell
the application.
tell application theAppName to save documents
Because you're not using any application-specific keyword, that will
compile and should work, if Word and TextEdit both use the Standard Suite
raw code for 'document' which they probably do. If not, you'll have to add
more 'ifs' and tell the specific application.
Are you sure you won't get a few more apps whose visible is true but which
don't know about 'documents'? By the way, you should be telling the Finder,
not System Events. Apparently it may not always be System Events doing this,
but the Finder will always pass it on to whoever is.
I must have dropped 'application' somewhere, I would have sworn
that it was working though. Oh well, now I really have to dig into CVS and
see if it is correct on a branch somewhere.
The only reason I used "System Events" is that I was following the "System Events" vs "Finder"
discussion, on this list,back in june and came away with the impression that we were supposed
to move over to "System Events" instead of Finder.
I won't even pretend to know why, as it should be obvious that I'm a novice at AppleScript,
but I though I read that "Finder" was being marked as obsolete or legacy or something.
Thanks again,
Chuck
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.