Copy link to clipboard
Copied
Hi everybody,
I would like to save my file as a .ait format. I have tried browsing the forum but it seems impossible to save a file as a .ait file. I also already have tried to rename the file as "xxx.ait" when saving it but it does not work.
Thank you for your answers,
Happy holidays !!
Miyano
from an illustrator script you can locate the file directly, or batch a whole folder, and then use the File.rename() method.
var myFile = File("path/to/file/art_file.ai");
myFile.rename("art_file.ait");
///////////////
now let's get a little fancier in the batch and change the extensions dynamically so you don't have to hard code the rest of the filename like i did above.
///////////////
var myFolder = Folder("path/to/folder");
var files = myFolder.getFiles();
for(var x=0, len=files.length; x<len; x++)
{
...Copy link to clipboard
Copied
Record an Action to Save as Template, then have the script play the action. The action will always save the template in the same location, you can then move and rename the file if necessary.
Copy link to clipboard
Copied
in my experience, i find it much better to save the file as an .ai file, then change the name in the file system to .ait. this causes illustrator to open the file as a .ait file as you'd expect, but if you need to make a change to that template file, you can simply rename the extension back to .ai, make your fix, save the file and update the extension. it's pretty easy to make customized tools for quickly updating extensions. i use a simple bash script i wrote to do so.
This method helps prevent you from having to see a save as dialog every time you want to change a template file (or batch a whole folder of them). just my $.02
Copy link to clipboard
Copied
I'm confused… When I rename an ".ait" to ".ai" in the Finder it still opens as "Untitled" in AI. I would expect it to open with the file name.
Copy link to clipboard
Copied
Try to open another "*.ait" in Illustrator. What result do you get?
![]()
It is a template.
Copy link to clipboard
Copied
Untitled-[number]
Copy link to clipboard
Copied
If you initially save a file as an .ait, it will open as "untitled" forever. but if you save it as an .ai file, you can swap the behavior back and forth at will
Copy link to clipboard
Copied
Oh! I didn't catch that. Thanks.
Copy link to clipboard
Copied
Hello Carlos & William,
Thank you very much for your answers.
CarlosCanto I tried your method. It looks like it is working fine at the moment.
williamadowling​​ Is it possible to change the file extension from a script launched from illustrator or does the file extension needs to be changed from the file system only?
I hope you spent great holidays with your relatives and friends,
Thank you both very much for your help, I now have a clearer view on the problem
Have a nice day.
Miyano
Copy link to clipboard
Copied
from an illustrator script you can locate the file directly, or batch a whole folder, and then use the File.rename() method.
var myFile = File("path/to/file/art_file.ai");
myFile.rename("art_file.ait");
///////////////
now let's get a little fancier in the batch and change the extensions dynamically so you don't have to hard code the rest of the filename like i did above.
///////////////
var myFolder = Folder("path/to/folder");
var files = myFolder.getFiles();
for(var x=0, len=files.length; x<len; x++)
{
files
}
Copy link to clipboard
Copied
Hi william,
I think this works as expected under Windows. But I doubt if a simple change of the extension works with a Mac.
Copy link to clipboard
Copied
I use mac exclusively. i just tested this code before i posted it.
Copy link to clipboard
Copied
Hmm... I agree the method should work, but the code is assigning an array of File objects to "files" and then calling .rename() and .name.replace() methods on that array. Perhaps you were testing with one file and .getFiles() was able to convert it to a single File object?
Edit: Also want to point out the need to escape the dot in those regular expressions.
Copy link to clipboard
Copied
Hi!
Thank you very much williamadowling, I was focused on saving the file as an ".ait" file but I didn’t thought about renaming it as an ".ait".
Thanks for all!
Have a nice day!
Miyano
Find more inspiration, events, and resources on the new Adobe Community
Explore Now