1994firehawk

Q: Display a dialog box after ejecting a USB drive saying drive has been ejected

Hi, would someone please tell me how to modify the applescript below to eject my USB in 2 ways, either by waiting 30 secs or by pressing the "YES" button. Then, after the drive has been ejected another dialog box would appear saying "Drive Ejected". If the "NO" button was pressed the drive would not be ejected. My USB drive is shown as ( thisVolume ).  Thanks in advance for any help.

 

                                                            tell application "Finder"

                                                                    display dialog "Eject USB Drive" buttons {"Yes", "No"} default button 1 with title "Eject?" giving up after 30

                                                                    if button returned of result is "yes" then eject thisVolume

   end tell

 

 

 

 

                                                           

Mac mini, OS X Mavericks (10.9.5)

Posted on Jul 21, 2016 9:01 PM

Close

Q: Display a dialog box after ejecting a USB drive saying drive has been ejected

  • All replies
  • Helpful answers

  • by Niel,Solvedanswer

    Niel Niel Jul 21, 2016 9:17 PM in response to 1994firehawk
    Level 10 (311,916 points)
    Jul 21, 2016 9:17 PM in response to 1994firehawk

    Here:

     

    tell application "Finder"

    display dialog "Eject USB Drive?" buttons {"Yes", "No"} default button 1 with title "Eject?" giving up after 3

    if button returned of result is "yes" or gave up of result then

    eject thisVolume

    display dialog "Drive ejected."

    end if

    end tell

     

    (143586)

  • by 1994firehawk,

    1994firehawk 1994firehawk Jul 22, 2016 7:38 AM in response to 1994firehawk
    Level 1 (4 points)
    Mac OS X
    Jul 22, 2016 7:38 AM in response to 1994firehawk

    Thanks Niel, once again quickly and perfectly answered. I seems like the code just pops into your head!!! Well Done!!

     

    Solved,

    Thanks for your help,

    Mike.