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