From: Chris Ridd on
On 2010-04-24 16:18:53 +0100, Bruce Horrocks said:

> On 24/04/2010 15:29, Colin Harper wrote:
>> Why don't you script diskutil to do this kind of work? It's what I use.
>
> Perhaps you could post your code then, showing the OP how to find and
> pass the right volume info to diskutil.

Out of mild curiosity, as there are two Applescript programmers in the
thread - what's Matt Neuberg's Applescript Definitive Guide book like
nowadays? It was written during Tiger, and I suppose Applescript's
changed since then.

--
Chris

From: Steve Hodgson on
On 2010-04-24 15:03:08 +0100, Bruce Horrocks said:

> On 20/04/2010 12:39, Steve wrote:
>> On Apr 20, 1:00 am, Bruce Horrocks<07....(a)scorecrow.com> wrote:
>>> On 19/04/2010 22:56, Steve Hodgson wrote:
>>>
>>>> I'm using an Applescript to unmount my local USB drives but get a dialog
>>>> when I run it because one drive is partitioned into two. The message
>>>> asks if I want to eject all partitions or just one.
>>>
>>>> Can anyone think of a way to remove or disable the prompt?
>>>
>>> eject takes a list as a parameter so you could try ejecting all in one
>>> command, viz:
>>>
>>> tell application "Finder" to eject (every disk whose local volume is true)
>>>
>>> Or better might be:
>>> tell application "Finder" to eject (every disk whose ejectable is true)
>>
>> Would that not still create the dialogue when it hits the first
>> partitioned drive in the list?
>>
>> I tried a menu bar application called 'Ejector' last night and that
>> did eject all drives with no dialogues so I suspect this will be
>> possible. Ejector was no use as it ejects ALL drives including iDisks.
>
> Okay, now I'm back, I experimented with a FireWire [1] drive that is
> partitioned into 2, named "Drive 1" and "Drive 2". This is under SL
> 10.6.3
>
> If I eject either from a Finder window then a dialog pops up telling me
> that it is one of a pair and gives me the option to eject all or cancel
> etc.
>
> If I run the following AppleScript
>
> tell application "Finder" to eject "Drive 1"
>
> then it *unmounts* the drive without any dialog, but doesn't actually
> eject it. That is, the drive light stays on and Disk Utility sees it as
> unmounted but not ejected.
>
> Similarly
>
> tell application "Finder" to eject {"Drive 1", "Drive 2"}
>
> unmounts both drives but still fails to eject as far as Disk Utility is
> concerned.
>
> So I'm not quite sure why you get a message while I don't when using
> AppleScript unless you are on an earlier version of MacOSX?

Thanks for looking into this in such detail. I've just tried your
example on my two drives and it is (a) QUICK and (b) does not produce
any dialogs. I seem to get the same result (under 10.6.3) that the
drives disappear from the Finder but still show in Disk Utility.

What's the best route to build up a list of ejectable drives that
excludes network drives such as MobileMe?
--
Cheers,

Steve

The reply-to email address is a spam trap.
Email steve 'at' shodgson 'dot' org 'dot' uk

From: Bruce Horrocks on
On 25/04/2010 00:13, Steve Hodgson wrote:

> What's the best route to build up a list of ejectable drives that
> excludes network drives such as MobileMe?

Try

tell application "Finder" to eject (every disk whose ejectable is true
and local volume is true)

All one line.

--
Bruce Horrocks
Surrey
England
(bruce at scorecrow dot com)
From: Bruce Horrocks on
On 24/04/2010 16:31, Chris Ridd wrote:
> Out of mild curiosity, as there are two Applescript programmers in the
> thread - what's Matt Neuberg's Applescript Definitive Guide book like
> nowadays? It was written during Tiger, and I suppose Applescript's
> changed since then.

I've not looked at it at all so no idea I'm afraid. Not too much has
changed since Tiger - obviously any new apps and new functionality but
most stuff should still be okay.

A good example is System Events which duplicates much of what is
currently scripted using the Finder. However, I suspect that it is a
prelude to providing scripting on devices that don't have the Finder
rather than the end of a scriptable Finder on the Mac.

--
Bruce Horrocks
Surrey
England
(bruce at scorecrow dot com)
From: Chris Ridd on
On 2010-04-26 18:32:15 +0100, Bruce Horrocks said:

> On 24/04/2010 16:31, Chris Ridd wrote:
>> Out of mild curiosity, as there are two Applescript programmers in the
>> thread - what's Matt Neuberg's Applescript Definitive Guide book like
>> nowadays? It was written during Tiger, and I suppose Applescript's
>> changed since then.
>
> I've not looked at it at all so no idea I'm afraid. Not too much has
> changed since Tiger - obviously any new apps and new functionality but
> most stuff should still be okay.

Thanks. I found the author's web site - <http://www.tidbits.com/matt/>
unfortunately frame-based or I'd give a deeper link - where he says it
hasn't changed too much. He also says he's using Ruby nowadays instead
of Applescript :-) So I'm trying to take another look at learning Ruby.

> A good example is System Events which duplicates much of what is
> currently scripted using the Finder. However, I suspect that it is a
> prelude to providing scripting on devices that don't have the Finder
> rather than the end of a scriptable Finder on the Mac.

That makes sense. It seems odd to *need* a GUI app to do file
manipulation in any way.
--
Chris

First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: Airport Express alternative?
Next: A haaaannnndbag?