• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: script differences ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: script differences ?


  • Subject: Re: script differences ?
  • From: Shane Stanley <email@hidden>
  • Date: Sun, 11 Oct 2015 23:30:09 +1100

On 11 Oct 2015, at 11:15 PM, Jean-Christophe Helary <email@hidden> wrote:

I'd like to know what is technically different between the two approaches. Is the second one "better" ? If yes, why ? What is there to learn from the approach adopted in the second one ? Is there anything wrong with the first approach ?

Neither is better or worse. Generally, the "with properties" approach is a bit faster, especially if there are several properties involved. In some cases it is required -- for example, where the property cannot be changed once the object is created.

It can also be useful in other ways. For example, suppose you have a folder on your desktop called 'Some test folder'. If you run this:

tell application "Finder"
make folder at desktop with properties {name:"Some test folder"}
end tell

you get an error. If you run this:

tell application "Finder"
set theFolder to make folder at desktop
set name of theFolder to "Some test folder"
end tell

you get an error, and you're also left with an untitled folder.
 
-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

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

This email sent to email@hidden

References: 
 >script differences ? (From: Jean-Christophe Helary <email@hidden>)

  • Prev by Date: script differences ?
  • Next by Date: Rép: script differences ?
  • Previous by thread: script differences ?
  • Next by thread: Re: script differences ?
  • Index(es):
    • Date
    • Thread