BridgePlus AppleScript Libraryを使わずに、1D Listを2D Listに変換するAppleScriptです。
Script Debuggerの開発が終了したため、Frameworkを内蔵したBridgePlusの運用についても、今後は「Script Debuggerをダウンロードして動かしてほしい」といったお願いができなくなるかもしれません。
BridgePlus AppleScriptライブラリは有用ですが、Frameworkを含んでいるため実行できる環境が限られるかもしれません(ASObjC Explorerが復活しないかなー)。そのための「準備」です。
AppleScript名:BridgePlusを使わずに1D–>2D list.scptd |
— – Created by: Takaaki Naganoya – Created on: 2025/02/03 — – Copyright © 2025 Piyomaru Software, All Rights Reserved — use AppleScript version "2.4" — Yosemite (10.10) or later use framework "Foundation" use scripting additions set dList to {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} set aRes to my subarraysFrom:dList groupedBy:3 –> {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}} set aRes to my subarraysFrom:dList groupedBy:5 –> {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}} –1D Listの2D LIst化 on subarraysFrom:aList groupedBy:colCount script spd property aList : {} property bList : {} property cList : {} end script set (aList of spd) to aList set (bList of spd) to {} set (cList of spd) to {} set aLen to length of (aList of spd) set aMod to aLen mod colCount if aMod is not equal to 0 then error "Item number does not match paramaters" repeat with i from 1 to aLen by colCount set (bList of spd) to items i thru (i + colCount – 1) of (aList of spd) set the end of (cList of spd) to (bList of spd) end repeat return (cList of spd) end subarraysFrom:groupedBy: |
More from my site
(Visited 1 times, 1 visits today)