• 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: syntax ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: syntax ?


  • Subject: Re: syntax ?
  • From: JollyRoger <email@hidden>
  • Date: Tue, 24 Jul 2001 08:07:15 -0500

On 7/24/2001 6:44 AM, "monk" <email@hidden> wrote:

> i see why creating a 'button' variable is more logical and useful, but
> below, i don't understand why a newfolder variable is better than just
> straight commands for a folder, can you enlighten:
>
> --this
> tell application "finder"
> make new folder at desktop with properties {name:"blah"}
> select folder "blah"

Now the end user clicks the mouse and changes the selection to another
folder. (Or worse yet, changes the selection to nothing, which would likely
halt your script with an error.)

> open selection

Oops! We opened the wrong folder!

> set size of container window of folder "juxtatext(s)" to {253, 527}
> set view of container window of folder "juxtatext(s)" to kind
> end tell

Now we have resized and changed the view of the wrong folder! Doh!

> --vs. this
> tell application "finder"
> set newFolder to (make new folder at desktop with properties
> {name:"blah"})
> open newFolder
> set size of container window of newFolder to {253, 527}
> set view of container window of newFolder to kind
> end tell

Remember that each command in your script may result in a slew of Apple
Events being sent to various applications on the computer. In general, the
fewer the number of steps in a script, the better.


References: 
 >syntax ? (From: monk <email@hidden>)

  • Prev by Date: Re: syntax ?
  • Next by Date: List with single values
  • Previous by thread: Re: syntax ?
  • Next by thread: random no. schemes
  • Index(es):
    • Date
    • Thread