Select to view content in your preferred language

Size limitation to a vbs ArcScript?

1009
2
Jump to solution
07-12-2012 08:05 PM
DanikBourdeau
Deactivated User
Just wondering if anybody has come across any issues using very large vbs scripts?  Mine is just about to top 1000 lines and it got me wondering if I should be concerned.

I may be wrong but as far as I can figure out you can only have 1 script per applet, is this correct?

Thanks
Tags (3)
0 Kudos
1 Solution

Accepted Solutions
RolfBroch
Frequent Contributor
I have not found a size limitation to the vbscript files. The largest I have used are over 10 000 lines of code.
I have also found that in the pc environment, the following link is useful:
http://forums.esri.com/Thread.asp?c=34&f=1180&t=87072
This is quite handy if you have developed a library of routines that you would like to use in several projects (for ex. routines for reading and writing xml files)

The short version is this:

' "Include" routine for Windows VBScript
Sub Include(sIncludeFileName)
  On Error Resume Next
  Dim pFSO, fInclude, sScript
  Set pFSO = CreateObject("Scripting.FileSystemObject")
  If pFSO.FileExists(sIncludeFileName) Then
    Set fInclude = pFSO.OpenTextFile(sIncludeFileName)
    sScript = fInclude.ReadAll
    fInclude.Close
    ExecuteGlobal sScript
  End If
  Set pFSO = Nothing
  Set fInclude = Nothing
End Sub

View solution in original post

0 Kudos
2 Replies
RolfBroch
Frequent Contributor
I have not found a size limitation to the vbscript files. The largest I have used are over 10 000 lines of code.
I have also found that in the pc environment, the following link is useful:
http://forums.esri.com/Thread.asp?c=34&f=1180&t=87072
This is quite handy if you have developed a library of routines that you would like to use in several projects (for ex. routines for reading and writing xml files)

The short version is this:

' "Include" routine for Windows VBScript
Sub Include(sIncludeFileName)
  On Error Resume Next
  Dim pFSO, fInclude, sScript
  Set pFSO = CreateObject("Scripting.FileSystemObject")
  If pFSO.FileExists(sIncludeFileName) Then
    Set fInclude = pFSO.OpenTextFile(sIncludeFileName)
    sScript = fInclude.ReadAll
    fInclude.Close
    ExecuteGlobal sScript
  End If
  Set pFSO = Nothing
  Set fInclude = Nothing
End Sub
0 Kudos
DanikBourdeau
Deactivated User
Hey Rolf,

10 000 lines of code! I should be good for a while 😉

That's an awesome snippet of code, thanks!  I've put it in my little vault.
0 Kudos