1_テストサンプル.scpt
【スクリプトエディタで開く】 |
1_テストサンプル.scpt.scpt | ソース |
|---|
| 001 | #!/usr/bin/env osascript |
| 002 | #coding: utf-8 |
| 003 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7-- |
| 004 | (* |
| 005 | テスト用のサンプルスクリプト |
| 006 | 複数のファイルをFinderで開きます |
| 007 | この時、開くアプリケーションを指定しないで行う処理です・ |
| 008 |
|
| 009 | 7つのHTMLファイルをデフォルトのWEBブラウザ |
| 010 | (HTMLと関連づけられているアプリケーション)で開きます |
| 011 |
|
| 012 | noteの記事用のデモスクリプト |
| 013 | https://note.com/quicktimer/n/nd0342b80d2f7 |
| 014 |
|
| 015 |
|
| 016 | com.cocolog-nifty.quicktimer.icefloe *) |
| 017 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7-- |
| 018 | use AppleScript version "2.8" |
| 019 | use scripting additions |
| 020 |
|
| 021 | #開くファイルのパスのリスト |
| 022 | set listFilePath to {"/Library/Documentation/License.lpdf/Contents/Resources/English.lproj/License.html", "/Library/Documentation/License.lpdf/Contents/Resources/German.lproj/License.html", "/Library/Documentation/License.lpdf/Contents/Resources/French.lproj/License.html", "/Library/Documentation/License.lpdf/Contents/Resources/Dutch.lproj/License.html", "/Library/Documentation/License.lpdf/Contents/Resources/Italian.lproj/License.html", "/Library/Documentation/License.lpdf/Contents/Resources/Japanese.lproj/License.html", "/Library/Documentation/License.lpdf/Contents/Resources/Spanish.lproj/License.html"} as list |
| 023 |
|
| 024 |
|
| 025 | #UNIXパスリストをエイリアスパスリストに変換 |
| 026 | set listAliasFilePath to {} as list |
| 027 | repeat with itemFilePath in listFilePath |
| 028 | set itemAlisFilePath to (POSIX file itemFilePath) as alias |
| 029 | set end of listAliasFilePath to itemAlisFilePath |
| 030 | end repeat |
| 031 |
|
| 032 | #エイリアスリストに変換 |
| 033 | tell application "Finder" |
| 034 | set listAliasFilePath to listAliasFilePath as alias list |
| 035 | end tell |
| 036 |
|
| 037 | #エイリアスリストを1つづ処理していく |
| 038 | repeat with itemAliasFilePath in listAliasFilePath |
| 039 | #エイリアス形式を確定させておく |
| 040 | set aliasFilePath to itemAliasFilePath as alias |
| 041 | ####### |
| 042 | #問題の処理 |
| 043 | tell application "Finder" |
| 044 | open aliasFilePath |
| 045 | end tell |
| 046 | end repeat |
| 047 | return |
| AppleScriptで生成しました |
|---|