Creating Lists of Disks

I’m trying to get a list of every disk connected to a computer, EXCLUDING the boot disk, and excluding network volumes.

I can do this:

**tell** *application* "System Events"
**set** DriveList **to** **the** name **of** **every** *disk*
**end** **tell**

But how can I determine which volumes are which KINDs of volumes.
I’m trying to dig deeper but I’m just getting further and further away from what I’m looking for.
If I do “set DriveList to the alias of every disk”, I get… what appears to be a list of paths to every item at the root level of every disk on the system.

If I can’t easily exclude network volumes, I at least have to exclude the computer’s boot disk from this list.

I was able to get a little bit closer just now by doing this:

**tell** *application* "Finder"
**set** VolumeFolder **to** *POSIX file* "/Volumes" **as** *alias*
**set** DriveList **to** name **of** **every** *item* **of** VolumeFolder **whose** kind **is** **not** "Alias"
**end** **tell**

That at least excludes the startup disk.
Is this as close as I’m going to get?
Is there a better overall approach to this?
This script is going to let the user pick a disk, and then its going to be creating files and folders, reading and writing to and from the chosen disk.

Also this forum software is terrible.

Regarding formatting… just copy your script from script editor. In the post, type three backticks alone on a line, go to the next line and paste your code, then on the next line, three more backticks. It should look something like this:

```
code
```

Regarding disks… a disk has finder properties which you can look up in the dictionary. Look them up for each type of disk that you have and see what you can use to isolate them.

tell application "Finder"
	
	set stp to startup disk
	properties of stp
	(*
	{name:"machd", index:3, displayed name:"machd", name ¬
	extension:"", extension hidden:false, container:computer ¬
	container, disk:startup disk, position:{-1, -1}, desktop ¬
	position:{1329, 63}, bounds:{-33, -33, 31, 31}, kind:"Volume", ¬
	label index:0, locked:false, description:missing value, comment:"", ¬
	size:4.8218025984E+11, physical size:4.8218025984E+11, ¬
	creation date:date "Tuesday, December 23, 2014 at 11:40 AM", ¬
	modification date:date "Friday, September 30, 2022 at 1:48 PM", ¬
	icon:missing value, URL:"file:///", owner:"system", group:"root", ¬
	owner privileges:read write, group privileges:read only, everyones ¬
	privileges:read only, container window:container window of startup ¬
	disk, id:-100, capacity:4.99055067136E+11, free space:¬
	2.1631597649E+10, ejectable:false, startup:true, format:Mac OS ¬
	Extended format, journaling enabled:true, local volume:true, ignore ¬
	privileges:false}
	*)
	
	-- Here is an example
	disks whose startup is false and local volume is true
	
end tell

Another property that you might filter on could be ejectable. I can’t test for it but probably URL as well.

Alternatively, System Events can also work with disks and it has a posix path property.

So getting properties of a disk, seems to only work in the script editor but not in an actual applescript application? What do you make of that?