AppleScript 共有フォルダのリストを取得する
AppleScriptで共有フォルダのリストを取得できるだろうと思っていたが簡単ではなかった。
10.6だとフォルダを選び「情報を見る」と、共有フォルダのチェックボックスがある。そのチェックの有無を取得できると思っていたが、そんな属性はなかった。
いろいろ〜とググリ回って、できたスクリプトがこれ。
[applescript]
set cmd to "dscl . list /SharePoints"
set sharedTxt to do shell script cmd
set sharedList to {}
repeat with pp from 1 to (count paragraph of sharedTxt)
set spName to paragraph pp of sharedTxt
set cmd to "dscl . read /SharePoints/" & spName & " directory_path"
try
set thePathTxt to (do shell script cmd)
set len to (length of "dsAttrTypeNative:directory_path: ") + 1
set sharedList to sharedList & ((characters len thru -1 of thePathTxt) as Unicode text)
end try
end repeat
[/applescript]
Leave a comment
記事投稿日
日 | 月 | 火 | 水 | 木 | 金 | 土 |
---|---|---|---|---|---|---|
« 9月 | ||||||
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |