Archive for the 'ODQuery' Category

2017/01/26 Open Directory経由でアカウント一覧を取得する v1


daemon accountの表示を抑止するためにいろいろ試していたものの、まだうまく操作できていません(ーー;

AppleScript名:Open Directory経由でアカウント一覧を取得する v1
– Created 2017-01-24 by Takaaki Naganoya
– 2017 Piyomaru Software
use AppleScript version “2.4″
use scripting additions
use framework “Foundation”
use framework “OpenDirectory”

set aSession to current application’s ODSession’s defaultSession()
set aRoot to current application’s ODNode’s nodeWithSession:aSession |name|:“/Local/Default” |error|:(missing value)
if aRoot = missing value then error “ODNode Error”

set aQuery to current application’s ODQuery’s queryWithNode:aRoot forRecordTypes:(current application’s kODRecordTypeUsers) |attribute|:(missing value) matchType:0 queryValues:(missing value) returnAttributes:(missing value) maximumResults:0 |error|:(missing value)
if aQuery = missing value then error “aQuery Error”

set resList to (aQuery’s resultsAllowingPartial:false |error|:(missing value)) as list
repeat with i in resList
  set aRes to (i’s recordName()) as string
log aRes
end repeat

★Click Here to Open This Script