• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 761
  • Last Modified:


Hi Experts

I work with GSM modems everyday that need to be configured via a hyperterminal session with 5 or 6 AT commands before they can be used properly.

I have been trying to find a solution for automating this task - or at least simplifying it.

I began by trying to copy and paste the "script" into a hyperterminal session, but for some strange reason it keeps changing the commands which results in errors. I tried importing a txt file with the same result... changes in the commands.

So what I am looking for is either a solution whereby I can "paste" or "import" this script into hyperterminal or preferably try and emulate the hyperterminal session is access.

I have been told that one can use the MSCOMM tool to this end, but would not know where to start.

In a perfect senario here is how I would like the system to work:
- - - - - - - - - - - - -
1. A form in the database opens with options to type in 5 or 6 commands.
2. Once these commands have been entered a button called "Write Script" should be clickable.
3. When the button is clicked a window should pop up asking for the COM port settings (port number, rate, etc)
4. Once these have been selected another button called "Update" should be clickable.
5. When this button is clicked a "hyperterminal" session needs to be created and the 5 or 6 commands sent to the modem.
6. Ideally, I would like these commands to be visible to the user so that if a problem occurs the user will see the error message and can rectify the problem. (Each commands either gives feedback ending in OK or ERROR)
7. Once completed successfully a dialog box should pop up saying "settings updated"
8. If an error occurs a dialog box stating the error should be displayed.

If the above senario won't work I have managed to get the following working:

1. I have hard-coded the scripting into a module in my database.
2. When the user clicks a macro which initialises this module, it copies the text of the script to the clipboard and the user can paste this script into a hyperterminal window.
3. At the moment all of the commands paste on one line perfectly. What I need is a way to emulate the ENTER key in between commands so that the hyperterminal session can process each command separately.
4. I have tried the Chr(10) option but this doesnt work in Hyperterminal.

Here is the code for the scripting I have that pastes to the clipboard. Unfortunately, due to the proprietory AT commands, I cannot paste the actual coding (but this shouldnt effect the outcome at the end):

Dim ManPass As String
Dim ChangePass As String
Dim Operator As String
Dim ManNumbers As String
Dim Purse As String
Dim LowPurse As String
Dim LockSim As String
Dim Save As String

Dim Script As String

ManPass =
ChangePass =
Operator =
ManNumbers =
Purse =
LowPurse =
LockSim =
Save = "AT" & Chr(38) & "W"

Script = ManPass & Chr(10) & ChangePass & Chr(10) & Operator & Chr(10) & ManNumbers & Chr(10) & Purse & Chr(10) & LowPurse & Chr(10) & LockSim & Chr(10) & Save & Chr(10)

ClipBoard_SetData ([Script]) ' This calls a module which copies the [Script] info to the clipboard.


At the moment the Chr(10) works perfectly when pasting into notepad or any other window but when doing it in Hyperterminal it results in strange characters popping out and not the ENTER key being emulated.

I would prefer the actual emulation of the entire process through access, but if anyone can offer a solution to the 2nd option it will suffice in the short-term.

Thx Experts..

1 Solution
Chr(10) is the linefeed character.  Try the carriage return character Chr(13).  In fact Hyperterminal may require them both, Chr(13) & Chr(10)
Hi Stan, GRayL,

you can use vbcrlf in place of
Chr(13) & Chr(10)

StanKobrinAuthor Commented:
Hey jaffer, GRayL:

Both of your options work perfectly.

Except for 1 major problem: The same thing is happening as when I was importing the txt file.
The first two lines of commands work perfectly - then it starts to paste garbage to the screen (mixtures of all the remaining commands)

Is there a known reason for this and if so,. is there a solution?

Or... is there a way I can screate my own hyperterminal session through access by opening a connection to the COM port using MSCOMM trick?

Thx Stan
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Sorry Stan, I'm all out of suggestions.  I haven't used hyperterminal in over three years.  
Sorry Stan, same here, I only commented on what GRayL posted.
Stan:  I opened hyperterminal and checked help.  When you dig into it, you can find a couple of lines about opening hyperterminal from the command line.  Open hyperterminal, click Help, How To, Set up a new connection, Using a command line. You have to know the path to where the app is.  You can open an app from the immediate pane of Access using the shell command:

shell "c:\mypath\hyperterminal.exe/t<enter your command line parameters here>"
Steve BinkCommented:
Do not accept this as an answer.

I am positive you can use MSCOMM to set up the modem like you want, but since I've never used that object, I cannot provide any details.  The last time I worked with modems in that way was pre-Win95, and it was on the basic hardware level communicating with the port's chip.  If you're interested in pursuing this option, let me know and I'll be happy to explore it with you.

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now