P
Paul E. Schoen
I have a simple JavaScript utility that saves specific files to a directory.
It was originally developed on my XP machine and I recently made some
changes for the Vista machine I am now using. I also added several files to
the lists, and I saw an "Object Error", which I traced to a specific file. I
saw that it was ReadOnly, so I changed that without success. But if I
renamed it, the script ran fine, even if the renamed file was made ReadOnly.
Here is a portion of the script that throws the error:
Path = "C:\\Users\\Paul\\Documents\\Delphi\\PStechLib\\"
DestFolder = "LibCode\\";
WScript.Echo("Saving PStechLib project files to Folder " + Path +
DestFolder);
SourceFile[0] = "Debug.*";
SourceFile[1] = "xygraph.*";
// ....
SourceFile[13] = "SerialNG.dcu";
SourceFile[14] = "SerialNGx.pas"; // Error if I use SerialNG.pas or
SerialNG*.*
MAXFILES = 15; //Set to one higher than last index
FileList = "";
FilesSaved = 0;
try {
for (i=0; i < MAXFILES; i++) {
fso.CopyFile ( Path+SourceFile, Path+DestFolder);
FileList += SourceFile + " ";
FilesSaved++; }
}
catch(e) {
WScript.Echo("Error " + e); }
finally {
WScript.Echo( FileList );
WScript.Echo( FilesSaved + " Files Saved"); }
I'd rather not use the workaround of renaming a file, but rather understand
and fix this odd behavior. If I put the offending file earlier in the list,
it throws the error and does not process the rest. I no longer have a
working XP machine to see if it's an OS quirk. Ideas?
Thanks,
Paul
It was originally developed on my XP machine and I recently made some
changes for the Vista machine I am now using. I also added several files to
the lists, and I saw an "Object Error", which I traced to a specific file. I
saw that it was ReadOnly, so I changed that without success. But if I
renamed it, the script ran fine, even if the renamed file was made ReadOnly.
Here is a portion of the script that throws the error:
Path = "C:\\Users\\Paul\\Documents\\Delphi\\PStechLib\\"
DestFolder = "LibCode\\";
WScript.Echo("Saving PStechLib project files to Folder " + Path +
DestFolder);
SourceFile[0] = "Debug.*";
SourceFile[1] = "xygraph.*";
// ....
SourceFile[13] = "SerialNG.dcu";
SourceFile[14] = "SerialNGx.pas"; // Error if I use SerialNG.pas or
SerialNG*.*
MAXFILES = 15; //Set to one higher than last index
FileList = "";
FilesSaved = 0;
try {
for (i=0; i < MAXFILES; i++) {
fso.CopyFile ( Path+SourceFile, Path+DestFolder);
FileList += SourceFile + " ";
FilesSaved++; }
}
catch(e) {
WScript.Echo("Error " + e); }
finally {
WScript.Echo( FileList );
WScript.Echo( FilesSaved + " Files Saved"); }
I'd rather not use the workaround of renaming a file, but rather understand
and fix this odd behavior. If I put the offending file earlier in the list,
it throws the error and does not process the rest. I no longer have a
working XP machine to see if it's an OS quirk. Ideas?
Thanks,
Paul