How do I launch a windows command from a linux application accessed through a terminal emulator

We have clients that access a Linux application from a Windows workstation using a terminal emulator.  
We need a solution that will allow the linux application to launch a command (in this case we need to pass winword.exe /m macroname) that is executed on windows.

The simpler the solution the better but I am open to anything that works.  We can use any terminal emulator.
LVL 3
jmcmillan227Asked:
Who is Participating?
 
muffCommented:
Poderosa (http://poderosa.org) may be what you are after.  It has a macros plugin that supports .net scripts.

I haven't tried this out,but it may do what you need.
0
 
muffCommented:
Is there a human interacting with the linux box while this is going on?

If not (actually, even if you do), you could use something like an expect script to do it.

Expect scripts watch terminal input for a pattern and then carry out some action based on what it sees.

Normally this is used to script things in a remote terminal like:

  " If I see the word 'password:' enter the word 'secretpassword' "

So you would have:

  "If I see the word winword macroname, launch the local app winword.exe with the parameter /m macroname"
0
 
jmcmillan227Author Commented:
This could work.  Any recommendations for the best terminal emulator to write an appropriate expect script?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
muffCommented:
Perhaps a bit more detail on how the process works - ie what happens that would cause the word macro to be triggered?

You could conceivably cut the terminal emulator out of the picture all together and just run a script using python and pexpect (http://www.noah.org/wiki/Pexpect), provided no human interaction was required.

0
 
jmcmillan227Author Commented:
They work in our cobol application on linux through a terminal emulator.  They go to a file and have with a few keystrokes initial an automatic document merge.  What happens after the select "Yes - to Merge" is a word processing FRM filer with text and variables is processed and an MRG file containing a csv layout with the requested variables populated from the file they were working on.  After the.mrg file is produced theirword processing program is launched calling a macro that does an automatic mail merge of the frm and mrg files.  The macros are already created.  the problem is that on Linux the only real word processing program available is word perfect 5.1 which is essentially like word processing in a non GUI environment.

When users run the application on Windows it is no problem it just calls winword /m <macroname>

What we are trying to do is allow users working on linux through a terminal emulator the ability to use their windows word processing software to create the frms, and merge the frm and mrg using a predefined macro.  When the user initiates a merge, the mrg file is created and a command of winword /m <macroname> or wpwin10 /m macroname.wcm is issued.  

I was thinking that we could modify the command that is issued from winword etc to just pass a sequence of characters (%%% for example) that  could launch a windows routine.

I like the terminal emulator route I'm just wondering if there are any recommendations for good a good one that could do something like this. Thanks for your help.  You have earned the points and when this question is closed I will accept your solution.
0
 
muffCommented:
I think SecureCRT will give you what you need

It supports scripts for taking action on events in the terminal, but these are vbscripts, so you could have a script something like:

#$language = "VBScript"
#$interface = "1.0"

' This automatically generated script may need to be
' edited in order to work correctly.

Sub Main
      crt.Screen.WaitForString "%%% "
      screenrow = crt.screen.CurrentRow - 1
      Dim result
      result = crt.Screen.Get(screenrow, 4, screenrow, 40 )

      set WshShell = CreateObject ("WScript.Shell")
      WshShell.Run """F:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE"" /m " result
End Sub

So this is expecting to see "%%% " in the terminal, and when it does, it launches WINWORD from the F drive with the  /m parameter followed by the next 36 characters after "%%% "

So your app would emit "%%% macroname"

The above is PoC and not tested (other than the launching part) but it should work.

Another alternative is installing X Windows on the linux box, along with Openoffice, then installing XMing on the PC.

Then they could run Openoffice on the linux machine, but have the Openoffice output pushed back to Xming on their PC.  This is done with

  export DISPLAY=<users ip address>:0

Once this command is entered, any X applications that are run will have the gui output sent to the X server at <users ip address> - Xming is an X server for windows.


0
 
jmcmillan227Author Commented:
very good stuff, thankyou.  I will go ahead and award the points but do you know of any open source terminal emulators that would handle scripting like this?  This will be for a large user base and secureCRT is $99 per seat it seems.
0
 
jmcmillan227Author Commented:
Nice work muff
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.