下面,我有一组对象数组。我一直在寻找我的对象,一旦找到它所在的数组,我就想找到并使用该数组的名称作为字符串。我的猜测是Array.name
(如下所示),但这不起作用。
ActiveDocument.gaShapesTab1 = new Array(ActiveDocument.Sections["Dashboard"].Shapes["Shape1"],ActiveDocument.Sections["Dashboard"].Shapes["Shape2"]);
ActiveDocument.gaShapesTab2 = new Array(ActiveDocument.Sections["Dashboard"].Shapes["Shape3"],ActiveDocument.Sections["Dashboard"].Shapes["Shape4"]);
ActiveDocument.gaShapesTab3 = new Array(ActiveDocument.Sections["Dashboard"].Shapes["Shape5"],ActiveDocument.Sections["Dashboard"].Shapes["Shape6"]);
ActiveDocument.gaShapeArrays = new Array(gaShapesTab1, gaShapesTab2, gaShapesTab3);
// go through an array of arrays
for(var x=0; x<gaShapeArrays.length; x++)
{
// and go through the objects of each one
for(var y=0; y<gaShapeArrays[x].length; y++)
{
// if "object" is in the array
if(object == gaShapeArrays[x][y])
{
// get "sidetab" from object's array's name
var sidetab = gaShapeArrays[x].name.replace('gaShapes',''); // assumes that shapearrays will have naming convention gaShapesSidetab
// we found it, we can stop now
break;
}
}
}
我在 Hyperion Intelligence 工作,因此并非所有 Javascript 都适用。例如,我无权访问窗口或文档。
每个数组包含一组与可视选项卡相关的形状对象。这允许我通过调用形状数组来显示或隐藏每个选项卡上的内容或更复杂的操作。但是,在处理形状本身时,我需要知道它们在哪个选项卡上。我试图通过查找它们所在的数组来向后工作。