Re: Waiting for the disk to Eject
Re: Waiting for the disk to Eject
- Subject: Re: Waiting for the disk to Eject
- From: CK via AppleScript-Users <email@hidden>
- Date: Fri, 29 Jul 2022 05:47:26 +0100
Hi Christian,
Your script below is functionally identical to:
tell application "Finder" to eject every disk
(plus the `say` command at the end). There’s no risk of accidentally ejecting
disks that aren’t ejectable, and it’s one of very few instances where Finder
doesn’t complain about it.
CK
> On 23 May 2022, at 17:48, Christian Boyce via AppleScript-Users
> <email@hidden> wrote:
>
> Hi Gil. This is what I do:
>
> use AppleScript version "2.4" -- Yosemite (10.10) or later
> use scripting additions
>
> tell application "Finder"
> set theDisks to every disk whose ejectable is true
> repeat with aDisk in theDisks
> eject aDisk
> end repeat
> --activate
> --display dialog "Ready to disconnect. All disks are ejected."
> say "It's OK to disconnect your MacBook Pro. All of the disks have been
> ejected."
> end tell
>
> As you can see, I have commented out a couple of lines that I thought were a
> good idea once.
>
> This mostly works. Sometimes a disk is busy and in those cases I get an alert.
>
> c
>> On May 23, 2022, at 5:00 AM, Gil Dawson via AppleScript-Users
>> <email@hidden> wrote:
>>
>> Hi, Christian--
>>
>> Thanks for the offer. Yes, I would appreciate your sending me a copy of
>> your script to eject all disks. I would love to study it.
>>
>> --Gil
>>
>>
>>> On May 22, 2022, at 6:32 PM, Christian Boyce <email@hidden>
>>> wrote:
>>>
>>> Hi Gill. I have the same sort of set up and what I’ve done is make an Apple
>>> script that ejects all external discs and then says, out loud, “it’s OK to
>>> disconnect your Mac. Everything has been ejected.“ I trigger that
>>> Applescript with a keyboard shortcut, wait for the message, and then
>>> disconnect everything. Your idea sounds very clever and if it works, I
>>> might do the same. In the meantime, this works for me. I don’t have the
>>> script handy as I am not at my desk but I can send it to you if you want. I
>>> can’t remember whether I used the finder or disk utility to unmount the
>>> disks.
>>>
>>> —
>>> Christian Boyce
>>> 424-354-3548
>>>
>>>> On May 22, 2022, at 5:38 PM, Gil Dawson via AppleScript-Users
>>>> <email@hidden> wrote:
>>>>
>>>> I use my MacBook Pro away from my desk a lot. When it's at my desk, I
>>>> plug it in to power, a big screen, my phone and a back-up disk. To take
>>>> it away, I have to wait until the back-up disk finishes ejecting before I
>>>> can remove all the plugs. Not a big chore, but I'm thinking that maybe I
>>>> could eliminate that wait, in many cases, with an AppleScript.
>>>>
>>>> I'm thinking of writing an AppleScript to Eject the back-up disk then
>>>> re-mount it when it's time to perform the next back-up. Something like
>>>> the following:
>>>>
>>>> Every so often...
>>>>
>>>> If the back-up disk is mounted T T T T F F F F
>>>> If Time Machine is busy with a backup T T F F T T F F
>>>> If the last backup was less than two hours ago T F T F T F T F
>>>>
>>>> (Shouldn't Happen) * *
>>>> Put a warning on the screen Y Y Y Y
>>>> Take the warning off the screen Y Y
>>>>
>>>> Mount the Back-up Disk Y Y
>>>> Eject the Back-up Disk Y Y
>>>>
>>>> My questions are:
>>>>
>>>> 1. Has this been done, perhaps with an AppleScript or an app?
>>>>
>>>> 2. The warning is to tell me that the back-up disk is busy, so don't pull
>>>> the plug.
>>>> Used to once was, the Time Machine icon in the menu bar would twirl
>>>> backwards.
>>>> Now what would be a good warning? Turn the desktop red?
>>>>
>>>> 3. I'll need actual code to implement the primitives in the above decision
>>>> table.
>>>> Has anyone done any of these?
>>>>
>>>> I'm looking forward to your comments and suggestions.
>>>>
>>>> --Gil
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> AppleScript-Users mailing list (email@hidden)
>>>> Help/Unsubscribe/Update your Subscription:
>>>> Archives: http://lists.apple.com/archives/applescript-users
>>>>
>>>> This email sent to email@hidden
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> AppleScript-Users mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> Archives: http://lists.apple.com/archives/applescript-users
>>
>> This email sent to email@hidden
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden