[デバイス]モデル名(形式)を取得する
#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.6"
use framework "Foundation"
use scripting additions
property refMe : a reference to current application
set appFileManager to refMe's NSFileManager's defaultManager()
#####################################
######ファイル保存先
#####################################
set ocidUserLibraryPathArray to (appFileManager's URLsForDirectory:(refMe's NSDocumentDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidFilePathURL to ocidUserLibraryPathArray's objectAtIndex:0
set ocidSaveDirPathURL to ocidFilePathURL's URLByAppendingPathComponent:"Apple/IOPlatformUUID"
############################
#####属性
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidAttrDict's setValue:511 forKey:(refMe's NSFilePosixPermissions)
############################
###フォルダを作る
set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
#####################################
######PLISTパス
#####################################
set ocidFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:"ioreg.plist"
set strFilePath to (ocidFilePathURL's |path|()) as text
###古いファイルはゴミ箱に
set boolResults to (appFileManager's trashItemAtURL:ocidFilePathURL resultingItemURL:(missing value) |error|:(reference))
#####################################
######コマンド実行
#####################################
set strCommandText to "/usr/sbin/ioreg -c IOPlatformExpertDevice -a >> \"" & strFilePath & "\"" as text
do shell script strCommandText
#####################################
######plist読み込み
#####################################
set ocidPlistDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
set ocidReadPlistData to refMe's NSMutableDictionary's dictionaryWithContentsOfURL:ocidFilePathURL |error|:(reference)
set ocidPlistDict to item 1 of ocidReadPlistData
#####################################
###### デバイスUUID 取得
#####################################
set ocidDeviceUUID to (ocidPlistDict's valueForKeyPath:"IORegistryEntryChildren.IOPlatformUUID")
log ocidDeviceUUID as text
#####################################
###### シリアル番号取得
#####################################
set ocidSerialNumber to (ocidPlistDict's valueForKeyPath:"IORegistryEntryChildren.IOPlatformSerialNumber")
log ocidSerialNumber as text
#####################################
###### モデル番号
#####################################
set ocidEntryName to (ocidPlistDict's valueForKeyPath:"IORegistryEntryChildren.IORegistryEntryName")
log ocidEntryName as text
#####################################
###### モデル番号 型式
#####################################
set ocidEntryModelNameData to (ocidPlistDict's valueForKeyPath:"IORegistryEntryChildren.model")
set ocidEntryModelName to refMe's NSString's alloc()'s initWithData:(item 1 of ocidEntryModelNameData) encoding:(refMe's NSUTF8StringEncoding)
log ocidEntryModelName as text
#####################################
######保存先を開く
#####################################
set appNSShardWorkspace to refMe's NSWorkspace's sharedWorkspace()
appNSShardWorkspace's openURL:ocidSaveDirPathURL
| 固定リンク
「Admin Device Management」カテゴリの記事
- デバイスUUIDの取得(2024.11.11)
- モデル名を取得する(2024.05.17)
- TB Default Item Identifiers(com.apple.finder.plist)(2023.12.22)
- [profiles] profiles コマンド書き出したバックアップを各ファイルに書き出す(2023.11.12)
- [profiles]現在のユーザー・プロファイル設定をバックアップ(2023.10.31)