Results 1 to 6 of 6
  1. #1
    AppleScript issue

    Member Since
    Sep 02, 2012
    Posts
    1
    AppleScript issue
    I am fairly new to AppleScript and need some help with the following line:


    do shell script "diskutil unmount \"Volumes/" & bob


    Bob is the variable of the name of the volume I want to pass to the shell script. No matter how I do it - I cannot get the end of the line correct in terms of quotes.* I get the following error in its current state

    sh: -c: line 0: unexpected EOF while looking for matching `"'
    sh: -c: line 1: syntax error: unexpected end of file

  2. #2
    AppleScript issue
    Mark FX's Avatar
    Member Since
    Aug 13, 2011
    Location
    West Sussex, UK
    Posts
    180
    Show the code for how you have set the bob variable, as I'm guessing
    that is where the problem is.

    Regards Mark

  3. #3
    AppleScript issue
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,398
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    You need to add a quotation mark at the end.

    Pretend bob has a value of external_disc. Let's construct the command now, replacing bob with the value:
    Code:
    do shell script "diskutil unmount \"Volumes/external_disc"
    See the problem? You've started putting quotation marks around the volume name but didn't put a closing one. You've also forgotten to put a forward slash before Volumes.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  4. #4
    AppleScript issue
    Mark FX's Avatar
    Member Since
    Aug 13, 2011
    Location
    West Sussex, UK
    Posts
    180
    As vansmith has eluded too, you have three quotation marks, and also
    a backslash before Volumes, that should be a forward slash.

    Try something like this.

    Code:
    set myVolume to "bob"
    do shell script "diskutil unmount /Volumes/" & myVolume
    Regards Mark

  5. #5
    AppleScript issue
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,398
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    The backslash before the second quotation mark may be there on purpose though if he's trying to escape it so as to put the volume path in quotation marks (perhaps the volume name has a space?).
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  6. #6
    AppleScript issue
    Mark FX's Avatar
    Member Since
    Aug 13, 2011
    Location
    West Sussex, UK
    Posts
    180
    That's possible, but he still needs to have forward slash in front of Volumes, to indicate
    its off of the root path.
    Also I suspect he is building his bob variable as a alias HFS type path, instead of a POSIX
    style path, but we'll see.

    Mark

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. New user:preferred networks issue:clock issue:mail issue
    By Snooky in forum Switcher Hangout
    Replies: 0
    Last Post: 10-31-2011, 04:27 PM
  2. applescript
    By Lex in forum OS X - Apps and Games
    Replies: 5
    Last Post: 03-12-2011, 12:26 AM
  3. Applescript
    By nastyveg in forum OS X - Apps and Games
    Replies: 3
    Last Post: 01-20-2011, 04:31 PM
  4. Filemaker Pro 7 applescript issue
    By angsar in forum OS X - Operating System
    Replies: 0
    Last Post: 05-29-2010, 06:57 AM
  5. Applescript Help
    By jmullenberg in forum Internet, Networking, and Wireless
    Replies: 1
    Last Post: 06-23-2008, 02:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •