Calling Windows Notepad function from a JBASIC program

93 views
Skip to first unread message

Kevin Doiron

unread,
May 30, 2005, 10:56:39 AM5/30/05
to jB...@googlegroups.com
Hello,

I'm running JBASE on a Windows platform. I'm looking for an easy way to
call a text display program, such as notepad, from a JBASE program. The
idea is that I want to pop up a separate screen to show data for a customer,
while still allowing our users to view the main application screens. Any
thoughts?

Thanks,

Kevin
AllianceOne Ltd.

This communication may contain privileged and/or confidential information
and the sender does not waive any related rights and obligations. It is
intended solely for the use of the addressee. If you are not the intended
recipient, you are strictly prohibited from disclosing, copying,
distributing or using any of this information. If you have received this
communication in error, please contact the sender immediately and destroy
the material in its entirety. Visit us at http://www.tch.ca

____________________________________________________________________________
___

Cette communication peut contenir des renseignements privilegies et/ou
confidentiels. L'expediteur ne renonce a aucun des droits ou obligations
relies. L'intention est de communiquer uniquement avec les destinataires. Si
vous n'etes pas le destinataire vise, il est strictement interdit de
divulguer, copier, distribuer ou utiliser toute partie de cette
communication. Si vous avez recu cette communication par erreur, veuillez
contacter immediatement l'expediteur et detruire entierement le materiel.

Simon Verona

unread,
May 30, 2005, 11:11:43 AM5/30/05
to jB...@googlegroups.com
I guess you are running in a terminal emulator...

If so, the easiest way is to see if the emulator itself has some command
sequence that allows running of local windows commands. Products such as
Termite and Viaduct etc have this functionality.

You *can't* do something like this in your databasic code:

EXECUTE CHAR(255):'snotepad xxx.dat'

This will run notepad, but without a user interface, and on the server.
So largely useless!

I've considered a few solutions to this in the past - one of which was
to run a vb program that constantly polls a directory on the server
(before I get flamed you can't use the filewatcher functions in vb.net
for remote directories...) and put some sort of command queue that is
written from within your software - this is inefficient but works...

Another alternative is a sockets based approach, with a similar program
running on the server, which does use filewatcher to monitor a series of
files which are the command queue, and have a small socket based server
that runs on each PC to run the command. Again, pretty straightforward
to write in vb.net (which is my chosen development language).

I think it is possible in a Windows domain to run a program remotely,
but I'm not sure how this works - we don't rely on our customers having
domains set up properly so I've never investigated this.

There are lots of similar approaches, including message queuing.. All
of which will work. The trick is to get the command from the server
back to the client PC.

Food for thought I hope..

Regards

Simon Verona
Dealer Management Services Ltd
The Old Cross
Woodfall Lane
Low Bradfield
S6 6LB

Tel: 0870 080 2300
Fax: 0870 169 6747
Email: si...@dmservices.co.uk

Greg Cooper

unread,
May 30, 2005, 11:20:53 AM5/30/05
to jB...@googlegroups.com
There are many ways to skin this cat, here is a quick and dirty method using a simple jBC (jBASE BASIC program) , completely untried and untested but should work ! The use of jstart puts the notepad program in the background and so the jBC program will continue to execute following the PERFORM statement and will not block waiting for notepad to exit. Of course if you want your program to wait until notepad exits, remove the jstart
 
OPEN "C:\tmp\jbase1.txt" TO FILEVAR ELSE PRINT "OPEN error" ; STOP
record = "Line 1 of data" : @AM : "Line 2 of data"
WRITE record TO FILEVAR,"jbase1.txt"
PERFORM "jstart notepad C:\tmp\jbase1.txt"

Regards

Greg Cooper

Mark Hogden

unread,
May 30, 2005, 11:23:00 AM5/30/05
to jB...@googlegroups.com
If the users are running from jshell you can execute any windows command
with
EXECUTE CHAR(255):"k":WindowsCommand

Similarly in PROC
H WindowsCommand
PU

If access is via telnet then you need a telnet client that supports
executing host programs. I think almost all commercial clients have this
feature; Netterm and Accuterm are two that immediately pop to mind.

Mark Hogden
Proco, Inc



-----Original Message-----
From: jB...@googlegroups.com [mailto:jB...@googlegroups.com] On Behalf Of
Kevin Doiron
Sent: Monday, May 30, 2005 7:57 AM
To: 'jB...@googlegroups.com'
Subject: Calling Windows Notepad function from a JBASIC program


Charles Burke

unread,
May 31, 2005, 8:15:07 AM5/31/05
to jB...@googlegroups.com
We use a DISPLAY command to execute PC_based programs from our server-based
jBase programs. For example, we do a lot of work with .CSV values which are
imported into Excel. We download the file to the root director of the H:
drive, and call Excell with the following command:

DISPLAY CHAR(27):CHAR(2):'<':'"C:\Program Files\Microsoft
Office\Office\excel.exe" H:\':DETAIL.XFER.SHORT.FILENAME

Now, the Escape code sequence may be specific to AccuTerm, our terminal
emulator. Your mileage may vary.

Chuck Burke x8252
Programmer/Analyst
Rapid Response Monitoring Systems



-----Original Message-----
From: jB...@googlegroups.com [mailto:jB...@googlegroups.com]On Behalf Of
Kevin Doiron
Sent: Monday, May 30, 2005 10:57 AM
To: 'jB...@googlegroups.com'
Subject: Calling Windows Notepad function from a JBASIC program



Jim Idle

unread,
May 31, 2005, 11:47:43 AM5/31/05
to jB...@googlegroups.com


> -----Original Message-----
> From: jB...@googlegroups.com [mailto:jB...@googlegroups.com] On Behalf
Of
> I've considered a few solutions to this in the past - one of which was
> to run a vb program that constantly polls a directory on the server
> (before I get flamed you can't use the filewatcher functions in vb.net
> for remote directories...)

If you wished to use the above approach, and it isn't bad if you use the
file watcher functions, then installing a system tray background task
would do the trick. You can write this in vb.net and if you are able to
just use .Net then just use MSMQ which takes about 10 minutes to set up.
Of course, if you have to support versions of windows that don't have
that system tray then this would not work so well and you would need a
service that was allowed access to the desktop and so on.

Assuming a terminal emulator, then I think that they all have escape
codes for starting a program remotely and this is your easiest choice,
though making the display go away might be more difficult. However, you
could consider writing your own GUI client, that in most respects was
just a terminal emulator I suppose.

A slightly different approach is to do this within the terminal screen
itself with a character based GUI.

Jim

Reply all
Reply to author
Forward
0 new messages