Solved

set an event on file creation

Posted on 1999-01-11
10
189 Views
Last Modified: 2010-05-03
How do I set an event to start a procedure when a file appears in a directory? May I use wildcards on that filename?
0
Comment
Question by:marcelofr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 3

Expert Comment

by:jjbyers
ID: 1455315
You'll have to have a timer that fires a method that first looks for the file and then have this method fire the event.
0
 
LVL 3

Expert Comment

by:jjbyers
ID: 1455316
Sorry, Yes you can use wildcards witht the dir method.
0
 
LVL 3

Author Comment

by:marcelofr
ID: 1455317
I knew this... but there's no other way to do it?
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 3

Author Comment

by:marcelofr
ID: 1455318
I knew this... but there's no other way to do it?
0
 
LVL 3

Expert Comment

by:jjbyers
ID: 1455319
Not that I know of. Sorry
0
 
LVL 2

Expert Comment

by:spenner
ID: 1455320
Try looking at this code.  It watches a directory for any change.
http://www.mvps.org/vbnet/code/fileapi/watchedfolder.htm
0
 

Expert Comment

by:edunc
ID: 1455321
if you are waiting for a file to appear within like 10 seconds  or less then i would use this code:

do until dir(fname)
doEvents    'so the computer doesn't freeze up and go slow
loop
call whatever

fname could be like "blank.txt" or "*.exe" that has wildcards.

or if you're trying to just monitor if a file is there over a long period of time, i would make a timer w/ an interval of about 5 sec. or whatever you think.  put this code in it:

if dir(fname) then call whatever
0
 
LVL 3

Author Comment

by:marcelofr
ID: 1455322
I think there should be some event for a new file in an event driven language on an event driven OS, I DON'T like active loops: they're too expensive to the cpu. I'm look at spenner suggestion which is closer to my needs, I hope...
0
 
LVL 3

Author Comment

by:marcelofr
ID: 1455323
spenner: I like your suggestion. Post an answer ans I'll give you the points.
0
 
LVL 2

Accepted Solution

by:
spenner earned 50 total points
ID: 1455324
OK - If I find some better code I'll post it - but I've looked and the stuff I posted was the best I could find
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question