Copy link to clipboard
Copied
Hello,
when i use code bellow
'app.activeDocument.activeLayer = layer
executeAction( sTT('placedLayerEditContents'), undefined, DialogModes.NO );'
error occured: The command edit content is not currently available.
what is wrong??
Thanks so much
Copy link to clipboard
Copied
These work for me:
var idplacedLayerEditContents = stringIDToTypeID( "placedLayerEditContents" );
var desc3536 = new ActionDescriptor();
executeAction( idplacedLayerEditContents, desc3536, DialogModes.NO );
or
app.runMenuItem(stringIDToTypeID('placedLayerEditContents'));
Copy link to clipboard
Copied
thanks,but not for me ,still error. this is my code:
function _checkLayers(layers, expFile)
{
for(var i = 0 ; i < layers.length ; i++)
{
var layer = layers[i];
if ( layer.visible == false ) {
continue
}
if(layer.typename == 'ArtLayer')
{
if ( layer.bounds[0] < layer.bounds[2] && layer.bounds[1] < layer.bounds[3] )
{
app.activeDocument.activeLayer = layer
_trySaveImage( expFile )
}
}
else
{
_checkLayers(layer.layers, expFile);
}
}
}
function _trySaveImage( expFile ) {
var layer = app.activeDocument.activeLayer
var fn = _getLayerName(layer)
var filename = _getUniquePngName(fn)//create unique png name
_writeData(layer, filename, expFile);//export layer data
if ( layer.kind != LayerKind.TEXT && !_isCommonPng(fn))
{
app.activeDocument.activeLayer = layer
var desc3536 = new ActionDescriptor();
executeAction( sTT('placedLayerEditContents'), desc3536, DialogModes.NO );
_saveImage(filename);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
allnames.push( filename )
}
}
_checkLayers(app.activeDocument.layers,expFile).
Copy link to clipboard
Copied
Could you please post screenshots with the pertinent Panels (Toolbar, Layers, Options Bar, …) visible?
The Script seems to check against Type Layers but not whether the Layer is a Smart Object.
Copy link to clipboard
Copied
@c.pfaffenbichler, i think in this case there will be a different error message. But i can't check it now
Copy link to clipboard
Copied
My photoshop only supports chinese ...
Copy link to clipboard
Copied
The active Layer seems to be a Shape Layer, not a Smart Object, so placedLayerEditContents would not be able to be performed on it.
Copy link to clipboard
Copied
Del
Copy link to clipboard
Copied
c.pfaffenbichler noticed it first
Copy link to clipboard
Copied
Oh loll, now it seems I didn't notice something you said few minutes earlier 😉
Copy link to clipboard
Copied
What about c.pfaffenbichler, didn't he noticed it as very first?
Copy link to clipboard
Copied
Yes. I missed his message. Deleted my comment so as not to be misleading
Copy link to clipboard
Copied
Now without original content in your post, reading our conversation misleads even more 😛
Copy link to clipboard
Copied
in manual mode without using a script are smart objects edited normally?
I had a similar problem when using a script and accidentally changed the name of the layer with ASCII control character inside it.
Copy link to clipboard
Copied
Could you give an example of such ASCII control characer in layer name making the error?
Copy link to clipboard
Copied
OK. I'll try to find files with this layers.
Copy link to clipboard
Copied
Found. The problem was not in renaming the smart object, but in the fact that after renaming the pixel layer with the script, it was converted into a smart object:
activeDocument.activeLayer.name = activeDocument.activeLayer.name +"\r"
executeAction( stringIDToTypeID('newPlacedLayer'), undefined, DialogModes.NO );
executeAction( stringIDToTypeID('placedLayerEditContents'), undefined, DialogModes.NO ); //error
(there will be an error with other control characters).
if you rename an already created smart object, there will be no error
Copy link to clipboard
Copied
I tried to reproduce it manually by pasting control character but it worked. A scripting bug?
Copy link to clipboard
Copied
I tried renaming the layer by adding a carriage return code (manually typing alt + 013, and also pasting this symbol through the buffer) and after that read the layer name through a script. I did not see this char code, and did not see changing the number of characters in the name. Most likely, there is a control of characters during manual input and such an error is simply impossible to reproduce without the use of scripts.
Photoshop separately stores the name of the smart object assigned to it during creation and current name of layer (this can explain the absence of an error when renaming a ready-made smart object). The error occurs if there are characters in the original name are incompatible with the file system.
Copy link to clipboard
Copied
I tried renaming the layer by adding a carriage return code (manually typing alt + 013, and also pasting this symbol through the buffer) and after that read the layer name through a script. I did not see this char code, and did not see changing the number of characters in the name. Most likely, there is a control of characters during manual input and such an error is simply impossible to reproduce without the use of scripts.
By @jazz-y
: )
upd. у топикстартера не смарт-объект
Copy link to clipboard
Copied
Я не за компьютером. А перевод каретки или символ новой строки?
Точно, у него там шейп 🤦
Copy link to clipboard
Copied
где? файл в упор не вижу. каретка таким макаром записывается как видимый символ, но ошибки не вызывает, но твой скрипт интересен. ломает смарт-рбект на прочь, даже для ручного редактирования. потом разберусь. сейчас некогда.
Copy link to clipboard
Copied
Показалось (с телефона).
1 сентября? 🙂
Да, можно лочить смарт-объекты. Правда я это как-то обходил (запорол кучу слоев, потом разгребал как их отредактировать). Пару лет назад было, не помню что сделал в итоге.
Copy link to clipboard
Copied
Да, можно лочить смарт-объекты. Правда я это как-то обходил (запорол кучу слоев, потом разгребал как их отредактировать). Пару лет назад было, не помню что сделал в итоге.
By @jazz-y
экспорт контент - реплейс на этот файл
не? : )
Copy link to clipboard
Copied
А перевод каретки или символ новой строки?
By @jazz-y
Ни черта оказывается не работает через дублирование : (.
При наборе AltDown 13 AltUp вставляется "нота" - 0x266A почему-то, а не 0xD. Если в буфер засунуть реально этот символ (13 или 10 или другие), то фотошоповские контролы его просто не воспринимают.
Так что руками такую ситуацию не воспроизвести. Стандартные не файловые символы отфильтровываюися из имени слоя в момент создания имени файла при создании смарт-объекта.
НО ПРО ВОЗВРАТ КАРЕТКИ ОНИ ЗАБЫЛИ!! БАГ!! 🙂