[AppleScript] リスト形式で項目を先頭に追加 項目を最後についか
AppleScript サンプルコード
行番号 | ソース |
---|---|
001 | #!/usr/bin/env osascript |
002 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
003 | # |
004 | # com.cocolog-nifty.quicktimer.icefloe |
005 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
006 | use AppleScript version "2.8" |
007 | use scripting additions |
008 | |
009 | |
010 | #リストの先頭に追加 |
011 | set listAddItem to {"BBB", "CCC", "DDD"} as list |
012 | copy "AAA" to beginning of listAddItem |
013 | log listAddItem as list |
014 | -->(*AAA, BBB, CCC, DDD*) |
015 | |
016 | #リストの先頭に追加 |
017 | set listAddItem to {"BBB", "CCC", "DDD"} as list |
018 | set beginning of listAddItem to "AAA" |
019 | log listAddItem as list |
020 | -->(*AAA, BBB, CCC, DDD*) |
021 | |
022 | |
023 | #リストの後方に追加 |
024 | set listAddItem to {"BBB", "CCC", "DDD"} as list |
025 | copy "AAA" to end of listAddItem |
026 | log listAddItem |
027 | -->(*BBB, CCC, DD, AAA*) |
028 | |
029 | |
030 | |
031 | #リストの後方に追加 |
032 | set listAddItem to {"BBB", "CCC", "DDD"} as list |
033 | set end of listAddItem to "AAA" |
034 | log listAddItem |
035 | -->(*BBB, CCC, DD, AAA*) |
036 | |
037 | |
038 | #リストの前方に追加 |
039 | set listAddItem to {"BBB", "CCC", "DDD"} as list |
040 | set listAddItem to {"AAA"} & listAddItem as list |
041 | log listAddItem as list |
042 | -->(*AAA, BBB, CCC, DDD*) |
043 | |
044 | #リストの後方に追加 |
045 | set listAddItem to {"BBB", "CCC", "DDD"} as list |
046 | set listAddItem to listAddItem & {"AAA"} as list |
047 | log listAddItem as list |
048 | -->(*BBB, CCC, DD, AAA*) |
049 | |
050 | #最初を置換 |
051 | set listAddItem to {"BBB", "CCC", "DDD"} as list |
052 | copy "AAA" to first item of listAddItem |
053 | log listAddItem as list |
054 | -->(*AAA, CCC, DDD*) |
055 | |
056 | #2番目を置換 |
057 | set listAddItem to {"BBB", "CCC", "DDD"} as list |
058 | copy "AAA" to item 2 of listAddItem |
059 | log listAddItem as list |
060 | -->(*BBB, CCC, AAA*) |
061 | |
062 | #最後を置換 |
063 | set listAddItem to {"BBB", "CCC", "DDD"} as list |
064 | copy "AAA" to last item of listAddItem |
065 | log listAddItem as list |
066 | -->(*BBB, AAA, DDD*) |
067 | |
068 | |
069 | |
AppleScriptで生成しました |
| 固定リンク