Results 1 to 29 of 29

Thread: form filler

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    17

    form filler

    Can someone help me write some code to add to my simple web browser?

    Upon reaching the designated site, the code needs to tab to each form input window and populate it with text (which is pre-stored as variables).

    I can get the text data pre-stored and navigate to the site, but what code do I need to "tab" "print" "tab" "print" "tab" "print" ... to fill the form?

    thanks in advance!

    -pg

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: form filler

    Welcome to the forums.

    Take a look at this example. There is a better way to do what you want.
    Post back if you have any questions.
    Last edited by dglienna; Jun 19th, 2005 at 12:59 AM.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    17

    Re: form filler

    Thanks for the help ! I'll be checking it out and let you know .

    I'm so busy it may take me some time.

  4. #4
    Fanatic Member vbPoet's Avatar
    Join Date
    Feb 2005
    Location
    Searching ..
    Posts
    669

    Re: form filler

    hope it will help..
    because it is using document object model ..
    so will be better..

  5. #5

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    17

    Re: form filler

    I am DIGIN' it NOW baby ! ! !

    I'm workin' it and I can see the light at the end already ! !

    Man I'm cookin' like its 2999 !!!!!

  6. #6

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    17

    Re: form filler

    Its been 3 days since may initial post and as of right now I can say the help I received has been a smashing success. A veritable Grand Slam !

    It is incredible, the power of knowledge of a little bit of code, ahhh... the sweet science.

    I rate your help with the highest award this forum avails.

    thanks again,
    -pg

  7. #7

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    17

    Re: form filler

    The help I received from this forum put me on the right track. it took only a couple of days form to make great progress on my project. However, why is Microsoft sabotaging me every step of the way?

    Have I been away from VB so long that I'm missing stuff thats come along in the past few years? I downloaded and installed the VB service pack 6 but I'm still having problems.

    My program it works but when I close VB and reload, microsoft kills it in action. The dialog box pops up ....... "Visual Basic has encountered a problem and needs to close. We are sorry for the inconvenience .. blah blah blah ..."

    Then its ask me to send the report created by pressing the button. No matter if I choose send or don't send, VB folds up and I have rewrite portions of the program again.

    What the heck is going on?

  8. #8
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: form filler

    Post some of your code. You probably have a simple mistake. Paste it in so that we don't crash our IDE's!

  9. #9

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    17

    Re: form filler

    OK , at the thought of posting all that code I was about to faint so I sought to boil it down to the essentials, and lo ! I can't even reload the basic browser without it crashing.

    I think I may have trouble naming the project, group and form.

    With one form with WebBrowser1 placed in the center and the start up code :

    Private Sub Form_Load()
    WebBrowser1.Navigate "http://www.mapquest.com"
    End Sub

    When I run this it works. Then I save it, close out VB and try to reload and BANG, it crashes!

  10. #10
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: form filler

    Quote Originally Posted by pg23230
    The help I received from this forum put me on the right track. it took only a couple of days form to make great progress on my project. However, why is Microsoft sabotaging me every step of the way?

    Have I been away from VB so long that I'm missing stuff thats come along in the past few years? I downloaded and installed the VB service pack 6 but I'm still having problems.

    My program it works but when I close VB and reload, microsoft kills it in action. The dialog box pops up ....... "Visual Basic has encountered a problem and needs to close. We are sorry for the inconvenience .. blah blah blah ..."

    Then its ask me to send the report created by pressing the button. No matter if I choose send or don't send, VB folds up and I have rewrite portions of the program again.

    What the heck is going on?
    Dont' know why but I suggest reinstalling VB.
    BTW make it a habit to save ur work before running. That saves a lot of work in unfortunate conditions.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  11. #11

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    17

    Re: form filler

    I am totally baffled by all this.

    I pay Microsoft for a program, spend hours, days, weeks trying to use it. They kill my work, and give no help in rectifying the problem.

    I have reinstalled VB, reloaded service pack 6, and still can't save a single form with WeBbrowser and one simple line of code.

    Do I have to get VB.net to do this simple program? Why can't they upgrade my VB?

  12. #12
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: form filler

    Can you run other projects? With the webbrowser?

  13. #13
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: form filler

    can you save project / forms if no webbrowser??
    did you try with out doing the SP6 upgrade ?

    pete

  14. #14

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    17

    Re: form filler

    Thanks for the advice. I'll have check them out tomorrow.

    Must get some rest now.
    -pg

  15. #15

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    17

    Re: form filler

    Well now I've tried the above ... removed SP6, re-created the basic other half of project without the browser, saved it ..no problem.

    Its that darned browser control thats killing me... and I'm closed to DEAD too ! I would probably feel better if I could just get my hands around Gates' neck.

    Isn't it correct to use the "MS Internet Controls" under "Project, Components"? It works, it even compiles and the exe works. But the stupid VB won't let me reload if I include the browser.

    -pg

  16. #16
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: form filler

    there is a fix for this but i can't remember what it was, it is something to do with the url but i don't remember now, i know you can open the form in notepad, do a small edit then it is fixed.

    i will try to dream about it for you, if i do i will post again in the morning
    also try searchs in the forum, cos i think it was on here before

    pete

    i think
    if you open the form.frm in notepad and edit the line
    Location = "http:///"
    to as above, it will fix your problem you may have to do it each time, if you do it a lot it would be easy to write a program to fix it each time.
    Last edited by westconn1; May 29th, 2005 at 12:15 PM.

  17. #17

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    17

    Re: form filler

    Hey Pete, that worked !

    My question now ... how could a little thing like that escape those geniuses at MS?

    With all the upgrades , service packs etc. , they couldn't put that in?

    Thanks a million, I feel liberated now !

    -pg

  18. #18
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: form filler

    i am glad i got it right, i really wasn't sure. i can't remember what causes it in the first place, i think we might have figured it out, but once it starts to do it it seems to stay with you.
    i think, you can actually write code in the form to edit itself would you believe as once the form is loaded it is not open, until you save it.

    pete

  19. #19

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    17

    Re: form filler

    My project has been coming along very well until I encountered another potential killer today.

    The site which hosts the forms I need to fill has a split format. At the top of the page there is a header which holds the page address window. The lower 4/5ths of the page has the input boxes. This portion of the page has its on scroll bar which allows the header (with it submit button) to remain visible. My program won't fill the inputs since “I think” the header portion (which “owns” the page address) seems to be unaware there that the sub-page has inputs. The header seems to only know how to submit the subpage. HOWEVER, a simple right-click on sub-page, view its properties reveal the sub-pages' address. Then a run of the program directed at the subpage address works fine. No header, just the form portion where I can fill all inputs nice and clean.

    The problem is, how do I submit the page? I think I have to find a way to make the form-filler leap over the header and find the sub-page inputs. Otherwise, without the header page addressed, I won't be able to submit. And even if I did find a way, I believe the “submit” button may carry my ”legitimate” session id. So If I create my on stand-alone ”submit” button I'll have to figure out how to embed credentials within.

    Could my imagination be running away? somebody please calm my fears!

  20. #20
    Fanatic Member
    Join Date
    Jan 2005
    Location
    In front of this pc.
    Posts
    580

    Re: form filler

    Take a look at the Document Object Model (DOM). The "subpage", as you call it, actually sounds like a frame - you should be able to either load that frame direct or access it's components by "document.frames(x)". There's some pretty good code on the DOM floating around the forum (link I was gonna post here is now busted..sorry)

  21. #21
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: form filler

    Here is an example, with a text file that shows how to get frames.

    http://www.vbforums.com/attachment.p...chmentid=37152

  22. #22

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    17

    Re: form filler

    Ok, so it is a "frame" within the page that I have to figure out how to direct my "filler" program. I haven't looked at the zip file yet, will have to get home later today for that. But you are saying "all is not lost", my job can be done ?

    I can't wait to check it out!

    -pg

  23. #23
    Lively Member
    Join Date
    Nov 2002
    Posts
    123

    Re: form filler

    You might consider loading the Firefox browser. If you load the diagnostic tools or whatever they call it, it gives you their "DOM" inspector. This is a great tool for inspecting the DOM structure and finding where the various elements you are trying to address or populate are located.

  24. #24
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: form filler

    Hey. That's a great feature that I didn't even know about!

  25. #25

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    17

    Re: form filler

    OK, I tried to use the snippet code to make the program recognise the frame but I couldn't figure it out.

    for the lines :

    Set colDocuments = New Collection
    colDocuments.Add webPage.Document

    I figured I needed a tag for the frame to replace the above "webPage". But I didn't find anything that worked.

    I also took a look at the Firefox browser. How would I assign it to the program? It doesn't seem to have been included in the VB Project Components.

    -pg

    -pg

  26. #26
    Lively Member
    Join Date
    Nov 2002
    Posts
    123

    Re: form filler

    As far as I know you cannot add the Firefox browser into a VB program, you are stuck with WebBrowser. Firefox just gives you a chance to visually decipher the DOM structure and to find the elements you ar looking for.

    In Firefox, you will see a listing of the DOM objects, many of which are collections of various element types. Within your program, create the subroutine:

    Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)

    end sub

    Within this subroutine, you have the HTML document in pdisp.document. By playing with the various elements and collections you can see visually in Firefox, you can test your code to dig down into the collections aqnd find what you need to interact with. To me the DOM is extremely confusing and poorly designed, but eventually you can find what you need.

    Search the forums for DOM, for examples of using the collections and referencing elements

  27. #27

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    17

    Re: form filler

    Folks I appreciate all the good help and love being passed around here but I'm just not getting the DOM deal. Perhaps if I could spend a little more time studying up I might catch up. However, that article by theVader: "Using the DHTML Document Object Model" is just a little too much for me right now.

    I'm wondering if someone might illustrate a solution to my project if I post a link to a similar, simpler site?

    If I could just see what needs to be done I think I could adapt the technique for my project. I cannot post the actual site because it is inhouse only.

    thanks
    -pg

  28. #28
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: form filler

    Find a valid item number on EBAY and plug it in. I don't know if the one here is still available. It should show you what DOM can accomplish. This was done mostly by TheVader when someone asked.
    Attached Files Attached Files
    Last edited by dglienna; Jan 29th, 2006 at 05:29 PM.

  29. #29

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    17

    Re: form filler

    The Image Parser is an interesting learning tool but I haven't seen how it can help with my task yet.

    My task seems simple to me but I don't understand the specific use of "tags" or object identifying to make the form filler populate the frame.

    As I said before, if I direct the browser to the form address the program works ok. But I need to load the page with the header frame in order to push the "submit" button and navigate to other pages.

    My question is what does my code need to overlook the header addressing and jump down to the frame before populating?

    -pg

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