Open an illustrator file from within a folder

Hi all,

I have a script which I need to be the start of an Automator workflow. The script works fine if I drop the actual Illustrator file directly onto the script (as an application).
However, I would like to be able to drop the folder it is enclosed in onto the Automator application, and action the script (pasted below) to “look” inside the enclosed folder, process the Illustrator file as instructed (and only the illustrator file), then once that process is done, continue on with the Automator Workflow.

Heres the script parameters:

on open theDroppedItems
set A to theDroppedItems

tell application "Adobe Illustrator"
	activate
	open theDroppedItems
	
	tell document 1
		do script "RELEASES UPDATE" from "Dave's"
	end tell
end tell

end open
end open

The folder to be dropped contains the illustrator file, a PDF file and a further folder with other info in it.
Only the Illustrator file needs to be processed according to the script then once done the dropped folder and contents (with processed Illustrator file) moves thru the rest of the Automator workflow.

I’ve tried several ways but can’t seem to work it out.

Any help greatly received.

Regards

Dave

Model: iMac (Retina 5K, 27-inch, Late 2014)
AppleScript: 1.0
Operating System: macOS 10.13

If I remember well, when you drop a folder upon a droplet, this one receive the alias of the folder, not a list of the embedded items.

You must extract the list by yourself with something like:

on open theDroppedItems -- supposed to be a folder
	tell application "Finder"
		set thePDF to first item of ((files of (item 1 of theDroppedItems) whose name extension is "PDF") as alias list)
	end tell
	tell application "Adobe Illustrator"
		activate
		open thePDF
		
		tell document 1
			do script "RELEASES UPDATE" from "Dave's"
		end tell
	end tell
end open

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 10 décembre 2020 17:19:05

Thanks for the prompt response Ivan - I’ll look into utilising this in the morning!

Thanks Yvan - had a chance to test and works as expected.

Thank you for the feedback.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) lundi 14 décembre 2020 14:28:24