I have had an issue with building an extension for Fireworks (CS6).
The issue is that when certain commands are run in the JSX file, evalScript() never gets a return value.
The problematic functions are these:
- setDocumentImageSize()
- setDocumentCanvasSize()
Most functions in Fireworks work as expected (including exportTo(), alert() ) and evalScript() gets a return value with no issues.
The JSX File has the following: (ResizeImage.jsx)
function jsxFunction()
{
// Fireworks (JS-only app)
fw.getDocumentDOM().setDocumentImageSize({left:0, top:0, right:200, bottom:125}, {pixelsPerUnit:72, units:"inch"}, true, -1);
alert("resize complete");
var xml = '<object>';
xml += '<property id="success"><true/></property>';
xml += '</object>';
return xml;
}
The ActionScript file has the following (ResizeImageJSX.as)
package
{
import com.adobe.csxs.core.CSInterface;
public class ResizeImageJSX
{
public static function run():void
{
trace("begin script");
var result:String = CSInterface.instance.evalScript("jsxFunction");
// This line is never reached because of the function: fw.getDocumentDOM().setDocumentImageSize()
// Event nativeApplication_deactivateHandler() appears to run right after jsx function is complete, and evalScript() continues to wait indefinitely.
trace("Returned a value:" + result);
}
}
}
Any help would be appreciated. I'm not sure if there is any workaround, since FW does not appear to support HostObject (jsxInterface object is null) and I can't find any alternative function in FW.
The purpose of the script is that I want to use actionscript to upload the file after it has been resized in Fireworks.
Thanks in advance!
I found a solution, the older (depricated as of 3.0) CSXSInterface worked!
import com.adobe.csxs.core.CSXSInterface;
import com.adobe.csxs.types.SyncRequestResult;
// jsx script contains fw.getDocumentDOM().setDocumentImageSize()
var result:SyncRequestResult = CSXSInterface.getInstance().evalScript("jsxFunction");
// This has a value
trace("Returned a value:" + result.data.success);
This looks like a CSInterface bug, since the problem doesn't happen with CSXSInterface.
I have the same problem here.
I'm trying to use the evalScript, but CSInterface.instance, and CSXSInterface.getInstance(), and CSXSInterface.instance always give me a Error #1009.
This is the line that generates the error:
CSInterface.instance.evalScript("alert('x', 'y', false)");
I'm using the CSXSLibrary-3.0-sdk-4.5-public.swc from http://download.macromedia.com/pub/developer/creativesuite/extension-b uilder/cssdk-free-2.0.zip.
My Photoshop is CS6 version: 13.0 x64.
Any help will be appreciated!
Thanks a lot!
North America
Europe, Middle East and Africa
Asia Pacific