• 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 works in OS 9 but not in OS X please help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script works in OS 9 but not in OS X please help


  • Subject: Re: Script works in OS 9 but not in OS X please help
  • From: Matthew Smith <email@hidden>
  • Date: Wed, 13 Feb 2002 15:13:44 +1100

If you want the name of every disk then you need to do:

tell app "Finder"
set disk_list to name of every disk
end tell

The list will have the names of the disks without the colon.

If you want to determine if a disk exists then you can say:

tell app "Finder"
if disk "Bondi" exists then
display dialog "I have found it"
else
display dialog "Not here"
end if
end tell

I cannot work out why you had a repeat loop. You don't seem to use t_disk at
all within it, although it looks like you have cut out some code.

--
Matthew Smith

> This script works just fine under OS 9 and prints out "Its here" when
> theItem is set to a valid name, but fails under X with this message:
> Finder got an error: Can't make {startup disk, disk "MacOS X} into a
> text.
> I believe its having trouble converting the names of my mounted disks
> into text strings, but the bigger question for me as a novice AS user is
> what are the differences in creating scripts under 9 and X. I've seen
> nothing anywhere that suggests there are differences.
> Thanks
> tell application "Finder"
> set disk_list to disks
> set theItem to "Bondi:"
> set i to 0
> repeat with t_disk in disk_list
> set i to i + 1
> set t_offset to offset of theItem in disk_list
> if t_offset is greater than 0 then
> display dialog "Its here!"
> return i
> else
> display dialog "Not here!"
> end if
> end repeat
> end tell
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Son of Y2.401K
  • Next by Date: Re: Since Apple Listens to this List... [Case Statements]
  • Previous by thread: Script works in OS 9 but not in OS X please help
  • Next by thread: Son of Y2.401K
  • Index(es):
    • Date
    • Thread