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

problem pastin path into other document

New Here ,
Jul 30, 2008 Jul 30, 2008

Copy link to clipboard

Copied

Hi to everybody!

i have a problem: i have "Image 1" hat has several paths and i want to copy & paste them into "Image 2". My problem is that i use a for loop to copy and paste them, but it doesn't paste! if i look into the clipboard, i see it has copyed the last path, but when i invoke the method docRefPasted.paste() it doesn't paste anything.

This is gonna driving me crazy, can anyone help me? thanks!
TOPICS
Actions and scripting

Views

374

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
Adobe
Valorous Hero ,
Jul 30, 2008 Jul 30, 2008

Copy link to clipboard

Copied

Instead of docRefPasted.paste();
try..
executeAction( app.charIDToTypeID('past'), undefined, DialogModes.NO );
It does give some strange results though.

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
New Here ,
Jul 30, 2008 Jul 30, 2008

Copy link to clipboard

Copied

thanks paul!

it's quite right!

the only problem is that it paste every path into each other, i have to obtain
different path, not only one with all merged inside it.

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 ,
Jul 30, 2008 Jul 30, 2008

Copy link to clipboard

Copied

Yes I got the same results, maybe one of the experts will tell us how its done?

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 ,
Jul 30, 2008 Jul 30, 2008

Copy link to clipboard

Copied

Doing a copy and paste manually, you need to create a new path before pasting, this will need to be added to the code. Also the new path should be selected. Haven't got it working yet, but getting interesting results.
Draging from one doc to another works fine, but no scriptListner code for it.

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
New Here ,
Jul 31, 2008 Jul 31, 2008

Copy link to clipboard

Copied

Paul, in Applescript with CS2 the duplicate command was broken on path items. The way I managed to get my paths from one document to another was to open doc A create a loop that made 3 lists of variables path names, entire path & path kind close open doc B loop make new path with properties from the above lists. You need to add a little checking to see if the name already exists etc. Im taking a guess that the same could be done in JavaScript?

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 ,
Aug 03, 2008 Aug 03, 2008

Copy link to clipboard

Copied

LATEST
Thank you Mark, you put me on the right path (No pun intended).

Roby this seems to work so long as the paths are contiguous.
This will copy all the paths from one document to another.



var doc = app.documents[0];

var doc2 = app.documents[1];

activeDocument = doc;



for(var q =0; q< doc.pathItems.length;q++){

copyPath(doc,doc2,doc.pathItems.name);

activeDocument = doc;

}



function copyPath(From,To,PathName){

var strtRulerUnits = app.preferences.rulerUnits;

var strtTypeUnits = app.preferences.typeUnits;

app.preferences.rulerUnits = Units.POINTS;

app.preferences.typeUnits = TypeUnits.POINTS;

activeDocument = From;

var p = activeDocument.pathItems.getByName(PathName);

points = p.subPathItems[0].pathPoints.length ;

var lineArray = new Array();

for(var a = 0 ;a< points;a++){

lineArray = new PathPointInfo;

lineArray
.kind =p.subPathItems[0].pathPoints.kind;

lineArray
.anchor = p.subPathItems[0].pathPoints.anchor;

lineArray
.leftDirection = p.subPathItems[0].pathPoints.leftDirection;

lineArray
.rightDirection = p.subPathItems[0].pathPoints.rightDirection;

}

var lineSubPathArray = new Array();

lineSubPathArray[0] = new SubPathInfo()...















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