AppleScript名:リストに入れたレコードを、指定の属性ラベルの値で抽出 |
— Created 2017-03-16 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" set aList to {{aLabel:"1", bLabel:"1"}, {aLabel:"2", bLabel:"2"}, {aLabel:"3", bLabel:"3"}, {aLabel:"4", bLabel:"4"}} set anArray to current application’s NSMutableArray’s arrayWithArray:aList set aRes to my filterRecListByLabel1(anArray, "aLabel == ’1’") –> {{aLabel:"1", bLabel:"1"}} –リストに入れたレコードを、指定の属性ラベルの値で抽出 on filterRecListByLabel1(aRecList as list, aPredicate as string) set aArray to current application’s NSArray’s arrayWithArray:aRecList set aPredicate to current application’s NSPredicate’s predicateWithFormat:aPredicate set filteredArray to aArray’s filteredArrayUsingPredicate:aPredicate return filteredArray as list end filterRecListByLabel1 |
More from my site
(Visited 18 times, 1 visits today)