Skip navigation
Currently Being Moderated

Different behaviour on Mac/Win

Jun 28, 2012 8:31 AM

Tags: #illustrator #photoshop #indesign #creative_suite #csawlib #extension_builder

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.

 
Replies
  • Currently Being Moderated
    Jun 28, 2012 11:34 AM   in reply to MPDTrainee

    Hi,

    for what is worth, with Extension Builder 2.0 (Flash Builder 4.5.1) on OSX Lion, the following works:

     

    package

    {

              import com.adobe.csawlib.photoshop.Photoshop;

              import com.adobe.photoshop.*;

     

              public class ZPhotoshop

              {

      public static function run():void

                        {

                                  var app:Application = Photoshop.app;

                                  if(app.path) {

                                            trace("App path is: " + app.path.nativePath);

                                  } else {

      trace("null path");

                                  }

                        }

              }

    }

     

    (this is in the .as file that EB creates by default)

    The result is:

     

    App path is: /Applications/Adobe Photoshop CS6

     

    Regards,

    Davide

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 29, 2012 1:14 AM   in reply to MPDTrainee

    Hello,

    actually it was on triggered by a button click, but I've tested moving it inside an applicationComplete (which in turns calls the run() function) and it works as well.

     

    Davide

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 29, 2012 4:28 AM   in reply to MPDTrainee

    I'd say you have two options:

     

    1) Use ExtendScript to get the path.

    2) Add a short timer on CreationComplete and get the path on the timer event.

     

    Harbs

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 29, 2012 5:43 AM   in reply to MPDTrainee

    MPDTrainee,

    this last example you've posted is referred to Extension Builder 1.5 or 2.0?

    If you can, you'd be better upgrading.

    Cheers

     

    Davide

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points