— – Created by: Takaaki Naganoya – Created on: 2020/12/06 — – Copyright © 2020 Piyomaru Software, All Rights Reserved —
use AppleScript version "2.4" — Yosemite (10.10) or later use framework "Foundation" use scripting additions
tell application "Numbers" tell front document –現在表示中のシートを対象にする tell active sheet –Tableを特定する try set theTable to first table whose class of selection range is range on error display notification "Numbers: There is no selection" return {} end try tell theTable tell selection range set cellRes to background color of cells set aWidth to count every column set aHeight to count every row end tell end tell –Check selected cell’s background color set cellL to {} set adrCount to 1 repeat with y from 1 to aHeight repeat with x from 1 to aWidth set aTmp to contents of (item adrCount of cellRes) if aTmp is not equal to missing value then set the end of cellL to {x, y} end if set adrCount to adrCount + 1 end repeat end repeat return cellL –> {{1, 1}, {2, 1}, {3, 1}, {6, 1}, {8, 1}, {12, 1}, {15, 1}, {16, 1}, {20, 1}, {21, 1}, {24, 1}, {27, 1}, {28, 1}, {29, 1}, {1, 2}, {4, 2}, {6, 2}, {9, 2}, {11, 2}, {14, 2}, {17, 2}, {19, 2}, {23, 2}, {25, 2}, {27, 2}, {1, 3}, {2, 3}, {3, 3}, {6, 3}, {10, 3}, {14, 3}, {17, 3}, {19, 3}, {20, 3}, {23, 3}, {25, 3}, {27, 3}, {28, 3}, {29, 3}, {1, 4}, {6, 4}, {10, 4}, {14, 4}, {17, 4}, {21, 4}, {23, 4}, {25, 4}, {27, 4}, {1, 5}, {6, 5}, {10, 5}, {15, 5}, {16, 5}, {19, 5}, {20, 5}, {21, 5}, {24, 5}, {27, 5}, {1, 7}, {5, 7}, {8, 7}, {11, 7}, {12, 7}, {15, 7}, {17, 7}, {19, 7}, {20, 7}, {21, 7}, {23, 7}, {27, 7}, {1, 8}, {2, 8}, {4, 8}, {5, 8}, {7, 8}, {9, 8}, {11, 8}, {13, 8}, {15, 8}, {17, 8}, {20, 8}, {23, 8}, {27, 8}, {1, 9}, {3, 9}, {5, 9}, {7, 9}, {8, 9}, {9, 9}, {11, 9}, {12, 9}, {15, 9}, {17, 9}, {20, 9}, {23, 9}, {25, 9}, {27, 9}, {1, 10}, {5, 10}, {7, 10}, {9, 10}, {11, 10}, {13, 10}, {15, 10}, {17, 10}, {20, 10}, {23, 10}, {24, 10}, {26, 10}, {27, 10}, {1, 11}, {5, 11}, {7, 11}, {9, 11}, {11, 11}, {13, 11}, {16, 11}, {20, 11}, {23, 11}, {27, 11}} end tell end tell end tell
|