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.
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
North America
Europe, Middle East and Africa
Asia Pacific