⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dspcli.jse

📁 javascript source code part2
💻 JSE
字号:
//~    title: Simple File DSP Client Script

   /*
      Copyright 1999 by Ronald Terry Constant
      http://www.rtconstant.com
   */

   /*.
dspcli.jse
    syntax: sewin32.exe dspcli.jse [infile] [outfile]
     where: infile - a file specification, complete path specification,
            or UNC specification, that is, infile may be a filespec,
            pathspec, or network file. The parameter infile specifies the
            file from which the client receives statements. These
            statements are sent to the client script from server scripts.
            The infile for the client script corresponds to the outfile for
            the server.

            outfile - a file specification, complete path specification, or
            UNC specification, that is, outfile may be a filespec,
            pathspec, or network file. The parameter outfile specifies the
            file to which the client writes statements to be received by a
            server script. The outfile for the client corresponds to the
            infile for a server.
      desc: A client script run on a computer using files to communicate
            with a host. File DSP is useful on a local area network. This
            script is very simple, largely for illustrative purposes.

            Note the infile and outfile parameters for both the
            dspcli.jse and dspsrvr.jse scripts. These files need to
            correspond. The client infile corresponds to the server
            outfile, and the client outfile corresponds to the server
            infile. That is, output from one script is input for the other.
            Though both the server and the client specify two files, they
            are the same two files, that is, only two files are created.
            These files must be accessible by both the server and the
            client.

            This script differs from its iDSP counterparts in that this
            script uses files to pass information and the iDSP scripts use
            Internet protocol to pass information. File DSP is simple and
            useful, but is not as robust as Internet DSP.
   example: // In our examples we assume that the host computer is "main"
            // The interpreter executable is omitted at the beginnings
            // of the command line examples (see syntax above).

               // Start a file DSP client using files in the root
               // directory of drive c of the host computer
            dspcli.jse \\main\c\dspsrvr.out \\main\c\dspsrvr.in
               // The following command line arguments would use a common
               // directory on a computer named "main" in a network.
            dspcli.jse \\main\common\dspsrvr.out \\main\common\dspsrvr.in

            // The examples in dspsrvr.jse correspond

   .*/

#include "dspfile.jsh"

function main(argc, argv)
{
      // Get the in and out filespecs passed on the command line
   var filFromServer = (argv[1]) ? argv[1] : "dspsrvr.out";
   var filToServer   = (argv[2]) ? argv[2] : "dspsrvr.in";

      // Establish connection and get new DSP object
   var connection = new fileDSP(filFromServer, filToServer);
   if(connection != null)
   {
      // If a connection is made, send the following commands

         // Display a hello message on the host/server computer
      connection.Screen.writeln("Hello from dspClient!");
         // Include write.jsh, which has enhanced write methods, and display
         // a message, using one of the methods, on the host computer.
      connection.eval(`#include "write.jsh"; Writeln("write.jsh was included");`);
         // Run multiple statments as if they were script on the host
         // computer.
      var ScriptLines =
         `Screen.writeln("This is line one");`
         `Screen.writeln("This is line two");`
         `Screen.writeln("This is line three");`;
      connection.eval(ScriptLines);
         // Execute an external program on the host computer, assuming that
         // the host computer has the program "Notepad.exe".
      connection.SElib.spawn(P_NOWAIT, "Notepad.exe");

         // Close this file connection
      connection.dspClose();
   }
} //main

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -