Closed4

ASTRO Command Centerの充電をどうにか取得したい

ara_ta3ara_ta3

考えてる方法

  • ioregでなんかどうにか取得する
  • ASTRO Command Centerのキャプチャを取って画像から充電を取る
ara_ta3ara_ta3

screencapture コマンドにwindow idを渡すとそのキャプチャが取れるっぽいん
https://qiita.com/nekoze_da/items/c38994d1526bc7224e60

が、全てにidがあるわけじゃなさそうで、ASTRO Command Centerにもなさそうだった
https://apple.stackexchange.com/questions/208005/how-to-get-the-window-id-with-title-of-every-process

#!/usr/bin/env osascript
#

set didRun to get running of application "ASTRO Command Center"

tell application "ASTRO Command Center"
	activate
	delay 1
end tell

if not didRun then
	quit application "ASTRO Command Center"
end if

これで起動して消すまでは出来るのでapplication名は合ってそう

# こっちは返ってくるが
osascript -e 'tell app "iTerm" to id of window 1'

# こっちはだめ
osascript -e 'tell app "ASTRO Command Center" to id of window 1'
ara_ta3ara_ta3

これでpropertyを見てみると、positionがあるので、それとサイズを計算すればscreencapture -R でいけるかもしれない

osascript -e 'tell application "System Events" to get the properties of every window of (every process whose visible is true)'

screencapture --help
...
  -R<x,y,w,h> capture screen rect
ara_ta3ara_ta3

次気分が盛り上がったらやること

  • positionをapplescriptで取得する
  • screencaptureに渡してスクショ取ってみる
このスクラップは5ヶ月前にクローズされました