Jump to content

Autoclick from TextFile

- - - - -

  • Please log in to reply
1 reply to this topic

#1
jgraham95

jgraham95

    Newbie

  • Members
  • Pip
  • 3 posts
Hi there. Looking for a bit of help.


Ive setup a grid of 3x3 buttons on a windows form with a tab index for each ranging from 1-9.

Ive then created a textfile with values on seperate lines.

ie

Quote

100000000
010000000
001000000
000100000
000010000
000001000
000000100
000000010
000000001

100000000 i want to refer to Tabindex 1, 010000000 tab index 2 and so on.

But i want the windows form to continuously look for changes in the textfile. Ie if say the textfile adds the line 100000000 it clicks the the button that refers to TabIndex 1.

Is this at all possible?

So far all ive managed to do is to read the textfile contents and put each line into a messagebox to verify its reading each line

Cheers in advance

#2
sam_coder

sam_coder

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 372 posts
You betcha!

Check this out: FileSystemWatcher Constructor (String) (System.IO)

you basically want to create the FileSystemWatcher class, with the path to what you want to watch. This would normally be a directory, so you could watch files.
Anyways, the object will raise events, like Created, Changed, etc. So if the contents of that monitored file changed, you will get this event raised, for which you could re-read the file, or do whatever you want from there.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users