Results 1 to 2 of 2

Thread: Problem with trying to convert this vbscript into vb that I can use in Visual Studio

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2013
    Posts
    4

    Cool Problem with trying to convert this vbscript into vb that I can use in Visual Studio

    I'm trying to make an auto-form filler. I have a vbscript I am using that works, but I am having trouble converting it so I can use it in Visual Studio with a Visual Studio web browser instead of IE.

    VBscript (works) code:
    Set IE = CreateObject("InternetExplorer.Application")
    intHighNumber = 193949
    intLowNumber = 1

    For i = 1 to 5
    Randomize
    intNumber = Int((intHighNumber - intLowNumber + 1) * Rnd + intLowNumber)
    Next
    s = cstr(intNumber)
    set WshShell = WScript.CreateObject("WScript.Shell")
    IE.Navigate "INSERTURL&resize,128px"
    IE.Visible = True
    Wscript.Sleep 1000
    IE.Document.All.Item("AVALUE").Value = "6"
    IE.Document.All.Item("AVALUE1").Value = "2"
    IE.Document.All.Item("AVALUE2").Value = "2000"
    IE.Document.All.Item("AVALUE3").Value = s
    IE.Document.All.Item("pass").Value = "nono2355"
    IE.Document.All.Item("MaleBtn").Click
    IE.Document.All.Item("passConfirm").Value = "nono2355"
    IE.Navigate "AURL2&resize,128px"
    WshShell.AppActivate "IE"
    WshShell.SendKeys "{ENTER}"


    VB (Failed) code:
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Dim intHighNumber = 193949
    Dim intLowNumber = 1

    For i = 1 To 5
    Randomize()
    Dim intNumber = Int((intHighNumber - intLowNumber + 1) * Rnd() + intLowNumber)
    Next
    Dim s = CStr(intNumber)
    WshShell = WScript.CreateObject("WScript.Shell")
    WebBrowser1.Navigate "AURL&resize,128px"
    WebBrowser1.Visible = True
    Wscript.Sleep 1000
    WebBrowser1.Document.All.Item("AVALUE").Value = "6"
    WebBrowser1.Document.All.Item("AVALUE1").Value = "2"
    WebBrowser1.Document.All.Item("AVALUE2").Value = "2000"
    WebBrowser1.Document.All.Item("AVALUE3").Value = s
    WebBrowser1.Document.All.Item("pass").Value = "nono2355"
    WebBrowser1.Document.All.Item("MaleBtn").Click()
    WebBrowser1.Document.All.Item("passConfirm").Value = "nono2355"
    WebBrowser1.Navigate("AURL2&resize,128px")
    WshShell.AppActivate "IE"
    WshShell.SendKeys "{ENTER}"

    End Sub

  2. #2

    Thread Starter
    New Member
    Join Date
    Jun 2013
    Posts
    4

    Re: Problem with trying to convert this vbscript into vb that I can use in Visual Stu

    Any suggestions.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width