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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

continue error 1

Status
Not open for further replies.

squirrelman

Programmer
Jul 28, 2017
8
US
All,
I am getting an error that I cannot figure out. I have a bit of code that loops through a folder and if it finds a file without a particular extension it goes onto the next file. Otherwise it does some processing of the file.

There are two such folders upon which this functionality is exercised. I am including the top part of each. The first succeeds without issue, but the second fails. I have added the failure message after the code. Both are laid out exactly the same way.

The good code:
.
.
.
filex = "txt"
ifcfolder = "D:\IFC\" & trim(Plant) & "\Outbound\Archive"

Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
If FSO.FolderExists(ifcfolder) Then
Set iFolder = FSO.GetFolder(ifcfolder)
Else
Msgbox("Folder " & ifcfolder & " does not exist")
WScript.Quit
End If
Set fs = CreateObject("Scripting.FileSystemObject")

Set a = fs.CreateTextFile("D:\IFC\" & trim(Plant) & "-Deliv.txt", True)

For Each f1 In fso.GetFolder(ifcfolder).Files
If InStr(f1.name, filex) = 0 Then
Continue
End If[
.
.
.

Bad code:
.
.
.
filex = "xml"
ifcfolder = "D:\IFC\" & trim(Plant) & "\Inbound\Archive"

Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
If FSO.FolderExists(ifcfolder) Then
Set iFolder = FSO.GetFolder(ifcfolder)
Else
Msgbox("Folder " & ifcfolder & " does not exist")
WScript.Quit
End If
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("D:\IFC\" & trim(Plant) & "Inv.txt", True)

For Each f2 In fso.GetFolder(ifcfolder).Files

If InStr(f2.name, filex) = 0 Then
Continue
End If
.
.
.

Error from bad code:
---------------------------
Windows Script Host
---------------------------
Script: D:\IFC\Load-Xref.vbs
Line: 79
Char: 4
Error: Type mismatch: 'Continue'
Code: 800A000D
Source: Microsoft VBScript runtime error

---------------------------
OK
---------------------------


Your help is greatly appreciated!

Regards,
David a.k.a. SquirrelMan
 
Thanks guitarzan.
I guess I am going to need to get on board with Windows Powershell. I am still on Windows 7. Is Windows Powershell available for Windows 7? I have a Windows 2012 server, so I am good there, but I have a company laptop and the corporate image for 10 has not been released, yet.

Regards,
SquirrelMan
 
Yes, Windows 7 has Powershell. But not quite sure why you need to move on to that just because VBScript does not have the Continue statement ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top