That is my entire script with notes to help, my script will not run it keeps saying there is an error on a different line everytime I run it and the line that it says the error is on is something simple like .alignChildren = "left"; I'm at a loss as to why it stopped working.

My question is this, after I get it going again I made a mistake when I wrote this because I was testing it with a single path item to make sure that it moved to the template, resized and saved but when I try it with a bunch of different objects it breaks even if try and group them all together first. It won't copy() the entire selection so I added in a section to the script near line 50 that takes all the path items of the selection and puts them into a group. I've been going over this and over this and running it and testing it since I got this done and I can't get it to work, I'm at my wits end and looking for help.

All I need it to do is the following in the correct order;

copy();

openTemp ();

paste();

centerArt ();

resizeart ();

savefile ()

putname ();

separately each function works correctly but when I try and put them all together something breaks. I'll post the script that I'm using for the savefile() in the next post.

I fixed the code on lines 260, 265, and 274 on the main script not the save script from app.activeDocument.selection[0] to app.activeDocument.selection and it still will only work with the bottom artwork not the top. The top one is all 5 boxes and the bottom one is one object only. All objects are red with a black stroke on them to show that they are a single object.

I'm not sure what I'm doing wrong but it is not working if there are multiple items in my selection even if they are all in a group now.

Right now my two problems I have is that when I try and use the app.activedocument.selection it only works if the selection is one path item but if there are multiple path items in my selection then it breaks down at the copy() and centerart() part of the code. I've got a section in there near line 50 that takes each path item of the selection and groups them together but it still breaks the code.

I'll take a look at your suggestion if you want to post it as anything that may work better is always a better choice.

Right now my two problems I have is that when I try and use the app.activedocument.selection it only works if the selection is one path item but if there are multiple path items in my selection then it breaks down at the copy() and centerart() part of the code. I've got a section in there near line 50 that takes each path item of the selection and groups them together but it still breaks the code.

I had a quick glance at you code. You mentioned above that initially you write it for a single item then refactored it for multiple items. I see your group code, but in many other places it references ".selection[0]" (a single item). Again I only glanced quickly but did you refactor "all" the code references from the singular way you set it up originally?

Between those two code posts is that the entire code if I wish to find time (if no one else does n the meantime) and try it?

Zantcor wrote:

I'll take a look at your suggestion if you want to post it as anything that may work better is always a better choice.

Go ahead and try it, you will need to make a folder that has 2-3 blank artboards with a square guide box in it for the center art to locate and change the two locations to point to that folder. I'm going to be going through the entire line of code 1 line at a time to double check my syntax and see if I can find out what is going on.

most likely, the problem is copy() and paste(), paste is not reliable, instead you can duplicate the object onto a target document, so first, when you open your template, return a reference to it, so you can use it to move the duplicate Group to.

see my comments with @@@@@@@@@, I didn't use savefile() or putname(), I just focused on resize() and center()

I'm not sure how I can thank you Carlos, you went through my entire script just about and correct all my mistakes that I had made, I was able to implement the reference to template and group name as you suggested.

as for the Copy and Paste I made a function to replace both that now works wonderfully and I'm not getting the timing errors or simply not having the art files get pasted anymore. Here's the code I used for it;

Is there a way to setup a script to pop up alerts with the line that it broke on? Kind of like when a program breaks it always says "Error #1423 - Please copy and paste this into an email to Creator@creatorsfunhouse.com" I think it would help debug the issues as I can't always recreate what someone else has done so I have to read through the entire code line for line and check to see if there is a conflicting variable or something.