Finding the name of a USB volume

Richard Gaskin ambassador at fourthworld.com
Wed Jan 6 18:31:07 EST 2010


tsj wrote:
> Richard - I haven't got an unnamed USB drive handy to test this with but
> what does the volumes function return when one is mounted? Does this give
> you the expected "untitled" (or "untitled 1" etc)?
>
> If so, you could iterate through the listed volumes using a couple of
> applescripts to determine whether the drive was local (false if it's a
> network drive) ejectable (false if it's internal) and then if you get two
> false results you can attempt to open a file on the volume. If that gives
> you an error then the drive is write protected. If it passes all tests then
> you're left (presumably) with an external USB or Firewire drive.
>
> The relevant applescript snippets are...
>
> tell application "System Events" to get the local volume of disk
> [volumepath]
>
> tell application "System Events" to get the ejectable of disk [volumepath]
>
> Would that do it?

Works a treat!  And simpler than parsing the XML data from system_profiler.

Thanks!

--
  Richard Gaskin
  Fourth World
  Rev training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com
  revJournal blog: http://revjournal.com/blog.irv



More information about the use-livecode mailing list