Hello:
PC W7 64 bit CS3.
While working on the error processing for entering a file name I came across something that has appeared that I can't find from where it came.
The panel field:
ewDLIESFile = ewDLIES2.add("edittext");
ewDLIESFile.preferredSize.width = 565;
ewDLIESFile.addEventListener('change',function () {chkDlies("field")});
ewDLIESFileBrowse = ewDLIES2.add("button", undefined, "Browse");
ewDLIESFileBrowse.onClick = function() {chkDlies("button");};
The check function:
Code: Select all // On click / On change check DLIES file
function chkDlies(a)
{
alert(ewDLIESFile.text);
if (a == "button")
{
var DLIESFile = new File(app.activeDocument.path).openDlg("Select IGEdit .dlies file related to this PSD", ".dlies");
if (DLIESFile == null)
alert(DLIESFile+" "+ewDLIESFile.text);
var DLIESFile = new File(ewDLIESFile.text);
}
if (a == "field")
var DLIESFile = new File(ewDLIESFile.text);
alert(DLIESFile+" "+ewDLIESFile.text);
//
var x = DLIESFile.fullName;
var i = x.lastIndexOf(".");
errorSwitches[4] = false;
ewDLIESFileErr.hide();
if (i == -1)
{
ewDLIESFileErr.text = "File extension not found.";
errorSwitches[4] = true;
ewDLIESFileErr.show();
}
else if ( ! (x.substr(i+1,5) == "dlies" || x.substr(i+1,5) == "DLIES"))
{
ewDLIESFileErr.text = "File extension not .dlies";
errorSwitches[4] = true;
ewDLIESFileErr.show();
}
else if (DLIESFile == null || ! DLIESFile.exists)
{
ewDLIESFileErr.text = "File does not exist.";
errorSwitches[4] = true;
ewDLIESFileErr.show();
}
if (DLIESFile != null)
ewDLIESFile.text = DLIESFile.fsName;
if (anyError())
ewNote1.show();
else
ewNote1.hide();
}
The input field is blank. I key in fred and press tab. The first alert shows fred. The second one shows the following file name in URI format and fred.
The file name in the field becomes: C:\Program Files (x86)\Adobe\Adobe Photoshop CS3\fred
If I press the Browse button and then cancel on the file select panel with out making a selection, the first alert shows null. The second one shows the following file name in the URI format.
The file name in the field becomse: C:\Program Files (x86)\Adobe\Adobe Photoshop CS3\tmp00000001
I don't want the panel field to be updated if there is an error so the user can see what they entered.
(I can do that.)
I put in some of the code to check for null because I was getting errors about a null File object.
The question is: Where is the other data comming from?
Thanks for any help.
Paul Masters