Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Enthusiast Zone > Classic Macs and Mac OS > AppleScript if {}

AppleScript if {}
Thread Tools
Addicted to MacNN
Join Date: Sep 2000
Status: Offline
Reply With Quote
Oct 12, 2001, 04:49 PM
I have a script that goes as follows

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
set getwin to (list windows)
if getwin is <font color = red>"windowcheckfail"</font> then
display dialog <font color = red>"You must have a web site loaded to use this application."</font> with icon note default button <font color = red>" OK "</font> buttons <font color = red>" OK "</font>
end if

Now if no windows are open, then getwin is nothing:

And here is the result
--&gt; {}
Now I want it to bring up an error when the result is nothing... but what exactly is nothing?

if getwin is "" didn't work for me... any ideas?
I always use protection when fscking my Mac... Do you?
Forum Regular
Join Date: Feb 2001
Status: Offline
Reply With Quote
Oct 13, 2001, 12:56 AM
Instead of "", use {}.

Reply With Quote
Oct 13, 2001, 01:38 AM
As a note you don't need to alert the user if there are no windows.

<font face = "courier">
tell application "My Great Application"
if windows is not {} then
--perform your actions here
end if
end tell

Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Privacy Policy
All times are GMT -4. The time now is 12:24 AM.
All contents of these forums © 1995-2015 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2015, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2