• 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: Mounting and Dismounting local or server volumes on Tiger
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mounting and Dismounting local or server volumes on Tiger


  • Subject: Re: Mounting and Dismounting local or server volumes on Tiger
  • From: Dave Lyons <email@hidden>
  • Date: Tue, 18 Oct 2005 20:35:39 -0700

DAL:
If a scripter really wants to get a disk name from "list disks" and then use it with Finder, I merely suggest being explicit about it: [..."eject disk foo" vs "eject foo"...]

On Oct 18, 2005, at 8:08 PM, John C. Welch wrote:
Well, to the casual scripter, they are. High level language. They expect the Finder to be smart enough to look for something that can be ejected with that name and eject it. If you aren't a programmer or a geek, it's perfectly logical.

But there are limits to what the system can infer:

	tell application "Finder"
		every item of disk "BLAH"
			--> { ...a list of the items, as expected... }

		every item of "BLAH"
			--> { "B", "L", "A", "H" }   -- doesn't even run any Finder code
	end tell

In a narrow context like "eject <something>" I agree that it's nice for Finder to figure out that you mean a disk, but I would recommend scripters use Finder objects whenever it makes sense, because once you get into the habit of using "just a string" where you could use a richer object, you'll run into cases like the above.

Another example (which I admit to tripping over more than once, before my fingers learned better):

	tell "Finder" to get item 1
		--> "F"

	tell application "Finder" to get item 1
		--> startup disk of application "Finder"

AppleScript might be able to figure out, sometimes, that I meant to tell an application something, rather than a string. But it couldn't tell in every case, so it would be unreliable.

Maybe the error messages could be improved, though:

	tell "Finder" to make new folder

	--> Alert:
		AppleScript Error
		"Finder" doesn't understand the make message.

Perhaps it could offer a guess:
--> Alert: The string "Finder" doesn't understand the make message. Perhaps you meant 'application "Finder"'.


Do others trip over this? I'll file it in Radar if someone thinks it's worthy.

Cheers,

--Dave

_______________________________________________
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: Mounting and Dismounting local or server volumes on Tiger (From: "John C. Welch" <email@hidden>)

  • Prev by Date: Re: Excel Scripting
  • Next by Date: Slow script with long lists
  • Previous by thread: Re: Mounting and Dismounting local or server volumes on Tiger
  • Next by thread: Re: Mounting and Dismounting local or server volumes on Tiger
  • Index(es):
    • Date
    • Thread