ブログでマシン環境を記述するのに活用するAppleScript。
フォーマットは2chMateライクにしてみた。
2chMate 0.8.6.4 dev/Sony/SO-01F/4.2.2/DR
最初は、前面のアプリ名をcurrent applicationで取得していたが、メニューから実行するとアプリ名がosascriptになる。よって、frontmost applicationを使うように変更。
setOSVersionToPasteboard.scpt
on run
--OSX Version
set systemInfo to system info
set aOSXVer to "OSX " & system version of systemInfo as text
--App Version
try
tell application "System Events"
set front_app to name of (path tofrontmost application)
end tell
set info to applicationfront_app
set anAppVer to name of info & " " & version of info as text
on error errorMsgnumbererrorNum
display alerterrorMsg
set anAppVer to "Unknown" as text
end try
--機種ID not 機種名
set aMacId to do shell script "sysctl -n hw.model"
--CPU
set aCPU to do shell script "sysctl -n sysctl -n hw.machine"
set like2chmate to anAppVer & "/Apple/" & aMacId & "/" & aOSXVer as text
set mix to like2chmate
set the clipboard to mix
end run
実行結果は、記事の最後を参照。
参考サイト
AS Hole(AppleScriptの穴) By Piyomaru Software » 機種IDを取得する » Blog Archive
http://piyocast.com/as/archives/718
[AppleScript] とてもユニークな命令、最前面のアプリ名を取得 | How2すいとー
http://www.hw2-suito.com/archives/327
実行環境
AppleScript Editor 2.6.1/Apple/iMac10,1/OSX 10.9.2