I'm writing some routines to move data in and out of Numbers tables using Swift and Scriptingbridge. Most of it is working OK but I am struggling to read cell values which is kind of the point of the exercise. I can read and write other properties, like the cell's row/column, as expected but if I use:
var x = cell.value
I get a reply:
Scripting test[9307:928082] -[SBObject copyWithZone:]: unrecognized selector sent to instance 0x600000d15f50
If I try:
cell?.value = "21"
I get the error:
Cannot assign to property: 'cell' is immutable'
I randomly tried:
cell?.setValue!("21")
and it worked, the cell updated in the table. I tried:
cell?.getValue!()
which didn't throw an error but always returns nil. I tried:
var cellObject = cell as! SBObject
var x = cellObject.property(withCode: 0x4E4D4376)
(where 0x4E4D4376 is the AEKeyword for a Numbers cell value) which returns:
<SBObject @0x600000d176c0: value of <class 'NmCl'> 1 of cellRange of <class 'NmTb'> 0 of <class 'NmSh'> 1 of <class 'docu'> 0 of application "Numbers" (3184)>
which looks like the correct reference but there doesn't seem to be a way to get the actual value from that.
I can read and write all the other properties I've tried and used methods so something's Not Quite Right here. As it stands I can write to cells using a workaround but not read, does anyone know of any workarounds?
Thanks in advance!
var x = cell.value
I get a reply:
Scripting test[9307:928082] -[SBObject copyWithZone:]: unrecognized selector sent to instance 0x600000d15f50
If I try:
cell?.value = "21"
I get the error:
Cannot assign to property: 'cell' is immutable'
I randomly tried:
cell?.setValue!("21")
and it worked, the cell updated in the table. I tried:
cell?.getValue!()
which didn't throw an error but always returns nil. I tried:
var cellObject = cell as! SBObject
var x = cellObject.property(withCode: 0x4E4D4376)
(where 0x4E4D4376 is the AEKeyword for a Numbers cell value) which returns:
<SBObject @0x600000d176c0: value of <class 'NmCl'> 1 of cellRange of <class 'NmTb'> 0 of <class 'NmSh'> 1 of <class 'docu'> 0 of application "Numbers" (3184)>
which looks like the correct reference but there doesn't seem to be a way to get the actual value from that.
I can read and write all the other properties I've tried and used methods so something's Not Quite Right here. As it stands I can write to cells using a workaround but not read, does anyone know of any workarounds?
Thanks in advance!