[コンソール]ストリームスタート
#!/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
####起動して
tell application "Console"
launch
activate
end tell
####いったん終了させる
tell application id "com.apple.Console"
quit
end tell
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 listReadPlistData to refMe's NSMutableDictionary's dictionaryWithContentsOfURL:ocidFilePathURL |error|:(reference)
set ocidPlistDict to item 1 of listReadPlistData
set ocidDeviceUUID to (ocidPlistDict's valueForKeyPath:"IORegistryEntryChildren.IOPlatformUUID")
set strDeviceUUID to ocidDeviceUUID as text
############
#ホスト名
set strCommandText to ("/usr/sbin/scutil --get ComputerName") as text
set strComputerName to (do shell script strCommandText) as text
tell application "Console"
launch
activate
selectDevice strDeviceUUID
end tell
try
tell application "System Events"
click menu item "ストリーム" of menu "アクション" of menu bar item "アクション" of menu bar 1 of application process "Console"
end tell
on error
tell application "System Events"
click menu item 5 of menu "アクション" of menu bar item "アクション" of menu bar 1 of application process "Console"
end tell
end try
| 固定リンク
「Console」カテゴリの記事
- [コンソール]ストリームスタート(2023.04.26)