teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

4

ちょうせい

2021/11/26 07:45

投稿

yambejp
yambejp

スコア117906

answer CHANGED
@@ -24,7 +24,7 @@
24
24
  WScript.sleep 5000
25
25
 
26
26
  set i=oIE.Document.getElementsByName("login")
27
- if i.item.length=0 then
27
+ if i.length=0 then
28
28
  msgbox ("エラーです")
29
29
  oIE.quit()
30
30
  exit sub

3

調整

2021/11/26 07:45

投稿

yambejp
yambejp

スコア117906

answer CHANGED
@@ -2,21 +2,29 @@
2
2
 
3
3
  # sample
4
4
 
5
+ sample.html
6
+ ```HTML
7
+ <form>
8
+ <input type="image" name="login" src="./images/login.gif" border="0" title="ログイン">
9
+ </form>
10
+ ```
11
+
12
+
5
13
  sample.vbs
6
14
  ```VBS
7
15
  main()
8
16
  sub main()
9
- URL="http://exsample.com/"
17
+ URL="http://localhost/sample.html"
10
18
 
11
19
  Set WSHShell=Wscript.CreateObject("Wscript.Shell")
12
20
  set oIE=Wscript.CreateObject("InternetExplorer.application")
13
21
  oIE.navigate2(URL)
14
22
  oIE.visible=true
15
23
 
16
- IEBUSY(oIE)
17
- set f=oIE.document.forms(0)
24
+ WScript.sleep 5000
25
+
18
26
  set i=oIE.Document.getElementsByName("login")
19
- if(f IS Nothing) then
27
+ if i.item.length=0 then
20
28
  msgbox ("エラーです")
21
29
  oIE.quit()
22
30
  exit sub
@@ -25,10 +33,5 @@
25
33
  i.item(0).click()
26
34
 
27
35
  end sub
28
- function IEBUSY(oIE)
29
- Do Until oIE.Busy = False
30
- WScript.sleep(250)
31
- Loop
32
-
33
- end function
34
- ```
36
+ ```
37
+ ※テスト用に修正

2

ちょうせい

2021/11/26 07:16

投稿

yambejp
yambejp

スコア117906

answer CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  # sample
4
4
 
5
+ sample.vbs
5
6
  ```VBS
6
7
  main()
7
8
  sub main()
@@ -29,4 +30,5 @@
29
30
  WScript.sleep(250)
30
31
  Loop
31
32
 
32
- end function
33
+ end function
34
+ ```

1

chousei

2021/11/26 06:20

投稿

yambejp
yambejp

スコア117906

answer CHANGED
@@ -1,1 +1,32 @@
1
- 状況がよくわかりませんがobjButton[0]とかでは?
1
+ 状況がよくわかりませんがobjButton[0]とかでは?
2
+
3
+ # sample
4
+
5
+ ```VBS
6
+ main()
7
+ sub main()
8
+ URL="http://exsample.com/"
9
+
10
+ Set WSHShell=Wscript.CreateObject("Wscript.Shell")
11
+ set oIE=Wscript.CreateObject("InternetExplorer.application")
12
+ oIE.navigate2(URL)
13
+ oIE.visible=true
14
+
15
+ IEBUSY(oIE)
16
+ set f=oIE.document.forms(0)
17
+ set i=oIE.Document.getElementsByName("login")
18
+ if(f IS Nothing) then
19
+ msgbox ("エラーです")
20
+ oIE.quit()
21
+ exit sub
22
+ end if
23
+
24
+ i.item(0).click()
25
+
26
+ end sub
27
+ function IEBUSY(oIE)
28
+ Do Until oIE.Busy = False
29
+ WScript.sleep(250)
30
+ Loop
31
+
32
+ end function