ディスプレイの解像度を取得する
自分用覚え書きエントリー。ディスプレイの解像度を取得するwsh。
JScript
var ie = new ActiveXObject('InternetExplorer.Application'); ie.navigate('about:blank'); WScript.echo(ie.document.parentWindow.screen.width); WScript.echo(ie.document.parentWindow.screen.height); ie.quit(); ie = null;
VBScript
Set ie = CreateObject("InternetExplorer.Application") ie.Navigate("about:blank") WScript.Echo(ie.document.parentWindow.screen.width) WScript.Echo(ie.document.parentWindow.screen.height) ie.Quit Set ie = Nothing
ググるとWMIで取得する方法は結構出てくるんだけど、WMIをいまいち理解出来てないのと、普段触ることの多いjavascript*1の方がソース見ただけで直観的に何してるかを理解し易いので、ie起動してdom経由で取得してみた。