Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Basic script blues ;-)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Basic script blues ;-)




Le 27 mars 05, à 20:15, Andrew Oliver a écrit :

The second script fails because of the line:

set Folder1 to folder ("IBM 01:Users:parents:Desktop:Foo")

If this folder doesn't exist it generates an error.

I do not understand your explanation, Andrew. The folder "Foo" always exists...

This error is caught by
the 'try' handler and your script drops to the (non-existent) error handler.


In other words the script doesn't get to the 'if not (exists...' line
because it was unable to get the folder in the previous script.

One way of rewriting this would be to:

try
  tell application "Finder"
    set Folder1 to folder ("IBM 01:Users:parents:Desktop:Foo:")
  end tell
on error
  -- we get here if the above line fails
  make new folder at folder "IBM 01:Users:parents:Desktop:Foo:" with
properties {name:"Folder2"}
end try

This version of the script does not compile...

Thanks a lot for your help anyway.
Bernard


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Basic script blues ;-) (From: Andrew Oliver <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.