Hi All:
Totally new to OmniGraffle Automation and doing things brute force via “copy as javascript” and Automation Console to try learn the internal constructs/manipulations. I need to create some sort of construct to deal with 3 space. I think a 3 dimensional array will provide what I need but I’m stumbling over the mechanics.
Starting with a 2-dimensional array:
var myArr = new Array();
myArr[0] = new Array();
myArr[0] = “abcde”;
myArr[1] = “fghij”;
myArr[2] = “klmno”;
myArr[0][0] = “pqrst”;
myArr[0][1] = “uvwxy”;
g1.text = "xval1: " + myArr[0] + ", yval1: " + myArr[0][0] + ", xval2: " + myArr[1] + ", xval3: " + myArr[2];
For myArr[0][0] I’m expecting to see “pqrst” as the result.
Thinking it would be the first element in both the 1st and 2nd dimensions of a 2 dimensional array
What I’m seeing is:
myArr[0] : “abcde”
myArr[1] ": “fghij”
myArr[2] : “klmno”
myArr[0][0] is the 1st byte of 1st element of the 1st dimension (i.e. “a”)
myArr[0][1] is the 2nd byte of 1st element of the 1st dimension (i.e. “b”)
myArr[0][2] is the 3rd byte of 1st element of the 1st dimension (i.e. “c”)
myArr[0][3] is the 4th byte of 1st element of the 1st dimension (i.e. “d”)
myArr[0][4] is the 5th byte of 1st element of the 1st dimension (i.e. “e”)
myArr[0][5] is the 6th byte of 1st element of the 1st dimension (i.e. doesn’t exist)
Thought I would see:
myArr[0][0] => “pqrst”
myArr[0][1] => “uvwxy”
It’s clear that it’s looking at each of the bytes in the 1st dimension one by one with that second [x] index rather than the 1st element in the 1st dimension and the 1st element of its associated 2nd dimension for [0][0] as an example.
Any thoughts on what I’m doing wrong here?
Thanks.