1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

xxxMONITOR command questions

Discussion in 'Support' started by Steve Fabian, Jan 25, 2010.

  1. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    TCC 11.00.38 Windows XP [Version 5.1.2600]

    I want to run a background instance of TCC which pops up a MSGBOX when one
    of the monitored events occurs (e.g., USB device turned ON or OFF), possibly
    followed by additional, event based operations. I have not succeeded in
    doing so. Sample code to do this would be much appreciated!
    --
    Steve
     
  2. Joe Caverly

    Joined:
    Aug 28, 2009
    Messages:
    698
    Likes Received:
    8
    Hi,
    Not sure if this is what you are looking for, but to monitor a connection of a USB device on my system, I use the following command;

    Code:
    USBMONITOR "USB Mass Storage Device" CONNECTED FOREVER NOTEPAD
    
    Now, whenever I connect this USB Device, Notepad is launched.

    When I type USBMONITOR by itself, I get the following;

    Code:
    "USB Mass Storage Device"   CONNECTED   (1/FOREVER)   NOTEPAD
    
    Note the 1/FOREVER. This indicates that the named device has been connected one time so far.

    To monitor a disconnection of a USB device on my system, I use the following command;

    Code:
    USBMONITOR "USB Mass Storage Device" DISCONNECTED FOREVER SOL
    
    Now, whenever I disconnect this USB Device, Solitaire is launched.

    When I type USBMONITOR by itself, I get the following;

    Code:
    "USB Mass Storage Device"   CONNECTED   (1/FOREVER)   NOTEPAD
    "USB Mass Storage Device"   DISCONNECTED   (1/FOREVER)   SOL
    
    When I type;

    Code:
    USBMONITOR /C
    
    The monitor is removed for all devices.

    Having NOTEPAD and SOL start when connecting and dis-connecting a USB device demonstrates how applications can be started and stopped using USBMONITOR.

    Most times, all that I want is a simple message, so I use the following;

    Code:
    usbmonitor "USB Mass Storage Device" CONNECTED FOREVER msgbox OK "Notice" USB Device has been connected
    
    usbmonitor "USB Mass Storage Device" DISCONNECTED FOREVER msgbox OK "Notice" USB Device has been dis-connected
    
    Typing USBMONITOR now gives me the following;

    Code:
    "USB Mass Storage Device"   CONNECTED   (2/FOREVER)   msgbox OK "Notice" USB Device has been connected
    "USB Mass Storage Device"   DISCONNECTED   (2/FOREVER)   msgbox OK "Notice" USB Device has been dis-connected
    
    Joe
     

Share This Page