<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://pickwiki.org/index.php?action=history&amp;feed=atom&amp;title=RunAProgram</id>
	<title>RunAProgram - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://pickwiki.org/index.php?action=history&amp;feed=atom&amp;title=RunAProgram"/>
	<link rel="alternate" type="text/html" href="https://pickwiki.org/index.php?title=RunAProgram&amp;action=history"/>
	<updated>2026-04-28T21:33:23Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://pickwiki.org/index.php?title=RunAProgram&amp;diff=2553&amp;oldid=prev</id>
		<title>TonyG at 22:05, 15 May 2015</title>
		<link rel="alternate" type="text/html" href="https://pickwiki.org/index.php?title=RunAProgram&amp;diff=2553&amp;oldid=prev"/>
		<updated>2015-05-15T22:05:12Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://pickwiki.org/index.php?title=RunAProgram&amp;amp;diff=2553&amp;amp;oldid=2170&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>TonyG</name></author>
	</entry>
	<entry>
		<id>https://pickwiki.org/index.php?title=RunAProgram&amp;diff=2170&amp;oldid=prev</id>
		<title>Conversion script: link fix</title>
		<link rel="alternate" type="text/html" href="https://pickwiki.org/index.php?title=RunAProgram&amp;diff=2170&amp;oldid=prev"/>
		<updated>2015-02-26T23:48:55Z</updated>

		<summary type="html">&lt;p&gt;link fix&lt;/p&gt;
&lt;a href=&quot;https://pickwiki.org/index.php?title=RunAProgram&amp;amp;diff=2170&amp;amp;oldid=2169&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Conversion script</name></author>
	</entry>
	<entry>
		<id>https://pickwiki.org/index.php?title=RunAProgram&amp;diff=2169&amp;oldid=prev</id>
		<title>TonyG: Created AccuTermFileTransfer page and added link here</title>
		<link rel="alternate" type="text/html" href="https://pickwiki.org/index.php?title=RunAProgram&amp;diff=2169&amp;oldid=prev"/>
		<updated>2010-02-15T23:25:03Z</updated>

		<summary type="html">&lt;p&gt;Created AccuTermFileTransfer page and added link here&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;HomePage&amp;gt;&amp;gt;HowTos&amp;gt;&amp;gt;RunAProgram&lt;br /&gt;
