Sunday, July 22, 2018

#1 2005-11-18 11:08:04 am

xbiron
Member
Registered: 2005-11-18
Posts: 5

make List of Volumes mounted

Hi,

I'm novice in AppleScript language. I'm trying to buil a script which create a dialog list with all volumes mounted. After that, the user could choose a volume in the list and the script will get the path of selected volumes and stock it in a variable.

My code is:

Applescript:

set volName to do shell script "ls /volumes/"
return volName

It's work but after that… I don't know what I have to do.

Thanks a lot,
Xavier

Offline

 

#2 2005-11-18 11:29:47 am

Bruce Phillips
Administrator
Registered: 2004-07-16
Posts: 2649

Re: make List of Volumes mounted

Try something like this:

Applescript:

do shell script "ls /Volumes"
get paragraphs of result
choose from list (result)

You can also use the Finder:

Applescript:

tell application "Finder" to get name of every disk whose ejectable is true
choose from list (result)

You can also use the “list disks” command (from Standard Additions):

Applescript:

list disks
choose from list (result)


Filed under: Finder

Offline

 

#3 2005-11-18 02:17:16 pm

xbiron
Member
Registered: 2005-11-18
Posts: 5

Re: make List of Volumes mounted

Hi,

Thanks a lot Bruce... works well !!

But it remains a problem.
I use this script in an automator workflow, so I want to get selected volume name to get it's contain, filter it, copy, etc... many automator actions. But when I put the script in an automator action, it don't pass variable to others actions.

Per example here is my actions :
1. script to get selected volume name
2. get folder contain
3. filter finder items
4. copy finder items

I take care to add the line after you script

Applescript:

return "/Volumes/" & result

But Automator appears to bypass this return.
All my actions are well linked by "Use results of the previous action"

How can i do ??

Thanks

Xavier

Offline

 

#4 2005-11-18 02:39:24 pm

xbiron
Member
Registered: 2005-11-18
Posts: 5

Re: make List of Volumes mounted

Or maybe i have to make a list like this automator action :
Get specified finder items

It open a window with a list to add path. When we select one, it displays it with icon, name and path.

If i could create a liste like that, maybe automator would recognize my passed variable
couldn't ?

Xavier

Last edited by xbiron (2005-11-18 02:45:49 pm)

Offline

 

#5 2005-11-18 05:29:48 pm

Bruce Phillips
Administrator
Registered: 2004-07-16
Posts: 2649

Re: make List of Volumes mounted

I just noticed this is posted in the Mac OS (9 and earlier) forum. I'm moving this to the Automator forum…

Offline

 

#6 2005-11-21 04:42:28 am

Kevin Wolfe
Member
From:: Cincinnati OH USA
Registered: 2005-10-27
Posts: 67
Website

Re: make List of Volumes mounted

xbiron,

This should be possible without scripting in Automator. Drag the following actions in from the Finder library

Get Specified Finder Items
Eject Disk

Mount all Disks you want to eject and choose them in the Get... action. Even if all disks aren't present when you run the workflow, Automator will eject those that are.

Kevin

Offline

 

#7 2005-11-21 07:55:44 am

xbiron
Member
Registered: 2005-11-18
Posts: 5

Re: make List of Volumes mounted

Hi,

Thanks Kevin, but i don't want to eject volume.
I want user select a volume (Compact Flash card or other Digital photos card), get photos, filter, copy, etc...

So i don't know volume name. Just the script user who will insert a card, will be abble to select it. But to simplifize things, i want just a volume list and not a big files list with all rep and files of system !!

Thanks

Xavier

Browser: Firefox 1.0.7
Operating System: Mac OS X (10.4)

Offline

 

#8 2005-11-21 12:42:18 pm

Kevin Wolfe
Member
From:: Cincinnati OH USA
Registered: 2005-10-27
Posts: 67
Website

Re: make List of Volumes mounted

Simpler still. If the the disk is mounted, you can use a Get Specified Finder items and check the Show Action When Run option. The user click the plus button and chooses the volume. When they click continue, only the volume name should be passed to the next action. Does that do it?

Kevin

Offline

 

#9 2005-11-21 03:35:53 pm

xbiron
Member
Registered: 2005-11-18
Posts: 5

Re: make List of Volumes mounted

Sure i understand but I want it more simple for user.
In your case, user have to click "plus" button and select volume in a complex list with files, repertories, volumes, etc...

I want a simple list of volumes and that's it.  Not a complicated thing.
Bruce found me a easy way to get a volume list but i can't passed selected volume name through next action.

I see 2 solutions :
- I find the way to pass selected volume name
- I make a select list like the "Get Specified Finder items" action

Xavier

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)