• 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: Looking for a disk in disks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Looking for a disk in disks


  • Subject: Re: Looking for a disk in disks
  • From: Rob Jorgensen <email@hidden>
  • Date: Sun, 28 Oct 2001 16:14:27 -0500

On 10/28/2001, Mark Bjfrgager commented:

How can I test if a certain volume is mounted on the mac ?

I am trying to use

Tell app "Finder" to set theDisks to the disks
If "home" is in theDisks then beep

Only it never does, how can use this ?

This appears to work on my setup (OS 9.1/AppleScript 1.6/various scripting additions):

-- Begin Snippet 1 --

tell application "Finder" to set theDisks to name of disks

repeat with i in theDisks
if contents of i is "home" then beep
end repeat

-- End Snippet 1 --


This one works too, but it wouldn't be specific if more than one disk name contained "home".

-- Begin Snippet 2 --

tell application "Finder" to set theDisks to name of disks
if theDisks contains "home" then beep

-- End Snippet 2 --

The decision of which one to use depends on what you want to do if "home" is present in theDisks.


Later,

Rob Jorgensen
Ohio, USA


References: 
 >Re: Next new AppleScripter question :) (From: Bill Cheeseman <email@hidden>)
 >Looking for a disk in disks (From: Mark Bjærgager <email@hidden>)

  • Prev by Date: [ANN] Report on AS 1.7 updated
  • Next by Date: Keychain weirdness?
  • Previous by thread: Re: Looking for a disk in disks
  • Next by thread: Re: Looking for a disk in disks
  • Index(es):
    • Date
    • Thread