Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 29th, 2009, 06:55 PM
teeheiman's Avatar
teeheiman teeheiman is offline
Let the Wookie Win
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2005
Location: United States, Califonia
Posts: 192 teeheiman User rank is Sergeant (500 - 2000 Reputation Level)teeheiman User rank is Sergeant (500 - 2000 Reputation Level)teeheiman User rank is Sergeant (500 - 2000 Reputation Level)teeheiman User rank is Sergeant (500 - 2000 Reputation Level)teeheiman User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 20 h 23 m 22 sec
Reputation Power: 17
Do While FileExists = False

Ive wrote some vbscript to download a file from ftp through the command shell, but the problem is the rest of my code is executing before the file is downloaded.

What im trying to do is make the script wait for the file to be downloaded before the rest of the script is executed, Heres what ive tried but it doesnt seem to work.

Code:
set fs=CreateObject("Scripting.FileSystemObject")

'Wait while File Downloads 3 Minutes At MOST
numSeconds = 80 
counter = 0 
starttime = now() 

Do While fs.FileExists("C:\file.txt") = false
	'Exit if Download takes longer than 3 Minutes
	if DateDiff("s", starttime, endtime) = numSeconds then exit do
Loop



So the idea is that the loop keeps looping and waiting until the file is found before moving on.

Any help is appreciated.

Thanks
__________________
That's 'cause droids don't pull people's arms out of their sockets when they lose. Wookies are known to do that.

Reply With Quote
  #2  
Old October 30th, 2009, 03:18 PM
June7 June7 is offline
Contributing User
Click here for more information.
 
Join Date: Apr 2009
Location: The Great Land
Posts: 536 June7 User rank is First Lieutenant (10000 - 20000 Reputation Level)June7 User rank is First Lieutenant (10000 - 20000 Reputation Level)June7 User rank is First Lieutenant (10000 - 20000 Reputation Level)June7 User rank is First Lieutenant (10000 - 20000 Reputation Level)June7 User rank is First Lieutenant (10000 - 20000 Reputation Level)June7 User rank is First Lieutenant (10000 - 20000 Reputation Level)June7 User rank is First Lieutenant (10000 - 20000 Reputation Level)June7 User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 13 h 58 m 7 sec
Reputation Power: 124
One idea would be to put the code that retrieves the ftp file behind a form that you call to open in Dialog mode. Pass the search criteria to the form and have the retrieve code execute in the form open event. The code that follows the open form command will not execute until the form closes. Then the trick is how to detect that the download is complete and close the form. Here are links to code for ftp upload/download (Google 'vb download ftp')
http://www.vb-helper.com/howto_ftp.html
http://vbnet.mvps.org/index.html?co...ftpdownload.htm
Maybe just putting the retrieve code in a subroutine will suffice and the form would not be needed. I have not analyzed the code on these links so can't really say.

Last edited by June7 : October 30th, 2009 at 03:58 PM.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Do While FileExists = False


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek