5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AppleScriptでアプリケーションのウインドウ数を取得

Last updated at Posted at 2014-08-07

AppleScriptでアプリケーションのウインドウ数を取得する処理を作ってみた。

肝はこれ

tell application アプリケーション名
	set 変数 to number of windows
end tell

【処理】

--引数 :アプリケーション名(ex. "Safari" )
--戻り値:整数
to tellAppToGetWindowCount(inAppName)
	set windowCount to 0
	tell application inAppName
		set windowCount to number of windows
	end tell
	return windowCount
end tellAppToGetWindowCount

使い方(Safariのウインドウを数える)

tellAppToGetWindowCount("Safari")

結果

2
5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?