[FIXED] Error loading .atn files through Javascript

Issue

Hello I’m new to scripting in Photoshop.

I’m trying to load a atn file into photoshop through script. I’m sure I had it working when I was initially scouting out this script, but now whenever I try to run it I get an error

Error 1233: Expected a reference to an existing File/Folder line 2 -> app.load(new File(path));

Below is my stripped down code. I cut down the path as small as I could in case I had a typo, but still no luck.

var path = "C:\\test.atn";
app.load(new File(path));

Loading the .atn file through File->Open menu works so I don’t think it’s a problem with the .atn file.

Solution

I initially had problems with this. The script is fine.

function load_action (apath)
{
    var actionFile = new File(apath);
    if(!actionFile.exists)
    {
        alert("Action file does not exist! \n" + apath);
        return;
    }
    else
    {
        app.load(actionFile);
        alert("loaded!");
    }
}

However… I was accessing the script above through an action – which I’ve got on a shortcut and there was a action load/play conflict.

Could not complete your request because an action that is playing or recording can’t be deleted.

Try the above and use File…Scripts…(Browse) to access you script.

Answered By – Ghoul Fool

Answer Checked By – Katrina (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published