VBScript to Launch a website login - vbscript

I found this script online, I edited most of it.
It is able to enter username, and password on its down but it is not able to click login.
please help me fix
Here is login forum.
http://desistream.tv/en/index.shtml
Here is Script currently it is in IE but I will need to change it open in Google Chrome.
WScript.Quit Main
Function Main
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
IE.Navigate "http://desistream.tv/en/index.shtml"
Wait IE
With IE.Document
.getElementByID("login_username").value = "myusername"
.getElementByID("login_password").value = "mypassword"
.getElementByID("form").submit
End With
End Function
Sub Wait(IE)
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
End Sub
Sub IE_OnQuit
On Error Resume Next
WScript.StdErr.WriteLine "IE closed before script finished."
WScript.Quit
End Sub

Here is...
Call Main
Function Main
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
IE.Navigate "http://desistream.tv/en/index.shtml"
Wait IE
With IE.Document
.getElementByID("username").value = "myusername"
.getElementByID("pass").value = "mypassword"
.getElementsByName("frmLogin")(0).Submit
End With
End Function
Sub Wait(IE)
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
End Sub

If you look at the page source, you'll see that the actual <form> tag is called frmLogin, not login.

Related

VBScript error 80004005 check class in IE Document

I'm trying to set my script to sleep until a class is available in a website.
Set IE = createobject("internetexplorer.application")
strURL = "SomeUrl"
If IsNull(IE.Document.GetElementsByClassName("button")) Then
IE.navigate strURL
Do While (IE.Busy Or IE.ReadyState <> 4)
WScript.Sleep 100
Loop
End If
I've looked the error and it does not specify what is wrong so I have no idea.
"Unspecified Error" Code 80004005 at:
If IsNull(IE.Document.GetElementsByClassName("button")) Then
I've also tried:
Set Button = IE.Document.GetElementsByClassName("button")
If IsNull(Button) Then
IE.navigate strURL
Do While (IE.Busy Or IE.ReadyState <> 4)
WScript.Sleep 100
Loop
Set Button = IE.Document.GetElementsByClassName("buttonp")
End If
Same error. What's the problem?

How can I use an already open IE with VB Script? GetObject is not working

Below is the code block i used to open a new window. I tried using GetObject in place of Create Object as below. But did not work.
Set IE = GetObject("","InternetExplorer.Application")
'
Dim IE
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate "https://msn.com"
Do While IE.ReadyState <> 4
WScript.Sleep 1000
Loop
Set ElementCol = IE.Document.getElementsByTagName("a")
For Each Link In ElementCol
If Link.innerHTML = "News" Then
Link.Click
WScript.Sleep(6000)
Exit For
End If
Next
IE.navigate "https://msn.com"
This uses Explorer which used to do the internet.
Set objShell = CreateObject("Shell.Application")
Do
Set AllWindows = objShell.Windows
Count = 0
For Each window in AllWindows
msgbox window.locationname
' window.refresh2 3
Count = Count + 1
Next
If Count = 0 then Exit Do
Wscript.sleep 5000
Loop

How I can getelement on a "X" site and show in "Y" site mine

I want to capture just selected elements "Raid Boss Status", but I want capture just the raid boss that I say the name for. Example: I want to capture in this site just: Baium, Antharas and Valakas.
I want to capture just that Boss and save it in a new HTML or text file, and if possible I want separate Deads and Alives, and show the importants boss when Lives sending one warning to me see. When one importante boss respawn send to me one alert.
I had the login working.
WScript.Quit Main
Function Main
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
IE.Navigate "http://zionweb.l2cr.com/gamecpc6/index.php"
'IE.top = 0
'IE.left = 1370
'IE.Height = 770
'IE.Width = 650
Wait IE
With IE.Document
IE.Document.getElementsByName("username")(0).value = "CHECKBOSS"
IE.Document.getElementsByName("password")(0).value = "123456"
IE.Document.forms(0).submit
End With
End Function
Sub Wait(IE)
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
End Sub
Sub IE_OnQuit
On Error Resume Next
WScript.StdErr.WriteLine "IE closed before script finished."
WScript.Quit
End Sub

Login script works on WinXP but not on Win7

I have a script which logs in to a website. It works perfectly on IE 8 on Windows XP, but when I try the same script on Windows 7 with IE8 it doesn't work.
Can somebody fix this issue?
WScript.Quit Main
Function Main
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
IE.Navigate "URL"
Wait IE
IE.Document.form.[username].value = "" 'username
IE.Document.form.[password].value = "" 'Password
IE.Document.form.Submit()
End Function
Sub Wait(IE)
Do
WScript.Sleep 500
Loop While IE.ReadyState <> 4 OR IE.Busy
End SUb
Sub IE_OnQuit
On Error Resume Next
WScript.StdErr.WriteLine "IE closed before script finished."
WScript.Quit
End Sub

VB Script Set Statement

I need help with the following codes:
Dim IE
Dim UserName
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "http://www.nextview.com/index.php?country=my"
Do Until IE.ReadyState <> 3
Loop
Set UserName = IE.Document.getElementById("username") <----- ERROR
IE.Document.all.UserName.Value = "TESTING"
Set Login = IE.Document.getElementById("frmlogin")
Login.submit
Do Until IE.ReadyState <> 3
Loop
The codes are created to help me key in my username. But it has error at the location shown above.
Any idea how to solve this problem?
I think your waiting Do..Loop is not correct.
'Syntax notes:
Do Until [expression return False]
Do While [expression return True]
'So, you can use one of the next:
Do Until IE.readyState = 4
Wscript.Sleep 100
Loop
Do While IE.readyState <> 4
Wscript.Sleep 100
Loop

Resources