Deleting the dot (.
) that precedes the comopen and comclose commands turns off the "silent" mode, letting you know whether the object was successfully opened or closed.
I don't know what's the version of your OS, but assuming it works the same for all of them, lets try what I did on Win98. Open your mIRC folder, locate the batch file and double-click on it (the file doesn't have to contain meaningful commands yet, just add some echo's). What happens when it finishes running? Is the DOS window automatically closed?
If it stays open, that's why your $com() never returned. You must get it to close itself once the process is finished. To accomplish that, do either:
- Go to the file properties, select the 'Program' tab and check the 'Close on exit' option (note: that will create a .pif file on the same folder)
- Add a single CLS command at the end of the file without a CRLF after it (since /write always ends the line with a CRLF you'll have to type it manually or use binary writing, /bwrite file.bat -1 CLS).
For details, read this tutorial
under the section "Closing a DVM window automatically".