This page describes the recommended first steps for using ATCmd.au3 with a modem that accepts AT commands.
- AutoIt 3.3.14.5 or newer, matching the version noted in the UDF header.
ATCmd.au3available in your script include path or next to your script.ComUDF.au3available next toATCmd.au3or in a location that AutoIt can include.- A modem exposed as a serial COM port.
- A SIM card, if you want to test network registration or SMS functions.
- Connect the modem to the machine.
- Confirm that the operating system exposes the device as a COM port.
- Include
ATCmd.au3in your AutoIt script. - Use
_ATCmd_ListDevices()to inspect available modem-related ports. - Use
_ATCmd_Connect()with the COM port or device name. - Use
_ATCmd_CommandSyncOK('AT')as a basic communication test. - Use
_ATCmd_GetAllStatus()to inspect modem, SIM, PIN, network, and sender support status. - Use
_ATCmd_Disconnect()when finished.
#include "ATCmd.au3"
; Example flow only. Adjust COM port/device name and PIN handling for your environment.
Local $sDevice = "COM3"
Local $iResult = _ATCmd_Connect($sDevice)
If @error Then
ConsoleWrite("Connect failed: " & _ATCmd_GetLastErrorMessageCR() & @CRLF)
Exit
EndIf
Local $sResponse = _ATCmd_CommandSyncOK("AT")
ConsoleWrite($sResponse & @CRLF)
_ATCmd_Disconnect()- Do not send SMS commands before validating modem communication and SIM/PIN status.
- For SMS testing, start with a dedicated test SIM and a controlled recipient number.
- Some modems require vendor-specific drivers before a COM port appears.