Skip to main content
Vfxvenkat98
Known Participant
July 16, 2016
Answered

Hi, Is there any possibility to save the paths using .jsx script

  • July 16, 2016
  • 4 replies
  • 1272 views

Please tell some solution for workflow automation because every time i have draw the path and i need to double click on work path and its prompts for a name to save it. It makes me bored so i need help for making this workflow as auomated.

    This topic has been closed for replies.
    Correct answer Chuck Uebele

    Try this script. You can save it as a script then run it in an action and assign a hot key such as F3. The scripts assumes that the path you want to rename is named "Work Path". It also assumes that the naming sequence is PS default's: "Path 1, Path 2...."

    #target photoshop

    var doc = activeDocument;

    var works = true

    try{

        var curPath = doc.pathItems.getByName ('Work Path');

        }

    catch(e){

        works = false;

        alert('There is no path named "Work Path"');

        }

    if(works){

        try{

            var lastPath = doc.pathItems[doc.pathItems.length-2];

            var pNum = lastPath.name.split(' ')[1];

            curPath.name = 'Path ' + (Number(pNum) + 1);

        }

        catch(e){curPath.name = 'Path 1'};

        curPath.deselect();

        }

    4 replies

    Vfxvenkat98
    Known Participant
    September 15, 2016

    the above script saves the work path into path 1 and so on.

    but when i tried to trigger the script with Events script manager plugin in photoshop

    and added an event for Selection like when i completed a path  and make selection of the work path

    the path need to saved automatically using the script which added.

    But i dont why the Script event manager doesn't trigger the external script.

    (Event id i tried is 'slct')

    Please anyone help me on this

    Chuck Uebele
    Community Expert
    Community Expert
    August 23, 2016

    I don't think so, but I'm not sure. One of the issues would be determining when you were done creating the path. By putting the script in an action and assigning it to a function key, you just have to hit one key to indicate that you're done with the path and want to name it.

    Vfxvenkat98
    Known Participant
    August 23, 2016

    Thank u so much for the script this works fine

    Chuck Uebele
    Community Expert
    Community Expert
    August 23, 2016

    Glad it works for you.

    Vfxvenkat98
    Known Participant
    August 22, 2016

    PS

    Chuck Uebele
    Community Expert
    Chuck UebeleCommunity ExpertCorrect answer
    Community Expert
    August 23, 2016

    Try this script. You can save it as a script then run it in an action and assign a hot key such as F3. The scripts assumes that the path you want to rename is named "Work Path". It also assumes that the naming sequence is PS default's: "Path 1, Path 2...."

    #target photoshop

    var doc = activeDocument;

    var works = true

    try{

        var curPath = doc.pathItems.getByName ('Work Path');

        }

    catch(e){

        works = false;

        alert('There is no path named "Work Path"');

        }

    if(works){

        try{

            var lastPath = doc.pathItems[doc.pathItems.length-2];

            var pNum = lastPath.name.split(' ')[1];

            curPath.name = 'Path ' + (Number(pNum) + 1);

        }

        catch(e){curPath.name = 'Path 1'};

        curPath.deselect();

        }

    Vfxvenkat98
    Known Participant
    August 23, 2016

    is there any possibility to run the script automatically via Scripts Events manager

    Chuck Uebele
    Community Expert
    Community Expert
    July 18, 2016

    What program: PS, IA...?