Cannot edit numbers document with AppleScript - numbers

I am trying to run a very simple script in automator for a the apple program numbers. I have tried a couple of different scripts with no success.
With the following code:
on run {input, parameters}
tell application "Numbers"
activate
tell document 1 to tell sheet 1 to set the value of cell "B3" to 0
tell document 1 to tell sheet 1 to set the value of cell "C4" to 42
end tell
return input
end run
I get the following error message:
"Numbers got an error: Can’t set cell "B3" of sheet 1 of document 1 to 0."
There was a nearly identical posted question with the following solution:
on run {input, parameters}
tell application "Numbers"
tell table 1 of sheet 3 of document 1
set the value of cell 1 of column "E" to 1000
end tell
end tell
return input
end run
but this gives me the following error message:
"Numbers got an error: Can’t set table 1 of document 1 to 1000."
This other post did mention it may have something to do with privileges but did not elaborate and I have been unable to find any more information regarding this.
Can anyone help me please?
Thank you.

With a Numbers document already opened, the following example AppleScript code works for me:
tell application "Numbers"
activate
tell first table of first sheet of front document
set value of cell "B3" to 0
set value of cell "C4" to 42
end tell
end tell
Here is a different way of saying the same thing as the example AppleScript code above:
tell application "Numbers"
activate
set value of cell "B3" of table 1 of sheet 1 of document 1 to 0
set value of cell "C4" of table 1 of sheet 1 of document 1 to 42
end tell
Note: The example AppleScript code is just that and does not contain any error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors. Additionally, the use of the delay command may be necessary between events where appropriate, e.g. delay 0.5, with the value of the delay set appropriately.

Related

Different values in Variables View than Console View

I´m debugging an IOS application with UITest.
I have tried to get the last index of the table but it gave me an unexpected value like 18446744073709551615.
Then I saw a problem between Variables View and Console View.
In the variables view, at the index value prints -1 but if I execute a 'po' command with the same initialization than the Index variable I got another value as you can check in the picture.
I wish that somebody could help me with this problem or tell me why is it happening.
Regards
It is the same number. -1 = 2^^64 - 1 = 18446744073709551615. You get the last on po.

Zabbix Trigger Expression = NULL

i´ve a quick question regarding a zabbix trigger expression. Our script finds out the certification lifetime while returning a number into a file. I already created some triggers for specific time spans (like 10 days or 44 days).
For example:
{Certificate Lifetime:vfs.file.contents[C:\Zabbix_scripts\cert.txt].prev()}<=30 and {Certificate Lifetime:vfs.file.contents[C:\Zabbix_scripts\cert.txt].prev()}>10
I now want to have a trigger which will cause an "Disaster" when the value in the .txt file is unavailable, like the txt file is empty.
I´ve tried
{Certificate Lifetime:vfs.file.contents[C:\Zabbix_scripts\cert.txt].prev()}=0
But this was not the right sulution. Any ideas?
Moreover we have some machines which are equal to others but doesn´t show any value. Any ideas at this point?
Regards
You should be able to detect empty item value with something like this:
strlen()=0

Matlab/Simulink: If block error

Please refer to the image at the following link attached for understanding the question.
Image is at this link: http://www5.picturepush.com/photo/a/12014483/img/12014483.jpg)
here are 2 inputs: 1.Speed_Pulse 2.PreviousSpeedPulse_1_old
The second input is nothing but the first input delayed in time by 1 time instant using the unit delay block. The 'If' block compares the 2 inputs. If the input 'u1' (Speed_Pulse) is less than 'u2'(PreviousSpeedPulse_1_old) then, in the 'if action' block, the value 64 is simply added to u1 (Speed_Pulse) value. Else, the input Speed_Pulse is directly transmitted to the output via the 'else action' block. One of the outputs is transmitted to 'Temp' (depending on the 'if-else') using the 'Merge' block.
Now, please refer to following table of inputs and outputs.
The table is at this link: http://img521.imageshack.us/img521/8684/tablewy.png
In the table, the values are wrong for instant 4 and instant 7.
I could not find a reason for this abrupt wrong output.
Any idea what is going wrong?
Sorry it was my mistake. Actually I was using a Framework below it and it was the error of the Framework. Got it resolved. Thanks for your help.

Boolean to check group if there is 2 exact same values directly after ach other

I am grouping in Crystal reports and have a field that I am trying to monitor for 2 duplicated values should they follow directly after another at any time. Please see example below :
IDTAG#14567 {Groupname}
Date Device Tagtype MovementType Firstname
01/01/11 08:15am Entry AVI 0 AnnaAVI1
01/01/11 08:25am Entry AVI 0 AnnaAVI2
01/01/11 11:35am Exit AVI 4 AnnaAVI2
01/01/11 12:05pm Entry AVI 0 AnnaAVI1
01/01/11 15:24pm Exit AVI 4 AnnaAVI1
01/01/11 16:00pm Exit AVI 4 AnnaAVI2
I need a 'True' value output only if {MovementType} has 2 value's of '0' followed in direct succession, it doesn't matter when it happens within the group.
To get the duplicate part, a formula that would accomplish it would be
previous({table.movementType}) = {table.movementType}
However then the problem is how to indicate that there were duplicates in a group regardless of where it occurred.
I haven't found a way to deal with that.

Problems with empty table view

im trying to write an app that will display a list off lines from a book e.g line 1, line 2 in a table view and you can then select a line to view the corrosponding text.
I've got to the stage where the text should at least appear in the table view(not as far as being able to select it), yet it remains empty.
I used the debugger and was able to find out that there are zero objects in the array used to determine the 'numberOfRowsInSection' and being as this returns zero I think this may explain the problem?
I have pasted up all my code and would really appreciate it if someone has time to skim through it. I know its a big thing to ask but I cant seem to pin point the problem myself.
RootViewController.h --> http://pastie.org/858561
RootViewController.m---> http://pastie.org/858562
BookTestAppDelegate.h ---> http://pastie.org/858566
BookTestAppDelegate.m---> http://pastie.org/858567
LineClass.h----> http://pastie.org/858568
LineClass.m ----> http://pastie.org/858570
SOURCE : http://uploading.com/files/9f5f1249/BookTest.zip/
Thanks guys,
Your sample sqlite database doesn't have table named "animals". But it has table "book". I think you should correct your readLinesFromDatabase method with following SQL statement: select * from book. ;-)