●
strWeb = "https://garakutabako.jp/timer/mini.htm"
'-----------------
'メイン
'ウインドウを検索
Dim objIE : Set objIE = Nothing
Dim objShell : Set objShell = CreateObject("Shell.Application")
Dim objWindow
For Each objWindow In objShell.Windows
'TypeNameでオブジェクト変数のタイプを表示する
'HTMLDocumentだったら
If TypeName(objWindow.document) = "HTMLDocument" Then
If objWindow.document.URL = strWeb Then
set objIE = objWindow '見つけたウインドウを(IE)を代入
Exit For
End IF
End If
Next
'見つけたかチェック
If objIE Is Nothing Then
'IE起動
Set objIE = WScript.CreateObject("InternetExplorer.Application")
call IEExec(objIE)
End If
set objA = objIE.document.getElementsByTagName("INPUT")
For n = 0 To objA.Length - 1
If objA(n).id = "button_count_or_pause" then
objA(n).click
Exit For
End If
Next
set objIE = nothing
'-----------------
'IE起動
sub IEExec(byVal objIE)
objIE.left = 0
objIE.top = 0
'objIE.FullScreen = True
objIE.Visible = True
objIE.Navigate strWeb
'IEの表示完了を待つ
While objIE.ReadyState <> 4 Or objIE.Busy = True
WScript.Sleep 100
Wend
'objIE.width = objIE.Document.parentWindow.screen.availwidth
'objIE.height = objIE.Document.parentWindow.screen.availheight
end sub
●
strUID = "user"
strPassword = "Ccc100"
strWeb = "https://garakutabako.jp/timer/mini.htm"
strUserID="username"
strPassID="passwd"
'-----------------
'メイン
'ウインドウを検索
Dim objIE : Set objIE = Nothing
Dim objShell : Set objShell = CreateObject("Shell.Application")
Dim objWindow
For Each objWindow In objShell.Windows
'TypeNameでオブジェクト変数のタイプを表示する
'HTMLDocumentだったら
If TypeName(objWindow.document) = "HTMLDocument" Then
If objWindow.document.URL = strWeb Then
set objIE = objWindow '見つけたウインドウを(IE)を代入
Exit For
End IF
End If
Next
'見つけたかチェック
If objIE Is Nothing Then
'IE起動
Set objIE = WScript.CreateObject("InternetExplorer.Application")
call IEExec(objIE)
End If
'ユーザー-ID / パスワード
'call SetVal(objIE, strUserID, strUID)
'call SetVal(objIE, strPassID, strPassword)
'待つ
'WScript.Sleep 3000
'ログイン
'objIE.Document.getElementById("login-btn").Click
set objA = objIE.document.getElementsByTagName("INPUT")
For n = 0 To objA.Length - 1
If objA(n).id = "button_clear" then
objA(n).click
Exit For
End If
Next
set objIE = nothing
'-----------------
'IE起動
sub IEExec(byVal objIE)
objIE.left = 0
objIE.top = 0
'objIE.FullScreen = True
objIE.Visible = True
objIE.Navigate strWeb
'IEの表示完了を待つ
While objIE.ReadyState <> 4 Or objIE.Busy = True
WScript.Sleep 100
Wend
'objIE.width = objIE.Document.parentWindow.screen.availwidth
'objIE.height = objIE.Document.parentWindow.screen.availheight
end sub
'-----------------
'入力
sub SetVal(byVal objIE, byVal strID, byVal strVal)
objIE.Document.getElementsByName(strID).Item(0).Value = strVal
end sub