msnyder1112
New member
- Joined
- Feb 5, 2015
- Messages
- 3
- Programming Experience
- Beginner
Hey guys. I'm new to this forum. I'm desperate. I am a beginner with programming so please bear with me. I do have basic knowledge... I think! Lol.
I am writing a program to make my job easier. Basically, every morning I have to delete 14,000 - 15,000 records from an internal website that we use to upload data. The webpage shows 50 at a time so this can get pretty boring.
So far, my program points to the webpage, "checks all" and clicks delete. Now I get a message box that asks if I am sure I want to delete. I want it to automatically click "OK".
I used sendkey and it worked for a while but for some odd reason it stopped working.
Here's the code I currently have.
I am using Visual Studio Express 2013
I am writing a program to make my job easier. Basically, every morning I have to delete 14,000 - 15,000 records from an internal website that we use to upload data. The webpage shows 50 at a time so this can get pretty boring.
So far, my program points to the webpage, "checks all" and clicks delete. Now I get a message box that asks if I am sure I want to delete. I want it to automatically click "OK".
I used sendkey and it worked for a while but for some odd reason it stopped working.
Here's the code I currently have.
I am using Visual Studio Express 2013
VB.NET:
Public Class Form1 Dim oInputs As Object
Dim oWShell As Object
Private Sub btndel_Click(sender As Object, e As EventArgs) Handles btndel.Click
With CreateObject("InternetExplorer.Application")
.visible = True
.Navigate(txturl.Text)
Threading.Thread.Sleep(3000)
oInputs = .document.getElementsbytagname("a")
For Each elm In oInputs
If InStr(elm.innertext, "(Un)Check All") > 0 Then
elm.click()
Exit For
End If
Next
For Each elm In oInputs
If InStr(elm.innertext, "Delete") > 0 Then
elm.click()
Exit For
End If
Next
Do While .busy Or .readystate <> 4
Threading.Thread.Sleep(2000)
Loop
End With
Threading.Thread.Sleep(5000)
oWShell = CreateObject("wscript.shell")
Do Until oWShell.AppActivate("Message from webpage")
Threading.Thread.Sleep(2000)
Loop
Dim objShell = CreateObject("WScript.Shell")
Dim Success = objShell.AppActivate("Message from webpage")
Do Until Success = True
Threading.Thread.Sleep(1000)
Success = objShell.AppActivate("Message from webpage")
Loop
Application.DoEvents()
AppActivate("Message from webpage")
SendKeys.Send("{ENTER}")
End Sub
End Class