WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Systray Icon Questions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Watch for File from Systray

 Keywords: Monitor Watch File Exist Systray System Tray IntControl 1007 News

This code watches for a text file to exist. When its found the contents of the file are displayed in a message. The file is deleted and the script continues to monitor for that file. Simply right click on the systray icon to exit the script.
filename =  'D:\Temp\news.txt'
IntControl(1007, 1, 1, '', '') ; Load scipt into systray
While @TRUE  ; Loop forever
   found = FileExist( filename )
   If found ; File is found
      data = FileGet( filename ) ; Read contents of file
      Message( 'Contents of file', data ) ; Display contents of file
      FileDelete( filename ) ; Delete file
   EndIf
   TimeDelay(1)
   clickstate = IntControl (1007, 0, 0, 0, 0) ;Check if user right clicks on icon if so then exit
   If clickstate == 2
      IntControl (1007, 2, 0, 0, 0) ; Remove currently-running script from the system tray
      Break
   EndIf

EndWhile
Exit

Article ID:   W18298
Filename:   Watch for File from Systray.txt
File Created: 2009:12:03:10:33:08
Last Updated: 2009:12:03:10:33:08