Select to view content in your preferred language

VB to Python

451
2
04-25-2012 12:56 AM
FelixMuyoba
Emerging Contributor
How can I convert that VB script to a python script or should I re-write the whole script again? We recently migrated from arcgis version 9.3 to 10 and seems as if VB is not supported in 10.

Static rec As Double
Dim pStart As Double
Dim pInterval As Double
pStart = 1
pInterval = 1
If (rec = 0) Then
rec = pStart
Else
rec = rec + pInterval
End If
Tags (2)
0 Kudos
2 Replies
MarcinGasior
Frequent Contributor
VBScript is supported in ArcGIS10.
However "Python is the recommended scripting language for ArcGIS".
VB scripting received some limitations, eg. "VBScript does not allow you to explicitly declare any data types". I've also noticed that declaring Static variable causes error.

For more information look at Calculate Field examples.
There's Python alternative to your code (search for autoIncrement() function).
0 Kudos
markdenil
Frequent Contributor
VBA is supported in 10, but you have to request a special (free) licence extension.
0 Kudos