I'm kinda new to photoshop scripting, thou i have programming experience, and i've recently encountered a very nasty error while running my script.
Basicaly my script does some cropping and layer manipulation, but at a certain point i try to clear a selection with
Code: Select allapp.activeDocument.selection.clear();
and i get: "the command 'delete' is not currently available"
well... thinking i could go around i tryed
Code: Select allapp.activeDocument.selection.cut();
and even (from script listener)
Code: Select allvar id41 = charIDToTypeID( "Dlt " );
executeAction( id41, undefined, DialogModes.NO );
and all pop up the same error
the code for the function is (follow the debugFile.write for info):
Code: Select allfunction parseLayers(group, ch)
{
debugFile.write("Parsing the layers...\n");
for(idx=0;idx<group.length;idx++)
{
group[idx].visible=false;
}
//browse through all the art layers
for(layerIdx=0;layerIdx<group.length;layerIdx++)
{
group[layerIdx].visible=true;
if(layerIdx!=0)group[layerIdx-1].visible=false;
debugFile.write("selecting "+ch+"... ");
AD.selection.load(AD.channels[ch], SelectionType.REPLACE, 0, false);
debugFile.write("inverting...");
AD.selection.invert();
debugFile.write("clearing..."); //DOESN'T WORK

app.activeDocument.selection.clear();
//AD.selection.cut();
//var id41 = charIDToTypeID( "Dlt " );
//executeAction( id41, undefined, DialogModes.NO );
debugFile.write("inverting again...");
AD.selection.invert();
debugFile.write("done\n");
saveElement(folder, group[layerIdx]);
}
debugFile.write("...done parsing layers\n");
}
...and if i comment the line for clearing, my script runs smoothly...
Can anyone pls tell me any way i can clear that selection, or bypass this error...
thanks in advance