Hello,
I'm currently working on a Creative Suite Extension, which will show a collection of images on a panel (InDesign, Photoshop and Illustrator).
I need the application's path in a few javascript files and I'm getting weird problems on our testing-Mac. I have reduced the code to as few lines as possible, to show the problem.
Currently I'm using Photoshop CS5.1, Flash Builder 4.6 and Extension Builder 1.5 on my windows machine.
This is the code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
initialize="initializeHandler()">
<mx:Script>
<![CDATA[
import com.adobe.csawlib.photoshop.Photoshop;
import com.adobe.photoshop.*;
protected function initializeHandler():void
{
var app : com.adobe.photoshop.Application = com.adobe.csawlib.photoshop.Photoshop.app;
if(app.path)
myLabel.text = app.path.nativePath;
else
myLabel.text = "app.path was null";
}
]]>
</mx:Script>
<mx:VBox height="100%" width="100%" verticalAlign="middle" horizontalAlign="center">
<mx:Label id="myLabel"/>
</mx:VBox>
</mx:Application>
On my Windows machine myLabel shows the installation directory's path. On our Mac app.path is null, so it does not work.
I have tried many different approaches to solve this, but it doesn't work yet. Here are some ideas of what I tried so far:
- Get the path in Javascript instead using app.path.fsName (app.path is null on Mac in Javascript too, at least when it's called by the initialzeHandler)
- Put a timer in the initializeHandler, wait 10 seconds and try to get the path then (not a good idea and app.path is still null)
- Put a button on the panel that executes the initializeHandler instead. (app.path is working, but I need this to work without user interaction).
Can somebody enlighten me please?
Btw. I'm a developer trainee so it is likely that there is a simple solution or an obvious mistake, feel free to point them out.