Add Illustrator .ai file in code

Hi All,

Below is the code I am using, I want to add here file type of .ai or you can say that Illustrator file. I have added it but it is not working for me.

Please suggest me.

if file type of (get info for thisPath) is in {“TIFF”, “EPSF”, “PICT”, “JPEG”, “AI”} then

Thanks
Rajeev Kumar

Hi Rajeev,

It will help if you can post the whole script.

Kaushik

Hi Rajeev

There’s no “AI” file type. AI documents are of file type “PDF”.
If you just want to filter AI pdf’s and not all kind of pdf files then try something like this instead:


set p to get info for (choose file)
if p's file type is in {"TIFF", "EPSF", "PICT", "JPEG"} or p's name extension is "ai" then beep 5

Yannis

Hi,

It was my fault, actually illustrator file type is "PDF ", and this the problem I was facing.

Thanks

And to those who missed the subtlty…it’s “P-D-F-space”…file types have to be four characters and it needs the trailing space (that detail drove me nuts once). Some File Type information that might be of concern:

–Older versions of Illustrator (specifically Illustrator 8) are File Type “TEXT”

–Photoshop EPS, Illustrator EPS, and FreeHand EPS files all use a File Type of “EPSF”

–Illustrator 9 and above, as well as all Acrobat files, all share the file type of "PDF "

So just based on File Type you need to be very careful what your inputs are. Also be aware that many users still omit the “.ai” from Illustrator files.

A had to write a routine for a graphics department that would restore File Creator (aka “Creator Type”), because a PC-based system had stripped that information. This involved alot of work creating a matrix of “File Type vs. Creator Type vs. file header information vs. file extension”…talk about knowing more than I need to about graphics file types. :wink:

I had to account for worst-case, which meant no extension or in some cases, mangled/improper extensions. In the end, out of 42 possible combinations, I was able to restore File Type reliably on all but 6 combinations.