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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
Discover the Answer to Productive IT

Discover app within WatchGuard's Wi-Fi Cloud helps you optimize W-Fi user experience with the most complete set of visibility, troubleshooting, and network health features. Quickly pinpointing network problems will lead to more happy users and most importantly, productive IT.

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
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jmcmillan227Author Commented:
Nice work muff
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.