WSH

1月 1, 2003 · Posted in WSH · Comment 

-公式
http://www.microsoft.com/japan/msdn/scripting/

IEのページ読み込みが完了するまで待つ。

 objIE = ...
Do Until objIE.readyState = 4
Loop

スクリプトの終了

WScript.Quit([エラーコード])

指定した時間の間、スクリプトを停止

WScript.Sleep([msec])
msec = 1000で1秒

実行ファイル(WScript.exe)の場所、ファイル名を取得

WScript.Fullname

実行ファイル(WScript.exe)の場所を取得

WScript.Path

実行中のスクリプトの位置を取得

WScript.ScriptFullName

実行中のスクリプト名を取得

WScript.ScriptName
[\vb]

<h2>実行中のスクリプトが格納されている親ディレクトリ名を取得</h2>
1
' スクリプトパス
scriptDir =  CreateObject("Scripting.FileSystemObject").
GetFile(WScript.ScriptFullName).ParentFolder
' ディレクトリ名
yenPosition = InStrRev(scriptDir, "\")
dirName = right(scriptDir, len(scriptDir) - yenPosition)

インストールされているWScriptのバージョンを取得

WScript.Version

キーボード操作のシュミレート

sendkey

 Dim s
Set s = CreateObject("WScript.Shell")
s.SendKeys("%{TAB}") ' ALT+TAB

-http://msdn.microsoft.com/ja-jp/library/cc364423.aspx

他のVBスクリプトを実行

Dim wsh
Set wsh = Wscript.CreateObject("Wscript.Shell")
Dim result
result = wsh.Run("c:\other.vbs",, True)

3つ目の引数(True)は、以下のとおり

Runメソッドの第3引数にTrueを指定した場合には、
起動したプログラムの終了コードをスクリプトで取得できる。
http://www.atmarkit.co.jp/fwin2k/operation/wsh05/wsh05_02.html

WSH/Windows Script Encoder

1月 1, 2003 · Posted in WSH · Comment 

概要

WSHコードの符号化を行う。

-入手先
http://www.microsoft.com/downloads/details.aspx?FamilyID=2976ee94-bec5-4314-84fd-8d7ec891c1c5&DisplayLang=ja