Hi Experts!
I’m quite new to AppleScript…hoping for a little help.
I wrote the script below, which works, but is quite “ugly”. It reports information about the SAN volumes on the system.
I can’t figure out how to loop through my disks, called “F1” “F2” etc… i know how to do the “repeat” thing, but how to reference a disk with a variable? disk “F”&d doesn’t work…
I’m using TextEdit as a “dump”, but I would also like this to display in a nice window, with a “refresh” button, and which could be copied to clipboard.
I’m also interested in how to format it in TextEdit – make some items bold, etc. I tried
keystroke "b" using command down
but that did nothing.
THANKS!
tell application "Finder"
set gb to 1024 ^ 3
set free_space to {1, 2, 3, 4, 5, 6}
set omf_c to {1, 2, 3, 4, 5, 6}
set mxf_c to {1, 2, 3, 4, 5, 6}
set omf_s to {1, 2, 3, 4, 5, 6}
set mxf_s to {1, 2, 3, 4, 5, 6}
set item 1 of free_space to (free space of disk "f1") / gb as integer
set item 2 of free_space to (free space of disk "f2") / gb as integer
set item 3 of free_space to (free space of disk "f3") / gb as integer
set item 4 of free_space to (free space of disk "f4") / gb as integer
set item 5 of free_space to (free space of disk "f5") / gb as integer
set item 6 of free_space to (free space of disk "f6") / gb as integer
set item 1 of omf_c to count of items of folder "OMFI MediaFiles" of disk "F1"
set item 1 of mxf_c to count of items of folder "Avid MediaFiles:MXF:1" of disk "F1"
set item 1 of omf_s to (physical size of folder "OMFI MediaFiles" of disk "F1")
set item 1 of mxf_s to (physical size of folder "Avid MediaFiles:MXF:1" of disk "F1")
set item 2 of omf_c to count of items of folder "OMFI MediaFiles" of disk "F2"
set item 2 of mxf_c to count of items of folder "Avid MediaFiles:MXF:1" of disk "F2"
set item 2 of omf_s to (physical size of folder "OMFI MediaFiles" of disk "F2")
set item 2 of mxf_s to (physical size of folder "Avid MediaFiles:MXF:1" of disk "F2")
set item 3 of omf_c to count of items of folder "OMFI MediaFiles" of disk "F3"
set item 3 of mxf_c to count of items of folder "Avid MediaFiles:MXF:1" of disk "F3"
set item 3 of omf_s to (physical size of folder "OMFI MediaFiles" of disk "F3")
set item 3 of mxf_s to (physical size of folder "Avid MediaFiles:MXF:1" of disk "F3")
set item 4 of omf_c to count of items of folder "OMFI MediaFiles" of disk "F4"
set item 4 of mxf_c to count of items of folder "Avid MediaFiles:MXF:1" of disk "F4"
set item 4 of omf_s to (physical size of folder "OMFI MediaFiles" of disk "F4")
set item 4 of mxf_s to (physical size of folder "Avid MediaFiles:MXF:1" of disk "F4")
set item 5 of omf_c to count of items of folder "OMFI MediaFiles" of disk "F5"
set item 5 of mxf_c to count of items of folder "Avid MediaFiles:MXF:1" of disk "F5"
set item 5 of omf_s to (physical size of folder "OMFI MediaFiles" of disk "F5")
set item 5 of mxf_s to (physical size of folder "Avid MediaFiles:MXF:1" of disk "F5")
set item 6 of omf_c to count of items of folder "OMFI MediaFiles" of disk "F6"
set item 6 of mxf_c to count of items of folder "Avid MediaFiles:MXF:1" of disk "F6"
set item 6 of omf_s to (physical size of folder "OMFI MediaFiles" of disk "F6")
set item 6 of mxf_s to (physical size of folder "Avid MediaFiles:MXF:1" of disk "F6")
end tell
tell application "System Events"
tell application "TextEdit" to activate
tell application "TextEdit" to open "Users:alpha:Desktop:Media File Summary.rtf"
keystroke ((current date) as string) & return
keystroke "u" using command down
repeat with d from 1 to 6
tell process "TextEdit" to keystroke "F" & d & " OMF " & (item d of omf_c as string) & " " & (((item d of omf_s) / gb) as integer) & return & ¬
item d of free_space & " MXF " & (item d of mxf_c as string) & " " & (((item d of mxf_s) / gb) as integer) & return & return
end repeat
keystroke up using command down -- this is supposed to go to the top, but it doesn't work
keystroke "s" using command down
end tell