&lt;br /&gt;
The problem: you want a program to run on a windows PC as a result of something that happens on your Windows or Unix-based server.&lt;br /&gt;
It&amp;#039;s usually less of an issue to have a Unix server run something on a Unix client, or Windows server to Windows client - there&amp;#039;s plenty of built in ways for that to work. So we&amp;#039;ll just consider a Windows PC with a network connection (LAN,WAN or VPN) to a Unix server.&lt;br /&gt;
&lt;br /&gt;
For this to work &amp;quot;something&amp;quot;, some program, has to be running on the PC.&lt;br /&gt;
&lt;br /&gt;
==== 0) TerminalEmulators ====&lt;br /&gt;
&lt;br /&gt;
The most common &amp;quot;something&amp;quot; is a terminal emulator and they pretty much all allow you to send an escape sequence and fire off a program. If you want the program to run in response to something the user did on the server, this is the most straightforward way to do it.  Also, if you have a serial connection, this is probably the only option.&lt;br /&gt;
&lt;br /&gt;
* wIntegrate: &lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
Use the WIN.PCRUN command installed on the server, CALL WIN.PCRUN(COMMAND,ARGS)&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Accuterm:&lt;br /&gt;
To execute a command and return to PICK/BASIC immediately:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
PRINT CHAR(27):CHAR(2):&amp;quot;&amp;lt;&amp;quot;:command:CHAR(13)&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
To execute a command and wait for the command to terminate before returning to PICK/BASIC:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
PRINT CHAR(27):CHAR(2):&amp;quot;&amp;gt;&amp;quot;:command:CHAR(13)&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See &amp;lt;nowiki&amp;gt;AccuTerm&amp;lt;/nowiki&amp;gt; help for details: From the Help Introduction, see &amp;lt;nowiki&amp;gt;AccuTerm&amp;lt;/nowiki&amp;gt; Programming. Also see Help on Object Bridge.&lt;br /&gt;
&lt;br /&gt;
More examples are at AccuTermFileTransfer.&lt;br /&gt;
&lt;br /&gt;
* ViaDuct:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
?&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Powerterm:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
PRINT CHAR(27):&amp;quot;$tS&amp;quot;:COMMAND:CHAR(27):&amp;quot;\&amp;quot;&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Netterm:&lt;br /&gt;
Start/run the program specified by COMMAND.&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
CRT CHAR(27):&amp;quot;[]&amp;quot;:COMMAND:CHAR(27):&amp;quot;[1*&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
Send the URL to the client&amp;#039;s WWW browser for processing.&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
CRT CHAR(27):&amp;#039;[]&amp;#039;:URL:CHAR(27):&amp;#039;[0*&amp;#039;&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
Start/run the program specified by COMMAND and wait till it terminates. COMMAND can contain both the program to run and command line arguments.&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
CRT CHAR(27):&amp;quot;[]&amp;quot;:COMMAND:CHAR(27):&amp;quot;[9*&amp;quot;&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
Start the program associated with the extension contained within FILENAME.&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
CRT CHAR(27):&amp;quot;[]&amp;quot;:FILENAME:CHAR(27):&amp;quot;[12*&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1) Doit ====&lt;br /&gt;
&lt;br /&gt;
Doit is a small utility program that installs a tray applet on the client.  The server sends it the path of a file to open.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
http://www.chiark.greenend.org.uk/~sgtatham/doit/&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 2) Install rcmd ====&lt;br /&gt;
&lt;br /&gt;
Either from the windows resource kit, or purchase it from mks.  You can then issue an rcmd from the unix side.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
http://www.dynawell.com/support/ResKit/winnt.asp&lt;br /&gt;
http://www.mkssoftware.com/support/kb/faqs.asp?product=Toolkit&amp;amp;type=tech#art140&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 3) Install or turn on a telnet server ====&lt;br /&gt;
&lt;br /&gt;
W2K/XP come with a telnet server, or you can purchase one.  Then use http://expect.nist.gov to script the login/command process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
http://www.goodtechsys.com/&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 4) Install an ssh server ====&lt;br /&gt;
&lt;br /&gt;
Just like telnet, only secure!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
http://tech.erdelynet.com/cygwin-sshd.html&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 5a) Write a small server program ====&lt;br /&gt;
&lt;br /&gt;
Have the program listen on a predefined port.  There are obvious security issues here, but with a little handwaving we can move past them :-)&lt;br /&gt;
&lt;br /&gt;
Recent U2 products can create socket connections from basic and connect to the server.  Sample code for this is at BasicSocketClient.&lt;br /&gt;
&lt;br /&gt;
Here&amp;#039;s a stripped down example of a server in &amp;lt;a href=&amp;quot;http://www.python.org&amp;quot;&amp;gt;Python&amp;lt;/a&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
urlserver.py&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
import SocketServer&lt;br /&gt;
import os&lt;br /&gt;
&lt;br /&gt;
class UrlHandler(SocketServer.StreamRequestHandler):&lt;br /&gt;
    def handle(self):&lt;br /&gt;
        url=self.rfile.readline(512)&lt;br /&gt;
        print &amp;quot;opening &amp;quot;+url&lt;br /&gt;
        os.system(&amp;quot;start &amp;quot;+url)&lt;br /&gt;
&lt;br /&gt;
server=SocketServer.TCPServer( (&amp;#039;&amp;#039;, 79), UrlHandler)&lt;br /&gt;
server.serve_forever()&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the pc, type &amp;quot;python urlserver.py&amp;quot; to start the server up, then from another machine, &amp;quot;telnet pc-address 79&amp;quot; and then type the url to go to - the client will open up a browser and go to that address.&lt;br /&gt;
&lt;br /&gt;
==== 5b) ...and here&amp;#039;s another in vbscript ====&lt;br /&gt;
&lt;br /&gt;
urlserver.vbs&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
Option Explicit&lt;br /&gt;
&lt;br /&gt;
&amp;#039; Heavily cribbed from the amazing 4K webserver at:&lt;br /&gt;
&amp;#039; http://www.interclasse.com/scripts/4KWebServer.php&lt;br /&gt;
&lt;br /&gt;
Dim oSck&lt;br /&gt;
On Error Resume Next&lt;br /&gt;
Err.Number=0&lt;br /&gt;
Set oSck=WScript.CreateObject(&amp;quot;MSWinsock.Winsock&amp;quot;,&amp;quot;s_&amp;quot;)&lt;br /&gt;
Select Case Err.Number&lt;br /&gt;
    Case 0&lt;br /&gt;
    case &amp;amp;H80040112&lt;br /&gt;
        echo &amp;quot;No licence found. Install Visual Studio&amp;quot;&lt;br /&gt;
    case &amp;amp;H80020009&lt;br /&gt;
        echo &amp;quot;ActiveX Winsock not in the registry, check if installed or use regsvr32&amp;quot;&lt;br /&gt;
    Case else&lt;br /&gt;
        echo &amp;quot;Error &amp;quot; &amp;amp; Err.Number &amp;amp; &amp;quot; - &amp;amp;H&amp;quot; &amp;amp; Hex(Err.Number) &amp;amp; &amp;quot; - &amp;quot; &amp;amp; Err.Description&lt;br /&gt;
End Select&lt;br /&gt;
On Error Goto 0&lt;br /&gt;
&lt;br /&gt;
oSck.LocalPort=79&lt;br /&gt;
oSck.Listen&lt;br /&gt;
echo &amp;quot;Listening on port &amp;quot; &amp;amp; oSck.LocalPort&lt;br /&gt;
Do&lt;br /&gt;
    &amp;#039; Sleep for 2 seconds&lt;br /&gt;
    WScript.sleep 2000&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
Sub echo(S)&lt;br /&gt;
    WScript.Echo Now &amp;amp; &amp;quot; &amp;quot; &amp;amp; S&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Sub s_ConnectionRequest(Byval requestID)&lt;br /&gt;
    oSck.Close&lt;br /&gt;
    echo oSck.RemoteHostIP &amp;amp; &amp;quot; - Connection request:&amp;quot; &amp;amp; requestID&lt;br /&gt;
    oSck.Accept requestID&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Sub s_Close&lt;br /&gt;
    oSck.Close&lt;br /&gt;
    echo &amp;quot;closed - re-listening&amp;quot;&lt;br /&gt;
    oSck.Listen&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Sub s_SendComplete&lt;br /&gt;
    oSck.close&lt;br /&gt;
    oSck.Listen&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Sub s_Error(ByVal N, D, ByVal C, ByVal S, ByVal F, ByVal H, Y)&lt;br /&gt;
    echo &amp;quot;Error&amp;quot; &amp;amp; N &amp;amp; &amp;quot; - &amp;quot; &amp;amp; D&lt;br /&gt;
    oSck.Close&lt;br /&gt;
    oSck.Listen&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Sub s_DataArrival(Byval b)&lt;br /&gt;
    Dim S,sh&lt;br /&gt;
&lt;br /&gt;
    S=&amp;quot;&amp;quot;&lt;br /&gt;
    oSck.GetData S&lt;br /&gt;
    S=left(S,len(S)-2)&lt;br /&gt;
    S=left(S,512)&lt;br /&gt;
    echo S&lt;br /&gt;
&lt;br /&gt;
    set sh = createobject(&amp;quot;wscript.shell&amp;quot;)&lt;br /&gt;
    on error resume next&lt;br /&gt;
    sh.run &amp;quot;cmd /c start &amp;quot; &amp;amp; S&lt;br /&gt;
    on error goto 0&lt;br /&gt;
    &lt;br /&gt;
    oSck.Close&lt;br /&gt;
    oSck.Listen&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the pc, type &amp;quot;cscript urlserver.vbs&amp;quot; to start the server up, then from another machine, &amp;quot;telnet pc-address 79&amp;quot; and then type the url to go to - the client will open up a browser and go to that address.&lt;br /&gt;
&lt;br /&gt;
==== 6) Have a polling program on the client ====&lt;br /&gt;
&lt;br /&gt;
If the client and the server share access to a directory (via samba or NFS for example), the server can drop a file in the common directory and a program running on the client can watch for new files.  When one is found it can read the file and perform some action based on the contents.  Here&amp;#039;s a VB example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
Private Sub Form_Load()&lt;br /&gt;
    txtScheduleNum.Enabled = False&lt;br /&gt;
    cboCategory.Enabled = False&lt;br /&gt;
    cmdOK.Enabled = False&lt;br /&gt;
    cmdPreview.Enabled = False&lt;br /&gt;
    Label1.Enabled = False&lt;br /&gt;
    Label3.Enabled = False&lt;br /&gt;
    &lt;br /&gt;
    Me.Show&lt;br /&gt;
    &amp;#039; Start the poll right away&lt;br /&gt;
    Timer1_Timer&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Private Sub Timer1_Timer()&lt;br /&gt;
    TxtLog.ForeColor = vbBlack&lt;br /&gt;
    LogMsg &amp;quot;Checking c:\batch&amp;quot;&lt;br /&gt;
    Set fso = CreateObject(&amp;quot;Scripting.FileSystemObject&amp;quot;)&lt;br /&gt;
    Set dir = fso.GetFolder(&amp;quot;C:\BATCH&amp;quot;)&lt;br /&gt;
     &lt;br /&gt;
    For Each file In dir.Files&lt;br /&gt;
        If LCase(Right(file.Name, 3)) = &amp;quot;pdf&amp;quot; Then&lt;br /&gt;
            Timer1.Enabled = False&lt;br /&gt;
            TxtLog.Enabled = False&lt;br /&gt;
            fstr = file.Name&lt;br /&gt;
            hpsname = Left(fstr, Len(fstr) - 3) &amp;amp; &amp;quot;hps&amp;quot;&lt;br /&gt;
            justname = Left(fstr, Len(fstr) - 3)&lt;br /&gt;
            LogMsg fstr&lt;br /&gt;
            Label1.Enabled = True&lt;br /&gt;
            Label3.Enabled = True&lt;br /&gt;
            cboCategory.Enabled = True&lt;br /&gt;
            cmdOK.Enabled = True&lt;br /&gt;
            cmdPreview.Enabled = True&lt;br /&gt;
            &amp;#039; Enable some controls and do something with the file&lt;br /&gt;
            txtScheduleNum.SetFocus&lt;br /&gt;
            Exit For&lt;br /&gt;
        End If&lt;br /&gt;
    Next&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 7) Consider using a solution created specifically to solve the problem ====&lt;br /&gt;
