MODEMDETECT        Locate first available modem and/or COM port

Top  Previous  Next

Syntax:

MODEMDETECT

 

Arguments:

None

 

Options:

/firstportok

Report success even if modem is not found; effectively finds first COM port in system if no modem is present

 

 

This script command scans the system for the first available COM port and/or attached modem. The result is saved in a script variable named %newport in the form “COMx” where x is a numeric value between 1 and 48.

 

When MODEMDETECT is specified without an option, it attempts to find the first responsive modem attached to one of the COM ports in your PC. If found, the port identifier (e.g., COM2) is stored in the %newport variable. If no modem is found, the command returns an error and %newport is set to a null string.

 

If the /firstportok option is included, the command returns still returns the first COM port where a modem is found. However, it behaves differently if no modem is found by returning the first COM port found in the system regardless whether a modem is attached or not. If no modem nor COM port is found, the command returns an error and %newport is set to a null string.

 

The following example shows how to set FileLink to use a COM port where a modem has been detected.

 

MODEMDETECT

IFERROR $ERROR_NO_MODEMS_DETECTED goto no modems

USEPORT %newport

 

Related Command(s):         MODEMRESET, MODEMCMD, MODEMRESP