質問編集履歴
5
コード修整
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,6 +20,8 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
+
Set WSHShell=Wscript.CreateObject("Wscript.shell")
|
24
|
+
|
23
25
|
Set objIE = WScript.CreateObject("InternetExplorer.Application")
|
24
26
|
|
25
27
|
objIE.Visible = True
|
@@ -40,7 +42,9 @@
|
|
40
42
|
|
41
43
|
Sub Login(url, user, pass)
|
42
44
|
|
43
|
-
objIE.Navigate url
|
45
|
+
objIE.Navigate2 url
|
46
|
+
|
47
|
+
'set f=objIE.document.forms(0)
|
44
48
|
|
45
49
|
Call WaitIE(objIE)
|
46
50
|
|
@@ -82,21 +86,33 @@
|
|
82
86
|
|
83
87
|
end if
|
84
88
|
|
89
|
+
Call WaitIE(objIE)
|
90
|
+
|
85
91
|
'//ログインボタンクリック
|
86
|
-
|
87
|
-
Call WaitIE(objIE)
|
88
92
|
|
89
93
|
'objIE.Document.getElementsByTagName("login")(0).Submit
|
90
94
|
|
91
|
-
set objButton = objIE.Document.
|
95
|
+
set objButton = objIE.Document.getElementsByName("login")
|
96
|
+
|
97
|
+
if objButton.length=0 Then
|
98
|
+
|
99
|
+
'msgbox ("エラーです")
|
100
|
+
|
101
|
+
objIE.quit()
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
end if
|
92
106
|
|
93
107
|
'objButton(0).click
|
94
108
|
|
95
|
-
'objButton[SubmitForLogin()].submit
|
109
|
+
'objButton[WXPSubmitForLogin()].submit
|
96
110
|
|
97
|
-
objButton(f0).submit
|
111
|
+
'objButton(f0).submit
|
98
112
|
|
99
113
|
'objButton.f0.submit
|
114
|
+
|
115
|
+
objButton.item(0).click()
|
100
116
|
|
101
117
|
|
102
118
|
|
@@ -111,6 +127,8 @@
|
|
111
127
|
Call WaitIE(objIE)
|
112
128
|
|
113
129
|
End Sub
|
130
|
+
|
131
|
+
|
114
132
|
|
115
133
|
'*********************
|
116
134
|
|
4
コード追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -84,6 +84,8 @@
|
|
84
84
|
|
85
85
|
'//ログインボタンクリック
|
86
86
|
|
87
|
+
Call WaitIE(objIE)
|
88
|
+
|
87
89
|
'objIE.Document.getElementsByTagName("login")(0).Submit
|
88
90
|
|
89
91
|
set objButton = objIE.Document.f0.getElementsByName("login")
|
@@ -109,6 +111,24 @@
|
|
109
111
|
Call WaitIE(objIE)
|
110
112
|
|
111
113
|
End Sub
|
114
|
+
|
115
|
+
'*********************
|
116
|
+
|
117
|
+
'* IEのページがロードされるまで待つ関数
|
118
|
+
|
119
|
+
'***********************
|
120
|
+
|
121
|
+
Sub WaitIE(objIE)
|
122
|
+
|
123
|
+
Do While objIE.Busy Or objIE.ReadyState <> 4
|
124
|
+
|
125
|
+
WScript.Sleep(10000)
|
126
|
+
|
127
|
+
Loop
|
128
|
+
|
129
|
+
End Sub
|
130
|
+
|
131
|
+
|
112
132
|
|
113
133
|
```
|
114
134
|
|
3
コード修整
test
CHANGED
File without changes
|
test
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
|
28
28
|
|
29
|
-
Call
|
29
|
+
Call Login(url, user, pass)
|
30
30
|
|
31
31
|
|
32
32
|
|
2
コード一部修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -38,7 +38,7 @@
|
|
38
38
|
|
39
39
|
|
40
40
|
|
41
|
-
Sub
|
41
|
+
Sub Login(url, user, pass)
|
42
42
|
|
43
43
|
objIE.Navigate url
|
44
44
|
|
1
自前のコードを全部載せました
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,11 +4,113 @@
|
|
4
4
|
|
5
5
|
実はここか?と考えた箇所が該当していて、そこを動かす必要があるのか?
|
6
6
|
|
7
|
-
|
7
|
+
コードです
|
8
8
|
|
9
|
-
|
9
|
+
```VBS
|
10
10
|
|
11
|
+
user = "ユーザ"
|
12
|
+
|
13
|
+
pass = "パスワード"
|
14
|
+
|
15
|
+
url = "入りたいURL"
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
Dim objIE
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
Set objIE = WScript.CreateObject("InternetExplorer.Application")
|
24
|
+
|
25
|
+
objIE.Visible = True
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
Call GCIPLogin(url, user, pass)
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
' この後処理を行う予定の為、あえてコメント
|
34
|
+
|
35
|
+
'objIE.Quit
|
36
|
+
|
37
|
+
'Set objIE = Nothing
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
Sub GCIPLogin(url, user, pass)
|
42
|
+
|
43
|
+
objIE.Navigate url
|
44
|
+
|
45
|
+
Call WaitIE(objIE)
|
46
|
+
|
47
|
+
'//ログイン情報入力
|
48
|
+
|
49
|
+
'objIE.document.getElementsByName("inuserid")(0).Value = user
|
50
|
+
|
51
|
+
Set uname = objIE.Document.getElementsByName("inuserid")
|
52
|
+
|
53
|
+
if uname.Length > 0 Then
|
54
|
+
|
55
|
+
uname(0).Value = user
|
56
|
+
|
57
|
+
'Else
|
58
|
+
|
59
|
+
' msgbox "IDを入れる場所間違い"
|
60
|
+
|
61
|
+
' WScript.Quit
|
62
|
+
|
63
|
+
end if
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
'objIE.document.getElementsByName("inpasswd")(0).Value = pass
|
70
|
+
|
71
|
+
Set password = objIE.Document.getElementsByName("inpasswd")
|
72
|
+
|
73
|
+
if password.Length > 0 Then
|
74
|
+
|
75
|
+
password(0).Value = pass
|
76
|
+
|
77
|
+
'Else
|
78
|
+
|
79
|
+
' msgbox "PWを入れる場所間違い"
|
80
|
+
|
81
|
+
' WScript.Quit
|
82
|
+
|
83
|
+
end if
|
84
|
+
|
85
|
+
'//ログインボタンクリック
|
86
|
+
|
87
|
+
'objIE.Document.getElementsByTagName("login")(0).Submit
|
88
|
+
|
89
|
+
set objButton = objIE.Document.f0.getElementsByName("login")
|
90
|
+
|
11
|
-
objButton.click
|
91
|
+
'objButton(0).click
|
92
|
+
|
93
|
+
'objButton[SubmitForLogin()].submit
|
94
|
+
|
95
|
+
objButton(f0).submit
|
96
|
+
|
97
|
+
'objButton.f0.submit
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
'With objIE.document
|
102
|
+
|
103
|
+
'.f0.submit
|
104
|
+
|
105
|
+
'End with
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
Call WaitIE(objIE)
|
110
|
+
|
111
|
+
End Sub
|
112
|
+
|
113
|
+
```
|
12
114
|
|
13
115
|
と書いてますが、
|
14
116
|
|