How to rewrite javascript script to work in ArcGis 10.x?

665
0
11-09-2016 11:07 PM
NinaMejac
New Contributor

Hi! I just started working and my job right now is to rewrite parts of javascript scripts that work in older version of ArcGis to work in version 10.x. I came across two problems, which I tried to google but didn't find anything helpful:
1)
var GP = WScript.CreateObject("esriGeoprocessing.GPDispatch.1");
GP.SetProduct("ArcView");
GP.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx");                   GP.AddField_management("shapeFile.shp", "len", "DOUBLE");
GP.CalculateField_management("shapeFile.shp", "len", "[Shape.length]");

CalculateField seems to work only if I rewrite a value of one field, but not if I want to calculate it. In this case I would like to get length of a polyline.
I tried different sytax: "!Shape.length!", and with fourth argument "PYTHON_9.3" but it still didn't work.

2)
var GP = WScript.CreateObject("esriGeoprocessing.GPDispatch.1");
GP.SetProduct("ArcView");
GP.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Conversion Tools.tbx");   GP.TableToTable_conversion(table, mdbFile, "tableName");

TableToTable throws error and I don't know why. "table" is accessed using: D:\\path...\\database.mdb\\table is this ok? Where table is a table in database.mdb.

Can anyone help me?
Thank you! Nina

0 Kudos
0 Replies