Basic Illustrator Applescript...

I am trying to learn Applescript to help my productive enviorment but I can’t seem to get this script to work…I must be missing something or I don’t understand something…Anyone help?


tell application "Finder"
	activate
	set the fileToPlace to the selection
end tell

tell application "Adobe Illustrator 10"
	activate
	set myDocument to make new documet
	place fileToPlace
end tell

Its supposed to select the file in finder that I have selected, open a new document in Illustrator and place the file it selected via File>place. Everything works but the place part. It gives me an error thats its expecting something thats not there.

Thanks!

TheMath,

This is the code I came up with. However, it does not seem to be capable of placing jpeg’s. I did not try tiff’s. It works with eps’s and pdf’s.

tell application "Finder"
	activate
	set the fileToPlace to the selection as alias
end tell
tell application "Adobe Illustrator 10"
	activate
	set myDocument to make new document

	set placeRef to make new placed item at current document with properties {file path:fileToPlace}

end tell

Hope this helps.

PreTech

Model: G5 dual 1.8
AppleScript: 2.1
Browser: Safari 125.12
Operating System: Mac OS X (10.4)

It works great! thanks!

I’ll have to toy with it a little and see if I can get jpgs working but this is fantastic, thanks again.

TheMath,

You’re quite welcome. You could also try this in place of the first part.

tell application "Finder"
	activate
	set fileToPlace to choose file with prompt "Choose your file."
end tell

This way you don’t have to make a selection beforhand.

PreTech