Skip to main content
Participant
December 12, 2023
Question

import guidelines from one adobe program to another

  • December 12, 2023
  • 2 replies
  • 172 views

Hello,

I work at a print shop.

I have set up document templates with guidelines for printing materials, i.e. business cards, post cards, greeting cards, etc. I personally do this in Photoshop, but some staff members are more comfortable using Illustrator or InDesign. Can I share my Photoshop templates with them including guidelines somehow in their prefereed platform? 

If anyone know if and how to do this I would love to hear it.

This topic has been closed for replies.

2 replies

Stephen Marsh
Community Expert
Community Expert
December 13, 2023

I agree with @jane-e 

 

Getting paths out of Photoshop into Illustrator is easier with a script:

 

/*
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-export-guides-is-it-possible/m-p/13635116
*/

// create a path based on the guides;
// 2023, use at your own risk; 

#target photoshop

if (app.documents.length > 0 && app.activeDocument.guides.length > 0) {
    var originalRulerUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.POINTS;
    var myDocument = app.activeDocument;
    var theGuides = collectGuides();
    //alert (theGuides.join("\n"));
    var theArray = new Array;
    for (var m = 0; m < theGuides[0].length; m++) {
        var theW = Number(myDocument.width);
        var thisOne = Number(theGuides[0][m]);
        theArray.push([[[0, thisOne], [0, thisOne], [0, thisOne], false], [[theW, thisOne], [theW, thisOne], [theW, thisOne], false], true, 1737])
    };
    for (var n = 0; n < theGuides[1].length; n++) {
        var theH = Number(myDocument.height);
        var thisOne = Number(theGuides[1][n]);
        theArray.push([[[thisOne, 0], [thisOne, 0], [thisOne, 0], false], [[thisOne, theH], [thisOne, theH], [thisOne, theH], false], true, 1737])
    };
    var thePath = createPath2022(theArray, "Paths from Guides");
    myDocument.pathItems[thePath - 1].select();
    app.preferences.rulerUnits = Units.POINTS;

    // Export paths to desktop in Illustrator format
    var docName = myDocument.name.replace(/\.[^\.]+$/, '');
    var newFile = File("~/Desktop" + '/' + docName + '_Paths' + '.ai');
    var expOptions = new ExportOptionsIllustrator();
    expOptions.path = IllustratorPathType.ALLPATHS;
    myDocument.exportDocument(newFile, ExportType.ILLUSTRATORPATHS, expOptions);
    activeDocument.pathItems.getByName("Paths from Guides").remove();

    // Open the exported file
    try {
        var openPathsFile = File(newFile);
        openPathsFile.execute();
    } catch (e) {
        alert("Error!" + "\r" + e + ' ' + e.line);
    }

};
////// function //////
function collectGuides() {
    // set to pixels;
    var myDocument = app.activeDocument;
    var originalRulerUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.POINTS;
    // collect guides;
    var theArray1 = new Array;
    var theArray2 = new Array;
    for (var m = 0; m < myDocument.guides.length; m++) {
        //theArray.push([myDocument.guides[m].coordinate, myDocument.guides[m].direction]);
        if (myDocument.guides[m].direction == Direction.HORIZONTAL) { theArray1.push(myDocument.guides[m].coordinate) }
        else { theArray2.push(myDocument.guides[m].coordinate) }
    };
    app.preferences.rulerUnits = originalRulerUnits;
    app.preferences.rulerUnits = Units.POINTS;
    return ([theArray1, theArray2]);
};
////// create a path from collectPathInfoFromDesc2012-array //////
function createPath2022(theArray, thePathsName) {
    var originalRulerUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    // thanks to xbytor;
    cTID = function (s) { return app.charIDToTypeID(s); };
    sTID = function (s) { return app.stringIDToTypeID(s); };

    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putProperty(cTID('Path'), cTID('WrPt'));
    desc1.putReference(sTID('null'), ref1);
    var list1 = new ActionList();

    for (var m = 0; m < theArray.length; m++) {
        var thisSubPath = theArray[m];

        var desc2 = new ActionDescriptor();
        desc2.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), thisSubPath[thisSubPath.length - 1]);
        var list2 = new ActionList();
        var desc3 = new ActionDescriptor();
        desc3.putBoolean(cTID('Clsp'), thisSubPath[thisSubPath.length - 2]);
        var list3 = new ActionList();

        for (var n = 0; n < thisSubPath.length - 2; n++) {
            var thisPoint = thisSubPath[n];

            var desc4 = new ActionDescriptor();
            var desc5 = new ActionDescriptor();
            desc5.putUnitDouble(cTID('Hrzn'), cTID('#Rlt'), thisPoint[0][0]);
            desc5.putUnitDouble(cTID('Vrtc'), cTID('#Rlt'), thisPoint[0][1]);
            desc4.putObject(cTID('Anch'), cTID('Pnt '), desc5);
            var desc6 = new ActionDescriptor();
            desc6.putUnitDouble(cTID('Hrzn'), cTID('#Rlt'), thisPoint[1][0]);
            desc6.putUnitDouble(cTID('Vrtc'), cTID('#Rlt'), thisPoint[1][1]);
            desc4.putObject(cTID('Fwd '), cTID('Pnt '), desc6);
            var desc7 = new ActionDescriptor();
            desc7.putUnitDouble(cTID('Hrzn'), cTID('#Rlt'), thisPoint[2][0]);
            desc7.putUnitDouble(cTID('Vrtc'), cTID('#Rlt'), thisPoint[2][1]);
            desc4.putObject(cTID('Bwd '), cTID('Pnt '), desc7);
            desc4.putBoolean(cTID('Smoo'), thisPoint[3]);
            list3.putObject(cTID('Pthp'), desc4);

        };

        desc3.putList(cTID('Pts '), list3);
        list2.putObject(cTID('Sbpl'), desc3);
        desc2.putList(cTID('SbpL'), list2);
        list1.putObject(cTID('PaCm'), desc2);
    };

    desc1.putList(cTID('T   '), list1);
    executeAction(cTID('setd'), desc1, DialogModes.NO);

    // name work path;
    var desc30 = new ActionDescriptor();
    var ref6 = new ActionReference();
    var idPath = charIDToTypeID("Path");
    ref6.putClass(idPath);
    desc30.putReference(charIDToTypeID("null"), ref6);
    var ref7 = new ActionReference();
    ref7.putProperty(idPath, charIDToTypeID("WrPt"));
    desc30.putReference(charIDToTypeID("From"), ref7);
    desc30.putString(charIDToTypeID("Nm  "), thePathsName);
    executeAction(charIDToTypeID("Mk  "), desc30, DialogModes.NO);
    /// get index;
    var ref = new ActionReference();
    ref.putProperty(stringIDToTypeID("property"), stringIDToTypeID("itemIndex"));
    ref.putEnumerated(charIDToTypeID("Path"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
    var pathDesc = executeActionGet(ref);
    app.preferences.rulerUnits = originalRulerUnits;
    return pathDesc.getInteger(stringIDToTypeID("itemIndex"))
};
jane-e
Community Expert
Community Expert
December 13, 2023

@Options26172389p8js 

 

No, guides are treated differently and cannot be copied across applications.

 

  • In Photoshop, you can draw paths on the guides, copy them to Illustrator, then convert the paths to guides.
  • In Illustrator, you can convert the guides to paths, copy them to Photoshop, then create guides where the paths are.

This is isn't easy and can take a while.

 

Jane