Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
jap
- Posts: 6
- Joined: 27 May 2017 08:42
#1
Post
by jap » 07 Aug 2017 14:12
Hi,
I need help on this. Im running on Windows 10 / IE 11.
Here's a part of the script inside my batchfile.
I would like for the website to load first before running any other script, BUT in this case website is not loading but it already jumps to the "Page load successfully!"
Code: Select all
IELink= "http://www.google.com"
Set IE = CreateObject("InternetExplorer.Application")
Set X = CreateObject("Wscript.Shell")
IE.AddressBar = false
IE.MenuBar = false
IE.StatusBar = true
IE.ToolBar = false
IE.Visible = false
IE.Top = 0
IE.Left = 0
IE.FullScreen = true
W = IE.Width
H = IE.Height
IE.FullScreen = false
IE.Width = W
IE.Height = H
IE.Visible = true
IE.Navigate IELink
Function Wait(IE)
Do
WScript.Sleep 200
Loop While IE.ReadyState < 4 And IE.Busy
End Function
WScript.Echo "Page load successfully!"
WScript.quit
-
aGerman
- Expert
- Posts: 4678
- Joined: 22 Jan 2010 18:01
- Location: Germany
#2
Post
by aGerman » 07 Aug 2017 14:26
No idea what you're doing there. It's VBScript and actually can't be part of a batch script. Anyway, you defined a Wait function but you don't call it. It however doesn't make much sense to use a function in your case. Just remove the lines
Function Wait(IE)
and
End Function
and only keep the loop in between.
Steffen
-
Hackoo
- Posts: 103
- Joined: 15 Apr 2014 17:59
#3
Post
by Hackoo » 07 Aug 2017 18:31
First, this not a batch script , it's a vbscript
You can take a look at this
https://stackoverflow.com/questions/232 ... ve#tab-topAnd here is an example inspired from it :
Just copy and paste in your notepad with this name and execute it:
IE_Load.vbsCode: Select all
Option Explicit
Dim IE,IELink
Set IE = CreateObject("InternetExplorer.Application")
IELink= "https://www.google.com"
IE.AddressBar = false
IE.MenuBar = false
IE.StatusBar = true
IE.ToolBar = false
IE.FullScreen = true
IE.Visible = true
IE.Navigate IELink
On Error Resume Next
Do
If IE.ReadyState = 4 And IE.Busy Then
If Err = 0 Then
Exit Do
Else
Err.Clear
End If
End If
WScript.Sleep 10
Loop
On Error Goto 0
WScript.Echo "Page load successfully!"
WScript.quit