Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: visible of window bug



Using
	if exists window ...
instead of
	if visible of window ...
is logically equivalent and does work correctly, so I'll use it.

I can't help but wonder what could be intended of a property that always returns true?

On Nov 6, 2006, at 5:11 PM, kai wrote:


On 6 Nov 2006, at 15:40, Luther Fuller wrote:

My script said ...

set appSup to (path to application support from user domain) as alias
...
else if visible of window of folder "Folder Name" of appSup then
my doSomeStuff()
dnd if


but other parts of the script were not working properly. Finally, I found the problem and wrote this to fix the it ...

set appSup to (path to application support from user domain) as alias
...
else
try
visible of window of folder "Folder Name" of appSup
if the result then my doSomeStuff()
end try
end if


It seems that 'visible of window ...' requires the window to be visible in order to return a boolean result, otherwise it errors. Illogical!

I'm not sure that I'd use this test to achieve what (I think) you're after, Luther.


The visible property of an open Finder window is always true. As you've found, an attempt to get the visible property of an unopened Finder window will fail. Specifically, it results in an Apple Event failure: error number -10000 ["The window must be opened to get this property."]

An existence test might therefore be more appropriate for your purposes:

----------

set appSup to path to application support from user domain

tell application "Finder"
if exists window of folder "Folder Name" of appSup then my doSomeStuff()
end tell


----------

---
kai


_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/ email@hidden
Archives: http://lists.apple.com/mailman//archives/applescript-users


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/email@hidden Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden
References: 
 >visible of window bug (From: Luther Fuller <email@hidden>)
 >Re: visible of window bug (From: kai <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.