(Ad)&lt;br /&gt;
The following link goes to the Nebula R&amp;amp;D forum where an offering is discussed and a link is provided to a blog entry for more information. As of the time of this writing the software is fully usable but is not being offered as a product simply for lack of demand. That situation can change with a compelling business case. http://nebula-rnd.com/forum/index.php/topic,51.0.html&lt;br /&gt;
(/Ad)&lt;br /&gt;
&lt;br /&gt;
A general description of this approach, not specific to the Nebula solution, would be to write a PC program in your favourite language (.Net, Java, Flex for example), that runs on the PC and makes periodic calls to a Pick program using whatever technology makes sense for your Pick variety.  In the U2 world, this would be UniObjects, though a web services call that hides the connection details from the client, and be much more likely to work through firewalls, would make more sense.&lt;br /&gt;
&lt;br /&gt;
Note: this is not exactly the problem we are trying to solve on this page.  The problem is &amp;quot;how do I run a program on the client side, on demand from a Pick program?&amp;quot;  The polling solutions presented suffer from a lag between something happening on the server and a program running on the client.&lt;br /&gt;
&lt;br /&gt;
==== Running a program on the server from outside ====&lt;br /&gt;
Connectivity to MV is discussed many places in this wiki and any language can be used to execute BASIC business rules and return a result. A unique freeware program called [http://nebula-rnd.com/freeware/ MV Exec] uses [[Mv.NET|mv.NET]] to run any query, any command, any program on a MV server from any PC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;TODO&amp;lt;/strong&amp;gt;: Expand on this topic with info about D3 compile to executable with G option, UDT, notes about unique jBASE exe/dll design...&lt;br /&gt;
&lt;br /&gt;
== Discussion ==&lt;br /&gt;
[TG] There are three topics:&amp;lt;br&amp;gt;&lt;br /&gt;
1) Running a program on the client from the server&amp;lt;br&amp;gt;&lt;br /&gt;
2) Running a program on the server from a remote client&amp;lt;br&amp;gt;&lt;br /&gt;
3) Running a program on the server from the MV environment&amp;lt;br&amp;gt;&lt;br /&gt;
Anyone think it&amp;#039;s worthwhile to separate these into different pages?&lt;/div&gt;</summary>
		<author><name>TonyG</name></author>
	</entry>
	<entry>
		<id>https://pickwiki.org/index.php?title=RunAProgram&amp;diff=2171&amp;oldid=prev</id>
		<title>TonyG: Add discussion</title>
		<link rel="alternate" type="text/html" href="https://pickwiki.org/index.php?title=RunAProgram&amp;diff=2171&amp;oldid=prev"/>
		<updated>2009-02-03T08:44:43Z</updated>

		<summary type="html">&lt;p&gt;Add discussion&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;HomePage&amp;gt;&amp;gt;HowTos&amp;gt;&amp;gt;RunAProgram&lt;br /&gt;
