I am trying to make functionality where I can right-click on a video file in OSX Finder, pressing Services and the name of my script, then MediaInfo would load in Terminal and video tag data would be shown (by MediaInfo). I got it working for files in my local drive. But it doesn't work for network drives because /Volumes is missing in the path and MediaInfo doesn't find the file.
I have put the following script as Run AppleScript in Automator, saved as Service ("Service receives selected files or folders in Finder" at the top part of Automator).
tell application "Finder"
set theItems to selection
repeat with itemRef in theItems
set myfolder to (get folder of itemRef) as string
set myfolder to POSIX path of myfolder
set myfile to "'" & myfolder & (get name of itemRef) & "'"
end repeat -- it will store the last filename in selection
end tell
tell application "Terminal"
activate
do script
set size of window 1 to {1200, 1200}
set cmd to "mediainfo " & myfile
try
if busy of selected tab of window 1 then error
do script with command cmd in window 1
on error
do script with command cmd
end try
end tell
So what to change in order to include /Volumes in the beginning of path when a network drive is in question?