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
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.
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.