• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Opening Illustrator document as a template / copy?

Guru ,
Jun 17, 2017 Jun 17, 2017

Copy link to clipboard

Copied

Hi All,

Is there any way as opening an Illustrator document as a template / copy?

app.executeMenuCommand('newFromTemplate'); doesn't provide an option to include the file path.

I know I can open a doc as the original and do saveAs but I am not looking for that.

JSX, Applescript or terminal command solutions would all be good but not UI based ones.

Thanks

Trevor

TOPICS
Scripting

Views

969

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Jun 21, 2017 Jun 21, 2017

Thanks for your reply.

It's not what I'm after.

Votes

Translate

Translate
Adobe
Enthusiast ,
Jun 18, 2017 Jun 18, 2017

Copy link to clipboard

Copied

Hi, can you accept this solution ?

var f = File.openDialog ('Select the file...', '*.ai'),

    n = f.name;

f.rename (f.name + 't');

app.open(f);

f.rename (n);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jun 18, 2017 Jun 18, 2017

Copy link to clipboard

Copied

Thanks for the suggestion. I had thought of it but I'm not excited about it.

The same applies to duplicating the file and renaming it although I think I will end up doing that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 19, 2017 Jun 19, 2017

Copy link to clipboard

Copied

This may help you.

#target illustrator

var dialogBox =

    "dialog { orientation: 'column', alignChildren: 'center', \

        info: Group { orientation: 'column', alignChildren: 'center', \

        templateType: Group { orientation: 'column', alignChildren: 'center', margins: 0, \

            rbtn1:  {  text: 'Select the template file', assignmet: 'left'}, \

            dividerLine: Panel { preferredSize: [280,1], margins:0,},\

            componentsGroup: Group { alignChildren: 'right' , orientation: 'column' ,\

            componentList: ListBox {preferredSize: [260,150], left: 100, properties:{multiselect:false} align:'right'}, \

            st:StaticText {text:'', preferredSize:[280,0]},\

            applySkinTo: Group { orientation: 'row' , alignChildren: 'top',\

            },\

            },\

        }, \

    }, \

            dividerLine: Panel { preferredSize: [280,1], margins:0,},\

            buttons: Group { orientation: 'row', \

            ok: Button { text: 'OK', properties:{name:'ok'} }, \

            cancel: Button { text: 'Cancel', properties:{name:'cancel'} }, \

            } \

}";

win = new Window (dialogBox);

win.text = "Graphics";

var lstbx = win.info.templateType.componentsGroup.componentList;

var templatePath;

var templateComponentPath;

if($.os.substring(0,3)=="Win")

{

  templatePath = " "; // Pl. provide the path

  templateComponentPath =  templatePath + "/template";

}

var templateFolder = new Folder(templateComponentPath);

var files = templateFolder.getFiles();

for (i = 0; i < files.length; ++i)

{

  var fileName = files.name;

  var index = fileName.lastIndexOf(".ait");

  if(index != -1)

  {

  var onlyFileName = fileName.substring(0,index);

  lstbx.add("item",File.decode(onlyFileName));

  }

}

win.buttons.ok.onClick = function()

{

  var doc1;

  if(win.info.templateType.rbtn1.value)

  {

    var componentPath = templateComponentPath + "/"+ lstbx.selection.text + ".ait";

  doc1 = app.open (new File(componentPath));

  }

  else

  {

  var componentPath = templateComponentPath + "/"+ lstbx.selection.text + ".ait";

  doc1 = app.open (new File(componentPath));

  }

  win.close(0);

}

win.buttons.cancel.onClick = function()

{

  win.close(0);

}

win.center();

win.show();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jun 21, 2017 Jun 21, 2017

Copy link to clipboard

Copied

Thanks for your reply.

It's not what I'm after.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 21, 2017 Jun 21, 2017

Copy link to clipboard

Copied

I am wondering, why did you need to do these steps instead of using the simple open -> process > Save-As process?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jun 21, 2017 Jun 21, 2017

Copy link to clipboard

Copied

Hi Silly,

I am batch processing PDF files that can contain up to about 200,000 path objects, the object can be sometimes a bit complicated.

The can be sometimes 100s of these files.

My client says all the files are backed up but I would rather avoid touching them to avoid any risk of corrupting them.

If I were to be more of a risk player I could open them and do save as strait away on Ai and then process and save again. 2 X save as like you are thinking, right?

We'll how many extra hours would it take to do the more risky method? I don't know but it certainly would be a lot.

Convinced 😉

Trevor

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jun 21, 2017 Jun 21, 2017

Copy link to clipboard

Copied

Well I see you had in mind just 1 save as, that's just too risky.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 21, 2017 Jun 21, 2017

Copy link to clipboard

Copied

See, I was under impression that when you 'open' a file in AI, it actually copies the file inside the application - so unlike other kinds of applications such as Excel, where you can't delete a file that's open in Excel right now, in the file system, you can delete an AI file that's already opened and it won't even complain at you. I also think that is why when you drag a file into the app fame of AI or PS, etc, it will show the tooltip "copy" near the cursor.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jun 21, 2017 Jun 21, 2017

Copy link to clipboard

Copied

LATEST

I don't know, maybe you are correct.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines