I'm trying to get the default layer names for background, group, etc used by Photoshop depending on users local language.
As I haven't found a direct way I decided to use javascript instead:
I have a jsx code like
function GetBackground()
{
var message = localize( "$$$/LayerName/Background=Background");
return message;
}
and in the extension I use
| var result:SyncRequestResult = CSXSInterface.instance.evalScript("GetBackground"); |
trace(result);
but result value is undefined.
Any help would be appreciated.
Hello MSSDedalus,
the returned result from the called extend is in form of a object; so you should add this code to the extendscript (just a example):
var xml = '<object>';
var xml = xml += '<property id="strMessage"><string>'+message+'</string></property>';
var xml = xml += '</object>';
and then return the xml variable instead of the message one.
Then, you should have to modify the actionscript code as well:
var result:SyncRequestResult = CSXSInterface.instance.evalScript("GetBackground");
var oResult:Object;
if((SyncRequestResult.COMPLETE == result.status) && result.data)
{
oResult = result.data as Object;
//Make sure oResult has the property you are expecting
if(oResult.hasOwnProperty("strMessage"))
{
var localizedString:String = oResult.strMessage;
}
}
This can be found on the official documentation too.
Best,
Luca
North America
Europe, Middle East and Africa
Asia Pacific