Hi.
I have some problem to detect a folder that contains a file
on run
set these_items to choose file with prompt "Choose your file/s" with multiple selections allowed without invisibles
process_item(these_items)
end run
on process_item(these_items)
repeat with i from 1 to number of items in these_items
set this_item to item i of these_items
set this_info to info for this_item
set current_name to the displayed name of this_info
set current_extension to the name extension of this_info
set current_hidden to the extension hidden of this_info
if current_hidden is true then
set default_name to current_name
else
set default_name to (current_name & "." & current_extension)
end if
set current_path to quoted form of POSIX path of this_item
set the new_path to text 1 thru -((length of default_name) - 2) of current_path
return new_path
end repeat
end process_item
This script give me right name of the folder not always, ad it appears to much complicated.
For exemple, command
set current_path to quoted form of POSIX path of this_item
return
/Users/matteo/Desktop/Ambient 62.jpg
But I want
/Users/matteo/Desktop
or
/Users/matteo/Desktop/
or
Poldo:Users:matteo:Desktop:
(path is the same: I have to use later with command save fo Image Events)
(Many) Regards in advance