Skip navigation
BigGunN
Currently Being Moderated

ScriptUI openDialog not working downgrading from CS5.5 to CS4

Apr 3, 2012 10:31 PM

So here is my newest bit of fun.  The scripts I have been writing have been in CS5.5, but I was informed today that they need to run on CS4.

 

Most everything seems to be working, except one critical piece. Here is  a quick summary of what I am doing. 

 

I am opening a window that has two text boxes and two buttons.  The first button opens up a file dialog box that lets the client choose where their XML file is located.  When they select it and click ok, it populates the first text box with the path. 

 

The second button opens up a folder dialog box that lets the client choose the location of their images folder, and when they click ok, it populates the second text box with the path. 

 

Everything works peachy in CS5.5.  But when I tried it in CS4, this is what it is doing.  When I choose a file and click OK, it is populating the text box with the word "File".  When I choose a folder, it is populating the second box with the word "Folder"

 

Here are the relevant functions:

 

f2.onClick = function()

{

     tf = File.openDialog("Select your XML File","*.xml");

     if (tf != null)

     {

          e2.text = tf;

          tf = tf.fsName;

     }

}

 

f3.onClick = function()

{

     var tfol = new Folder("~/My Documents")

     tfo = tfol.selectDlg("Get Folder");

     if (tfo != null)

     {

          e3.text = tfo;

          tfo = tfo.fsName;

     }

}

 

Like I said, this is working fine is CS5.5, but I need to know what is different in CS4 and how to get it to work.

 

Thanks in advance for all your help.

 
Replies
  • Currently Being Moderated
    Apr 4, 2012 2:21 AM   in reply to BigGunN

    Add a line to your code:

     

    if (tf != null)

         {

         $.writeln (tf.constructor.name);

          e2.text = tf;

          tf = tf.fsName;

         }

     

    And run your script from the ESTK with the console open. You'll see that File is printed. So tf is not a string but a file object. Use e2.text = tf.fsName to display the file's full path name or e2.text = tf.name to show just the name. The same applies to the other function, the one that shows Folder instead of the folder's name.

     

    Peter

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 4, 2012 3:21 AM   in reply to Peter Kahrel

    Is this a change in File/Folder handling from CS4 to CS5?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 4, 2012 3:43 AM   in reply to [Jongware]

    I doubt it. I can't check in CS4 (uninstalled that one accidentally), but in CS3, CS5, and CS5.5, File.openDialog() returns a file object, not a string, so you'd think that CS4 would, too.

     

    Peter

     
    |
    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