I'm trying to write an AppleScript for a Keyboard Maestro Macro, which opens the pictures folder of a camera SD or CF Card in an existing Finder window. This is my current code, which opens the mounted Volume.
tell application "Keyboard Maestro Engine"
set KMVarPath to get value of variable "path"
end tell
set the_string to "/Volumes/" & KMVarPath
set the_path to (POSIX file the_string) as string
tell application "Finder"
activate
if window 1 exists then
set target of window 1 to the_path
else
reveal the_path
end if
end tell
The problem is those folders are called ie 276ND2XS or 105ND800. I'd like to specify the 'suffix' (ND2XS/ND800) and open the folder with the highest 'prefix' number.
Is there a way to do that?
And for convenience, is there a way to check, whether the volume is an SD or CF Card? Or do I have to check via the name (NIKON D2XS / NIKON D800)?