Re: "first element whose" in Javascript for Automation
Re: "first element whose" in Javascript for Automation
- Subject: Re: "first element whose" in Javascript for Automation
- From: Deivy Petrescu <email@hidden>
- Date: Mon, 26 Jan 2015 16:57:02 -0500
Yes it did.
Thanks.
I run yours and it worked.
I made some changes in your script to see if those were responsible for the errors.
so;
table= numbers.doc.activeSheet.table[0]
Everything work as well.
The only other differences were you braking down every step and I was doing everything in one fell swoop.
But I changed yours and it worked too.
Then I checked mine and run it.
It worked!!!
I did get the error message and I copied from the dialog and from the messages pane, so it was there.
I also remember getting the array of cells displayed when I removed the “whose clause”.
I really don’t understand.
The only other difference was using a reference like AS and it worked.
My apologies for not putting the script, here is what I had:
numbers=Application('Numbers')
doc263= Path('/Users/deivy/Documents/Web/Spring_2015/math263/math263.numbers')
d263= numbers.open(doc263)
console.log(typeof d263)
Allrowcells=d263.activeSheet.tables[0].rows[2].cells
Allrowcells.whose({value:null})
It works now.
> On Jan 26, 2015, at 14:35 , David Steinberg <email@hidden> wrote:
>
> Hi Deivy,
>
> Perhaps there was an issue with how the AllrowCells array was set up. This example works:
>
> var Numbers = Application("Numbers")
>
> var doc = Numbers.documents[0]
> var sheet = doc.sheets[0]
> var table = sheet.tables[0]
> var row = table.rows[0]
>
> var nullCells = row.cells.whose({ value: null })
> var firstNullCell = nullCells[0]
>
> firstNullCell.properties()
>
> I hope this helps!
>
> - David
>
>> On Jan 24, 2015, at 08:16, Deivy Petrescu <email@hidden> wrote:
>>
>> I am writing this question to the list, but this is certainly a question for David! ;-}
>> I don’t mind if someone else can answer, though!
>>
>> I am working on a JSA script for Numbers, replicating a working script in AS.
>> I am able to get an array of cells of a certain row.
>> Now I want to get the address of the first row whose values is null (missing value in AS)
>>
>> Say the array name is AllrowCells.
>>
>> AllrowCells.whose({value:null)} does not seem to work.
>> —> TypeError: undefined is not a function (evaluating 'Allrowcells.whose({value:null})')
>>
>> I changed “value” and used other properties, still no go.
>> Also use other methods suggested in the JSA RN and, I then tried the literal copy of the JSA RN and use both someElementAllrowCells.whose() and firstElementAllrowCells.whose() (yep, I know, but when you are desperate reason goes down the drain)
>>
>> Here are the properties of a particular cell:
>>
>> {"verticalAlignment":"top", "row":Application("Numbers").documents.byId("BA596B39-A416-410C-9E8E-B065DF650640").sheets.at(0).tables.at(0).rows.byName(" John"), "pcls":"cell", "fontName":"HelveticaNeue", "formattedValue":null, "backgroundColor":{"red":0.7529411911964417, "green":0.9293965101242065, "blue":0.9960784316062927}, "formula":null, "name":"K2", "textWrap":false, "textColor":{"red":0, "green":0, "blue":0}, "alignment":"auto align", "column":Application("Numbers").documents.byId("BA596B39-A416-410C-9E8E-B065DF650640").sheets.at(0).tables.at(0).columns.byName("1/30"), "format":"automatic", "fontSize":10, "value":null}
>>
>>
>> Deivy Petrescu
>> email@hidden
>>
>>
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> AppleScript-Users mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> Archives: http://lists.apple.com/archives/applescript-users
>>
>> This email sent to email@hidden
>
Deivy Petrescu
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden