- Aug
- 2,059
- 83
Here's an example of how to use the Windows WAITFOR.EXE command with FOLDERMONITOR to wait for a file to change in TCC, do some processing, and continue monitoring for more changes in a file.
Once the above program is running, start up another TCC session, make a change in the file, switch back to the running .btm, and you should see the changes on the display.
Note that with this .btm running in TCC, when I make a change to the monitored file from a 16-bit program, a 32-bit program, or a 64-bit program, the file change is flagged in 64-bit TCC.
I used the techniques in the .BTM to allow me to make changes in a file from 4DOS running under vDosPlus.
Posting this mainly for my future reference, but thought others might also be interested.
Joe
Code:
@setlocal
@echo off
::
:: To end this .btm, press either Ctrl-C or Ctrl-Break
::
on break goto Done
::
:: Remove monitor for e:\utils
::
foldermonitor /c e:\utils
::
:: Monitor the e:\utils\server.ini file for changes
:: When triggered, send the signal GetClipDone
::
foldermonitor e:\utils /i"server.ini" modified forever (
waitfor.exe /SI GetClipDone > nul
)
do forever
::
:: Wait for the signal GetClipDone
::
waitfor.exe GetClipDone > nul
::
:: Remove monitor for e:\utils
::
foldermonitor /c e:\utils
::
:: Do some processing...
::
echo Time from server.ini: %@iniread[.\server.ini,Main,theTime]
::
:: Monitor the e:\utils\server.ini file for changes
:: When triggered, send the signal GetClipDone
::
foldermonitor e:\utils /i"server.ini" modified forever (
waitfor.exe /SI GetClipDone > nul
)
enddo
endlocal
:Done
foldermonitor /c e:\utils
quit
Once the above program is running, start up another TCC session, make a change in the file, switch back to the running .btm, and you should see the changes on the display.
Note that with this .btm running in TCC, when I make a change to the monitored file from a 16-bit program, a 32-bit program, or a 64-bit program, the file change is flagged in 64-bit TCC.
I used the techniques in the .BTM to allow me to make changes in a file from 4DOS running under vDosPlus.
Posting this mainly for my future reference, but thought others might also be interested.
Joe