&lt;br /&gt;
The problem: you want a program to run on a windows PC as a result of something that happens on your Windows or Unix-based server.&lt;br /&gt;
It&amp;#039;s usually less of an issue to have a Unix server run something on a Unix client, or Windows server to Windows client - there&amp;#039;s plenty of built in ways for that to work. So we&amp;#039;ll just consider a Windows PC with a network connection (LAN,WAN or VPN) to a Unix server.&lt;br /&gt;
&lt;br /&gt;
For this to work &amp;quot;something&amp;quot;, some program, has to be running on the PC.&lt;br /&gt;
&lt;br /&gt;
==== 0) TerminalEmulators ====&lt;br /&gt;
&lt;br /&gt;
The most common &amp;quot;something&amp;quot; is a terminal emulator and they pretty much all allow you to send an escape sequence and fire off a program. If you want the program to run in response to something the user did on the server, this is the most straightforward way to do it.  Also, if you have a serial connection, this is probably the only option.&lt;br /&gt;
&lt;br /&gt;
* wIntegrate: &lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
Use the WIN.PCRUN command installed on the server, CALL WIN.PCRUN(COMMAND,ARGS)&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* AccuTerm:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
PRINT CHAR(27):CHAR(2):&amp;quot;&amp;lt;&amp;quot;&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
See &amp;lt;nowiki&amp;gt;AccuTerm&amp;lt;/nowiki&amp;gt; help for details: From the Help Introduction, see &amp;lt;nowiki&amp;gt;AccuTerm&amp;lt;/nowiki&amp;gt; Programming. Also see Help on Object Bridge.&lt;br /&gt;
&lt;br /&gt;
* ViaDuct:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
?&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Powerterm:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
PRINT CHAR(27):&amp;quot;$tS&amp;quot;:COMMAND:CHAR(27):&amp;quot;\&amp;quot;&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Netterm:&lt;br /&gt;
Start/run the program specified by COMMAND.&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
CRT CHAR(27):&amp;quot;[]&amp;quot;:COMMAND:CHAR(27):&amp;quot;[1*&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
Send the URL to the client&amp;#039;s WWW browser for processing.&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
CRT CHAR(27):&amp;#039;[]&amp;#039;:URL:CHAR(27):&amp;#039;[0*&amp;#039;&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
Start/run the program specified by COMMAND and wait till it terminates. COMMAND can contain both the program to run and command line arguments.&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
CRT CHAR(27):&amp;quot;[]&amp;quot;:COMMAND:CHAR(27):&amp;quot;[9*&amp;quot;&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
Start the program associated with the extension contained within FILENAME.&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
CRT CHAR(27):&amp;quot;[]&amp;quot;:FILENAME:CHAR(27):&amp;quot;[12*&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1) Doit ====&lt;br /&gt;
&lt;br /&gt;
Doit is a small utility program that installs a tray applet on the client.  The server sends it the path of a file to open.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
http://www.chiark.greenend.org.uk/~sgtatham/doit/&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 2) Install rcmd ====&lt;br /&gt;
&lt;br /&gt;
Either from the windows resource kit, or purchase it from mks.  You can then issue an rcmd from the unix side.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
http://www.dynawell.com/support/ResKit/winnt.asp&lt;br /&gt;
http://www.mkssoftware.com/support/kb/faqs.asp?product=Toolkit&amp;amp;type=tech#art140&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 3) Install or turn on a telnet server ====&lt;br /&gt;
&lt;br /&gt;
W2K/XP come with a telnet server, or you can purchase one.  Then use http://expect.nist.gov to script the login/command process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
http://www.goodtechsys.com/&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 4) Install an ssh server ====&lt;br /&gt;
&lt;br /&gt;
Just like telnet, only secure!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
http://tech.erdelynet.com/cygwin-sshd.html&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 5a) Write a small server program ====&lt;br /&gt;
&lt;br /&gt;
Have the program listen on a predefined port.  There are obvious security issues here, but with a little handwaving we can move past them :-)&lt;br /&gt;
&lt;br /&gt;
Recent U2 products can create socket connections from basic and connect to the server.  Sample code for this is at BasicSocketClient.&lt;br /&gt;
&lt;br /&gt;
Here&amp;#039;s a stripped down example of a server in &amp;lt;a href=&amp;quot;http://www.python.org&amp;quot;&amp;gt;Python&amp;lt;/a&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
urlserver.py&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
import SocketServer&lt;br /&gt;
import os&lt;br /&gt;
&lt;br /&gt;
class UrlHandler(SocketServer.StreamRequestHandler):&lt;br /&gt;
    def handle(self):&lt;br /&gt;
        url=self.rfile.readline(512)&lt;br /&gt;
        print &amp;quot;opening &amp;quot;+url&lt;br /&gt;
        os.system(&amp;quot;start &amp;quot;+url)&lt;br /&gt;
&lt;br /&gt;
server=SocketServer.TCPServer( (&amp;#039;&amp;#039;, 79), UrlHandler)&lt;br /&gt;
server.serve_forever()&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the pc, type &amp;quot;python urlserver.py&amp;quot; to start the server up, then from another machine, &amp;quot;telnet pc-address 79&amp;quot; and then type the url to go to - the client will open up a browser and go to that address.&lt;br /&gt;
&lt;br /&gt;
==== 5b) ...and here&amp;#039;s another in vbscript ====&lt;br /&gt;
&lt;br /&gt;
urlserver.vbs&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
Option Explicit&lt;br /&gt;
&lt;br /&gt;
&amp;#039; Heavily cribbed from the amazing 4K webserver at:&lt;br /&gt;
&amp;#039; http://www.interclasse.com/scripts/4KWebServer.php&lt;br /&gt;
&lt;br /&gt;
Dim oSck&lt;br /&gt;
On Error Resume Next&lt;br /&gt;
Err.Number=0&lt;br /&gt;
Set oSck=WScript.CreateObject(&amp;quot;MSWinsock.Winsock&amp;quot;,&amp;quot;s_&amp;quot;)&lt;br /&gt;
Select Case Err.Number&lt;br /&gt;
    Case 0&lt;br /&gt;
    case &amp;amp;H80040112&lt;br /&gt;
        echo &amp;quot;No licence found. Install Visual Studio&amp;quot;&lt;br /&gt;
    case &amp;amp;H80020009&lt;br /&gt;
        echo &amp;quot;ActiveX Winsock not in the registry, check if installed or use regsvr32&amp;quot;&lt;br /&gt;
    Case else&lt;br /&gt;
        echo &amp;quot;Error &amp;quot; &amp;amp; Err.Number &amp;amp; &amp;quot; - &amp;amp;H&amp;quot; &amp;amp; Hex(Err.Number) &amp;amp; &amp;quot; - &amp;quot; &amp;amp; Err.Description&lt;br /&gt;
End Select&lt;br /&gt;
On Error Goto 0&lt;br /&gt;
&lt;br /&gt;
oSck.LocalPort=79&lt;br /&gt;
oSck.Listen&lt;br /&gt;
echo &amp;quot;Listening on port &amp;quot; &amp;amp; oSck.LocalPort&lt;br /&gt;
Do&lt;br /&gt;
    &amp;#039; Sleep for 2 seconds&lt;br /&gt;
    WScript.sleep 2000&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
Sub echo(S)&lt;br /&gt;
    WScript.Echo Now &amp;amp; &amp;quot; &amp;quot; &amp;amp; S&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Sub s_ConnectionRequest(Byval requestID)&lt;br /&gt;
    oSck.Close&lt;br /&gt;
    echo oSck.RemoteHostIP &amp;amp; &amp;quot; - Connection request:&amp;quot; &amp;amp; requestID&lt;br /&gt;
    oSck.Accept requestID&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Sub s_Close&lt;br /&gt;
    oSck.Close&lt;br /&gt;
    echo &amp;quot;closed - re-listening&amp;quot;&lt;br /&gt;
    oSck.Listen&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Sub s_SendComplete&lt;br /&gt;
    oSck.close&lt;br /&gt;
    oSck.Listen&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Sub s_Error(ByVal N, D, ByVal C, ByVal S, ByVal F, ByVal H, Y)&lt;br /&gt;
    echo &amp;quot;Error&amp;quot; &amp;amp; N &amp;amp; &amp;quot; - &amp;quot; &amp;amp; D&lt;br /&gt;
    oSck.Close&lt;br /&gt;
    oSck.Listen&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Sub s_DataArrival(Byval b)&lt;br /&gt;
    Dim S,sh&lt;br /&gt;
&lt;br /&gt;
    S=&amp;quot;&amp;quot;&lt;br /&gt;
    oSck.GetData S&lt;br /&gt;
    S=left(S,len(S)-2)&lt;br /&gt;
    S=left(S,512)&lt;br /&gt;
    echo S&lt;br /&gt;
&lt;br /&gt;
    set sh = createobject(&amp;quot;wscript.shell&amp;quot;)&lt;br /&gt;
    on error resume next&lt;br /&gt;
    sh.run &amp;quot;cmd /c start &amp;quot; &amp;amp; S&lt;br /&gt;
    on error goto 0&lt;br /&gt;
    &lt;br /&gt;
    oSck.Close&lt;br /&gt;
    oSck.Listen&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the pc, type &amp;quot;cscript urlserver.vbs&amp;quot; to start the server up, then from another machine, &amp;quot;telnet pc-address 79&amp;quot; and then type the url to go to - the client will open up a browser and go to that address.&lt;br /&gt;
&lt;br /&gt;
==== 6) Have a polling program on the client ====&lt;br /&gt;
&lt;br /&gt;
If the client and the server share access to a directory (via samba or NFS for example), the server can drop a file in the common directory and a program running on the client can watch for new files.  When one is found it can read the file and perform some action based on the contents.  Here&amp;#039;s a VB example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
Private Sub Form_Load()&lt;br /&gt;
    txtScheduleNum.Enabled = False&lt;br /&gt;
    cboCategory.Enabled = False&lt;br /&gt;
    cmdOK.Enabled = False&lt;br /&gt;
    cmdPreview.Enabled = False&lt;br /&gt;
    Label1.Enabled = False&lt;br /&gt;
    Label3.Enabled = False&lt;br /&gt;
    &lt;br /&gt;
    Me.Show&lt;br /&gt;
    &amp;#039; Start the poll right away&lt;br /&gt;
    Timer1_Timer&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Private Sub Timer1_Timer()&lt;br /&gt;
    TxtLog.ForeColor = vbBlack&lt;br /&gt;
    LogMsg &amp;quot;Checking c:\batch&amp;quot;&lt;br /&gt;
    Set fso = CreateObject(&amp;quot;Scripting.FileSystemObject&amp;quot;)&lt;br /&gt;
    Set dir = fso.GetFolder(&amp;quot;C:\BATCH&amp;quot;)&lt;br /&gt;
     &lt;br /&gt;
    For Each file In dir.Files&lt;br /&gt;
        If LCase(Right(file.Name, 3)) = &amp;quot;pdf&amp;quot; Then&lt;br /&gt;
            Timer1.Enabled = False&lt;br /&gt;
            TxtLog.Enabled = False&lt;br /&gt;
            fstr = file.Name&lt;br /&gt;
            hpsname = Left(fstr, Len(fstr) - 3) &amp;amp; &amp;quot;hps&amp;quot;&lt;br /&gt;
            justname = Left(fstr, Len(fstr) - 3)&lt;br /&gt;
            LogMsg fstr&lt;br /&gt;
            Label1.Enabled = True&lt;br /&gt;
            Label3.Enabled = True&lt;br /&gt;
            cboCategory.Enabled = True&lt;br /&gt;
            cmdOK.Enabled = True&lt;br /&gt;
            cmdPreview.Enabled = True&lt;br /&gt;
            &amp;#039; Enable some controls and do something with the file&lt;br /&gt;
            txtScheduleNum.SetFocus&lt;br /&gt;
            Exit For&lt;br /&gt;
        End If&lt;br /&gt;
    Next&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 7) Consider using a solution created specifically to solve the problem ====&lt;br /&gt;
