Can I be Helped???
This is part of my FTP script that connects to multiple Computers (as
determined by a machine.txt file) and retrieves a file from each
computer with all having the same name. The script then renames that
file to the computer name, date and time.
My problem is when one of the computers is not available, the script
hangs while attempting to get that file then errors out because it is
trying to rename a file that does not exist.
I know that you can use "on error resume next" with regard to renaming
a file that does not exist,
but I would still like to make it continue after only a few seconds.

My questions;
Can you tell it to "On error resume next" say after only 3 or 4
seconds.
or can I tell it "On error to Cleanup files" and goto Next to
continue
loop.


Thanks so much,
Cisco


'__________________________________________________
' now run the FTP batch file created above
' create a shell and run the batch file
'_________________________________________________


Set oShell = WScript.CreateObject ("WSCript.shell")
oShell.run strFTPBat,0,TRUE
Set oShell = Nothing


'_____________________________________
'Cleanup files
'_______________________________________
fso.DeleteFile strFTPBat,1
fso.DeleteFile strResponseFile,1


'______________________________________________
'Rename the Files
'_____________________________________________
set fso = createobject("scripting.filesystemobject")
set file = fso.getfile("machine.ini")
mybase = fso.getbasename(file.name)
myext = fso.getextensionname(file.name)
mysuffix = replace(formatdatetime(now(),vbShortdate),"/","-")
mytime = replace(formatdatetime(now(),vbLongTime),":","-")
file.name = mybase & strFtpHost & "-" & mysuffix & "-" & mytime & "."
& myext
'file.name = mybase & strFtpHost & "-" & mysuffix & "." & myext
'msgbox file.name


'______________________________________________
'Continue Loop
'_______________________________________________
Next
'____________End Of Script__________

Re: force a script to resume before it is ready by Marcus

Marcus
Sat Mar 31 20:04:31 CDT 2007

I think you need a ping:

'-------------------------------------------------------------------------
strComputer = "192.168.2.199" 'IP of the client

Set objWMIService = GetObject("winmgmts:\\" & "." & "\root\cimv2")
Set colPings = objWMIService.ExecQuery ("Select * From Win32_PingStatus
where Address = '" & strComputer & "' AND Timeout=100")
For Each objStatus in colPings
If IsNull(objStatus.StatusCode) or objStatus.StatusCode <> 0 Then
strState = "Offline"
Else
strState = "Online"
End If
Next
'-------------------------------------------------------------------------



imaciscoguy schrieb:
> Can I be Helped???
> This is part of my FTP script that connects to multiple Computers (as
> determined by a machine.txt file) and retrieves a file from each
> computer with all having the same name. The script then renames that
> file to the computer name, date and time.
> My problem is when one of the computers is not available, the script
> hangs while attempting to get that file then errors out because it is
> trying to rename a file that does not exist.
> I know that you can use "on error resume next" with regard to renaming
> a file that does not exist,
> but I would still like to make it continue after only a few seconds.
>
> My questions;
> Can you tell it to "On error resume next" say after only 3 or 4
> seconds.
> or can I tell it "On error to Cleanup files" and goto Next to
> continue
> loop.
>
>
> Thanks so much,
> Cisco
>
>
> '__________________________________________________
> ' now run the FTP batch file created above
> ' create a shell and run the batch file
> '_________________________________________________
>
>
> Set oShell = WScript.CreateObject ("WSCript.shell")
> oShell.run strFTPBat,0,TRUE
> Set oShell = Nothing
>
>
> '_____________________________________
> 'Cleanup files
> '_______________________________________
> fso.DeleteFile strFTPBat,1
> fso.DeleteFile strResponseFile,1
>
>
> '______________________________________________
> 'Rename the Files
> '_____________________________________________
> set fso = createobject("scripting.filesystemobject")
> set file = fso.getfile("machine.ini")
> mybase = fso.getbasename(file.name)
> myext = fso.getextensionname(file.name)
> mysuffix = replace(formatdatetime(now(),vbShortdate),"/","-")
> mytime = replace(formatdatetime(now(),vbLongTime),":","-")
> file.name = mybase & strFtpHost & "-" & mysuffix & "-" & mytime & "."
> & myext
> 'file.name = mybase & strFtpHost & "-" & mysuffix & "." & myext
> 'msgbox file.name
>
>
> '______________________________________________
> 'Continue Loop
> '_______________________________________________
> Next
> '____________End Of Script__________
>