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

Who is Participating?
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.

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

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

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.
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
Microsoft Access

From novice to tech pro — start learning today.

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.