(Ad)&lt;br /&gt;
The following link goes to the Nebula R&amp;amp;D forum where an offering is discussed and a link is provided to a blog entry for more information. As of the time of this writing the software is fully usable but is not being offered as a product simply for lack of demand. That situation can change with a compelling business case. http://nebula-rnd.com/forum/index.php/topic,51.0.html&lt;br /&gt;
(/Ad)&lt;br /&gt;
&lt;br /&gt;
A general description of this approach, not specific to the Nebula solution, would be to write a PC program in your favourite language (.Net, Java, Flex for example), that runs on the PC and makes periodic calls to a Pick program using whatever technology makes sense for your Pick variety.  In the U2 world, this would be UniObjects, though a web services call that hides the connection details from the client, and be much more likely to work through firewalls, would make more sense.&lt;br /&gt;
&lt;br /&gt;
Note: this is not exactly the problem we are trying to solve on this page.  The problem is &amp;quot;how do I run a program on the client side, on demand from a Pick program?&amp;quot;  The polling solutions presented suffer from a lag between something happening on the server and a program running on the client.&lt;br /&gt;
&lt;br /&gt;
==== Running a program on the server from outside ====&lt;br /&gt;
Connectivity to MV is discussed many places in this wiki and any language can be used to execute BASIC business rules and return a result. A unique freeware program called [http://nebula-rnd.com/freeware/ MV Exec] uses [[Mv.NET|mv.NET]] to run any query, any command, any program on a MV server from any PC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;TODO&amp;lt;/strong&amp;gt;: Expand on this topic with info about D3 compile to executable with G option, UDT, notes about unique jBASE exe/dll design...&lt;br /&gt;
&lt;br /&gt;
== Discussion ==&lt;br /&gt;
[TG] There are three topics:&amp;lt;br&amp;gt;&lt;br /&gt;
1) Running a program on the client from the server&amp;lt;br&amp;gt;&lt;br /&gt;
2) Running a program on the server from a remote client&amp;lt;br&amp;gt;&lt;br /&gt;
3) Running a program on the server from the MV environment&amp;lt;br&amp;gt;&lt;br /&gt;
Anyone think it&amp;#039;s worthwhile to separate these into different pages?&lt;/div&gt;</summary>
		<author><name>TonyG</name></author>
	</entry>
</feed>