Note that there are some explanatory texts on larger screens.

plurals
  1. POScript Works on Win 7, Not on Server 2003
    primarykey
    data
    text
    <p>I have a script that is rather simple, it boots up WinSCP and checks the directory for a file that starts with "TSA". If the file exists, it exits, if it does not exist, it transfers over a new file. </p> <p>Its up and running on my Windows 7 machine, that is where i created it - but when i transfer it over to my server [windows server 2003] it never finds the file. </p> <p>My script:</p> <pre><code>var FILEPATH = "../zfinance/TSA"; // Session to connect to var SESSION = "someplace@somewhere.com"; // Path to winscp.com var WINSCP = "c:\\program files\\winscp\\winscp.com"; var filesys = WScript.CreateObject("Scripting.FileSystemObject"); var shell = WScript.CreateObject("WScript.Shell"); var logfilepath = filesys.GetSpecialFolder(2) + "\\" + filesys.GetTempName() + ".xml"; var p = FILEPATH.lastIndexOf('/'); var path = FILEPATH.substring(0, p); var filename = FILEPATH.substring(p + 1); var exec; // run winscp to check for file existence exec = shell.Exec("\"" + WINSCP + "\" /log=\"" + logfilepath + "\""); exec.StdIn.Write( "option batch abort\n" + "open \"" + SESSION + "\"\n" + "ls \"" + path + "\"\n" + "exit\n"); // wait until the script finishes while (exec.Status == 0) { WScript.Sleep(100); WScript.Echo(exec.StdOut.ReadAll()); } if (exec.ExitCode != 0) { WScript.Echo("Error checking for file existence"); WScript.Quit(1); } // look for log file var logfile = filesys.GetFile(logfilepath); if (logfile == null) { WScript.Echo("Cannot find log file"); WScript.Quit(1); } // parse XML log file var doc = new ActiveXObject("MSXML2.DOMDocument"); doc.async = false; doc.load(logfilepath); doc.setProperty("SelectionNamespaces", "xmlns:w='http://winscp.net/schema/session/1.0'"); doc.setProperty("SelectionLanguage", "XPath"); var nodes = doc.selectNodes("//w:file/w:filename[starts-with(@value, '" + filename + "')]"); if (nodes.length &gt; 0) { WScript.Echo("File found"); WScript.Quit(0); } else { WScript.Echo("File not found"); WScript.Quit(1); } </code></pre> <p>After much investigation, i think i've found the piece of code that does not function properly:</p> <pre><code>// parse XML log file var doc = new ActiveXObject("MSXML2.DOMDocument.6.0"); doc.async = false; doc.load(logfilepath); doc.setProperty("SelectionNamespaces", "xmlns:w='http://winscp.net/schema/session/1.0'"); </code></pre> <p>The only problem is, i have no idea why. The log file at this point should be written over with the xml code, but this does not happen.</p> <p>Thanks in advance for any help. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload