AppleScript名:配列の指定アイテムに指定要素を挿入 |
— Created 2017-10-29 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" –Chapter 6 Lib.asobjcex3doc set theList to {5, 2, 9, 4, 2, 6, 3} set longList to my insertItem:99 atIndex:5 inList:theList –> {5, 2, 9, 4, 99, 2, 6, 3} set longList2 to insertItem of me at 99 for 5 from theList –> {5, 2, 9, 4, 99, 2, 6, 3} set longList3 to insetItemBy(99, 5, theList) of me –> {5, 2, 9, 4, 99, 2, 6, 3} –Objective-Cライクなパラメータ記述 on insertItem:anItem atIndex:(theIndex as integer) inList:(theList as list) set theArray to current application’s NSMutableArray’s arrayWithArray:theList theArray’s insertObject:anItem atIndex:(theIndex – 1) return theArray as list end insertItem:atIndex:inList: –無意味区による装飾 on insertItem at anItem for theIndex as integer from theList as list set aRes to my insertItem:anItem atIndex:theIndex inList:theList return aRes end insertItem –Pure AS風のパラメータ記述 on insetItemBy(anItem, theIndex, theList) set aRes to my insertItem:anItem atIndex:theIndex inList:theList return aRes end insetItemBy |
More from my site
(Visited 29 times, 1 visits today)