Applescript How to make this selection as a taget path?
Hi i bump in to simple things I can't get my head around all the time,
How to make this selection as a taget path?
this code works but only by having a selected folder in finder window selected
so inside my help quotes I can't figure out how to make the path as path I have chosen from the start,
the code simply takes a folders folders and count them and make new folders at a chosen location whit same folder names.
tell application "Finder"
--==========HELP START==========--
--set selected to "/Users/USER/Movies/Test/Effects/" as POSIX file as alias
--set selected to get every item of (entire contents of folder "Macintosh HD:Users:politijagt:Movies:Test:Effects:") whose kind ≠ "Folder"
--reveal selected
set selected to selection
--==========HELP END==========--
set current_folder to item 1 of selected
# Build a list of the files available
set mlist to every folder of current_folder as alias list
# Build a list of the folders available
set theFolders to every folder of current_folder as alias list
set x to mlist
repeat with i from 1 to the count of x
set this_file to item i of x
if i is not 1 then
set previous_file to item (i - 1) of x
set prev_ext to cur_ext
set prev_name to new_name
else
set prev_name to ""
end if
set cur_ext to name extension of this_file
set new_name to (name of this_file as text)
if new_name is not equal to prev_name then
set new_folder to make new folder with properties {name:new_name} at "/Users/USER/Movies/Test/" as POSIX file as alias as string
end if
end repeat
end tell