Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Waiting for file to be created before renaming

Status
Not open for further replies.

cturland

Programmer
Sep 25, 2000
66
GB
I'm using PostScript drivers to create a *.ps file. This takes a few seconds and after it is created I would like to rename it and copy it to another location.

The problem I have is that the code falls through too quickly and it tries to rename the file before it even exists.

Any ideas how I can check to see if the file is finished with before I copy it? I would rather not get into a continuous checking loop as this will slow the program down.

Thanks,
Carl
 
Use dir to check to see if it exists.

sPathName = "c:\MyStuff\*.ps"

Do While sFileName = ""
sFileName = Dir(sPathName)
DoEvents
Loop

Give this a try. It is quick and dirty and some would say bad form.
 
That's true that procedure would cause a big problem in memory when the process is too complicated. In that case, it just fine. But, asynchronous processing would solve this kind of problem, why don't you try explore on using the callbacks and event notifications.
 
VBin24HRS, why don't you give us an example of using a callback in this instance?

This sounds interesting. It could solve many similar problems and could serve as a FAQ.
VCA.gif

Alt255@Vorpalcom.Intranets.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top