Hi,
I want to extract only path from “Mac:Images:cust:image1.eps”. I want to store “Mac:Images:cust:” in a variable.
Regards,
Poo
Hi,
I want to extract only path from “Mac:Images:cust:image1.eps”. I want to store “Mac:Images:cust:” in a variable.
Regards,
Poo
Assuming you have selected the file in question:
tell application "Finder" to set F to (container of (selection as alias)) as text
Assuming you’re starting with the file path itself:
on containerPathFromPath(fullPath)
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
if (fullPath ends with ":") then
set containerNameTextItem to -3
else
set containerNameTextItem to -2
end if
set containerPath to (text 1 thru text item containerNameTextItem of fullPath) & ":"
set AppleScript's text item delimiters to astid
return containerPath
end containerPathFromPath
set filePath to "Mac:Images:cust:image1.eps"
set containerPath to containerPathFromPath(filePath)