Applescript: How to test if a cell is empty in Numbers?
I'm a newbie to applescripts. I want to install an Automator Service to Numbers which implement the following function: mark out the duplicate cells in the selected range of Numbers. So I copy an script from web (Sorry to the author for I can't remember the original URL!) and make it successfully according to the steps provided.
tell application "Numbers" to tell front document to tell active sheet
set selected_table to first table whose class of selection range is range
tell selected_table
set selected_range to the selection range
tell selected_range
set values_list to {}
repeat with i from 1 to countcells
set cv to value of celli as text
if values_list contains (cv) then set background color of celli to "red"
set end of values_list to value of celli as text
end repeat
end tell
end tell
end tell
But I noticed that the empty cells are also marked with red color. So I tried to exclude the empty cell from comparison and test it with following lines as I thought:
if cv is equal to "" then set background color of cell i to "green"
if cell i is empty then ...
if cell i is blank then ...
But none of them do the thing. Can somebody give me some help?
MacBook Air, OS X Yosemite (10.10.4)