hello, how can we make a script that can open a folder with the name of a pdf document I choose on the desktop and put this pdf in that folder, and also open a subfolder named “incoming” in this folder and put it in the same pdf folder.
sorry for my poor English. The script below does the first stage of the scenario I want, what I want after that is to open another folder named “incoming” in the resulting folder and copy the same first document to this folder named “incoming”, at the end of the job, 2 folders inside each other and the document I selected in the first place. It should be, thank you very much.
tell application “Finder”
activate
set selectedFiles to selection as alias list
set containingFolder to container of (item 1 of selectedFiles) --as alias
repeat with i from 1 to count of selectedFiles
set foldersRef to (a reference to folders of containingFolder)
set foldersRefItems to name of (contents of foldersRef)
set thisItem to item i of selectedFiles
set fileName to (text items 1 thru -5) of (name of thisItem as text) as string
if fileName is not in foldersRefItems then
move thisItem to (make new folder at containingFolder ¬
with properties {name:fileName})
else
move thisItem to folder fileName of containingFolder
end if
end repeat
Summary
Select Desktop/demo.pdf ———start script
Final