choose from listの複数リスト版。複数のポップアップメニューをダイアログ上で選択するUser Interfaceを提供する、「choose multiple list」AppleScriptライブラリです。macOS 10.13以降対応です。
▲選択リスト数は可変
–> Download chooseMultiList(To ~/Library/Script Libraries)
AppleScript name:sample 1.scptd |
— – Created by: Takaaki Naganoya – Created on: 2019/12/10 — – Copyright © 2019 Piyomaru Software, All Rights Reserved — use AppleScript version "2.7" — High Sierra (10.13) or later use framework "Foundation" use scripting additions use mulList : script "choose multiple list" set selList to {{"Red", "Blue", "Yellow", "Brown", "White", "Cyan", "Grey"}, {"Red", "Blue", "Yellow", "Brown", "White", "Cyan", "Grey"}} set tList to {"1st Segments", "2nd Segments"} set aRes to choose multiple list selList main message "Select Items Demo" sub message "Select each selection. Same selection items *NOT* allowed" with title lists tList height 140 width 400 return type item contents without allow same items –> {"Red", "Yellow"} |
AppleScript name:sample 2.scptd |
— – Created by: Takaaki Naganoya – Created on: 2019/12/10 — – Copyright © 2019 Piyomaru Software, All Rights Reserved — use AppleScript version "2.7" — High Sierra (10.13) or later use framework "Foundation" use scripting additions use mulList : script "choose multiple list" set selList to {{"Red", "Blue", "Yellow", "Brown", "White", "Cyan", "Grey"}, {"Red", "Blue", "Yellow", "Brown", "White", "Cyan", "Grey"}} set tList to {"1st Segments", "2nd Segments"} set aRes to choose multiple list selList main message "Select Items Demo" sub message "Select each selection. Same selection items allowed" with title lists tList height 140 width 400 return type item numbers with allow same items –> {1, 1} |
テキストエディタ上でオープン中のテキストのdiff表示を行う場合のファイル選択のために作成したものです。
▲もっと汎用的に差分表示用の部品として活用するために、AppleScript用語辞書の添付が切実に望まれるApple製アプリケーション第1位のFileMerge
AppleScript名:CotEditor –> FileMergeでDiff表示.scptd |
— – Created by: Takaaki Naganoya – Created on: 2019/12/10 — – Copyright © 2019 Piyomaru Software, All Rights Reserved — use AppleScript version "2.7" — High Sierra (10.13) or later use framework "Foundation" use scripting additions use mulList : script "choose multiple list" tell application "CotEditor" set dCount to count every document if dCount < 2 then display dialog "A few documents…" with title "Error" buttons {"OK"} default button 1 return else if dCount = 2 then –オープン中の書類が2つある場合 set aPath to file of document 1 set bPath to file of document 2 set aPOSIX to POSIX path of aPath set bPOSIX to POSIX path of bPath else –オープン中の書類が2つ以上存在している場合 set dList to {} set adList to file of every document repeat with i in adList set the end of dList to POSIX path of i end repeat set selList to {dList, dList} set tList to {"Document #1", "Document #2"} set aRes to choose multiple list selList main message "Select two files to display diff" sub message "Select each file. Same selection items NOT allowed" with title lists tList height 140 width 700 return type item contents without allow same items copy aRes to {aPOSIX, bPOSIX} end if end tell tell application "FileMerge" to activate do shell script "/usr/bin/opendiff " & quoted form of aPOSIX & " " & quoted form of bPOSIX & " &" |