none
Looking for some help getting a program to interact with IE RRS feed

  • Question

  • Hello VB forum!

    I'm trying to build a simple application to use that will streamline our ticket input system at work.  I have created several categories of tickets and would like to be able to click a button, have that open a web page and prefill several text boxes and drop down menus.  I don't want it to submit or close so that the ticket can be reviewed manually before doing so.

    I haven't had any luck finding any recent compatible code to start from.  Most forum posts I've seen about the topic are very dated and the commands are no longer valid.

    Thanks for any assistance!

    Thursday, November 2, 2017 9:10 PM

All replies

  • Id the web page yours or a vendor?

    If the page is yours then you should consider a REST service to populate elements. Not an easy task if you have not done it before but had to mention it.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Thursday, November 2, 2017 9:27 PM
    Moderator
  • Please be clear about what you need.

    • Is "a simple application" a desktop application or a web application?
    • When you say "click a button, have that open a web page" do you mean a form that gets data to be put into another form? If so then why two forms? Explain that.
    Since you can't find relevant forum posts, have you tried looking at the documentation? If you know what you need to do then you are more likely to figure out how to do it. These forums can be very helpful when you need help with specifics. You are right, it is often not possible to find it all done for us in forum posts.


    Sam Hobbs
    SimpleSamples.Info

    Friday, November 3, 2017 1:18 AM
  • Hello VB forum!

    I'm trying to build a simple application to use that will streamline our ticket input system at work.  I have created several categories of tickets and would like to be able to click a button, have that open a web page and prefill several text boxes and drop down menus.  I don't want it to submit or close so that the ticket can be reviewed manually before doing so.

    I haven't had any luck finding any recent compatible code to start from.  Most forum posts I've seen about the topic are very dated and the commands are no longer valid.

    Thanks for any assistance!

    The problem with simple applications is that they are enormous difficult to make. Your kind of applications are also very less to trust because a webpage format can change any minute if it is not your own. 

    Success
    Cor

    Friday, November 3, 2017 6:26 AM
  • I apologize let me be a little more specific.

    I have a form with multiple buttons on it, each one copies specific text templates to the clipboard to paste into our ticketing system.  Basically so we don't have to type out the same thing every time we get a call to unlock a user account or something repetitive like that.

    We (my company) manage the website I'm looking to use here.

    What I'd like to do is have each button open a specific URL that links to our "new ticket" page to input a new ticket and prefill a couple of drop down menu's and text boxes.  Each ticket we submit needs specific information to be filled out and it's the same every time, so it would save us a huge amount of time if we could have the program I made open a browser with all this information already prefilled.

    I had found some code previously that did this, but the syntax was outdated and didn't work.  I'll paste that below.

    Dim ieApp As InternetExplorer
    Dim iePage As HTMLDocument
    Set ieApp = New InternetExplorer
    ieApp.Visible = True
    ieApp.Navigate "URLHERE"
    'wait for page to load
    Do Until ieApp.ReadyState = READYSTATE_COMPLETE
    Loop
    Set iePage = ieApp.Document
    iePage.Forms(0).Item("login").Value = "LOGIN"
    iePage.Forms(0).Item("key").Value = "PASSWORD"
    iePage.Forms(0).Item("clcode").Value = "CLIENT_CODE"
    iePage.Forms(0).Item("button1").Click

    This is something like what I'm looking for, to target specific forms and fill them with specific information that will be the same each time.

    Friday, November 3, 2017 1:35 PM
  • Phoenix,

    This can be done (and is done normally) smarter.

    Create a webservice and let you webpage consume that. Than your winforms or whatever application even if it is mobile can consume that as well. 

    https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-create-a-basic-wcf-web-http-service

    The code is in C# but it is so basic that if you remove the semicolons you have VB code(in the sample you have to remove some parenthesizes and change the few closing ones to "end sub")


    Success
    Cor

    Friday, November 3, 2017 3:50 PM
  • That code uses ReadyState to wait for it to be READYSTATE_COMPLETE in a loop. The problem is not that it is old; the problem is that it is not good to begin with. The DocumentComplete event is the right way to be notified that ReadyState is READYSTATE_COMPLETE. See my article Introduction to Web Site Scraping.

    That sample code you showed is dated because IE is dated. Microsoft has replaced it with Edge. However if you think that the modern solution is easier or more powerful for your purposes then you misunderstand. Edge is much more limited because it attempts to be more secure. You can develop a UWP program that uses Edge but you will be disappointed if you want it to be easier than IE to access the HTML. If you want to evaluate that further then say so.

    As others have said, the more modern solution is for your host to provide an API that is used from a web service, or something like that. My terminology might not be correct. I think that some hosts don't support that so you might need to find another host, such as Azure.



    Sam Hobbs
    SimpleSamples.Info

    Friday, November 3, 2017 4:49 PM
  • I apologize let me be a little more specific.

    I have a form with multiple buttons on it, each one copies specific text templates to the clipboard to paste into our ticketing system.  Basically so we don't have to type out the same thing every time we get a call to unlock a user account or something repetitive like that.

    We (my company) manage the website I'm looking to use here.

    What I'd like to do is have each button open a specific URL that links to our "new ticket" page to input a new ticket and prefill a couple of drop down menu's and text boxes.  Each ticket we submit needs specific information to be filled out and it's the same every time, so it would save us a huge amount of time if we could have the program I made open a browser with all this information already prefilled.

    I had found some code previously that did this, but the syntax was outdated and didn't work.  I'll paste that below.

    Dim ieApp As InternetExplorer
    Dim iePage As HTMLDocument
    Set ieApp = New InternetExplorer
    ieApp.Visible = True
    ieApp.Navigate "URLHERE"
    'wait for page to load
    Do Until ieApp.ReadyState = READYSTATE_COMPLETE
    Loop
    Set iePage = ieApp.Document
    iePage.Forms(0).Item("login").Value = "LOGIN"
    iePage.Forms(0).Item("key").Value = "PASSWORD"
    iePage.Forms(0).Item("clcode").Value = "CLIENT_CODE"
    iePage.Forms(0).Item("button1").Click

    This is something like what I'm looking for, to target specific forms and fill them with specific information that will be the same each time.

    Well if you are using a Windows Forms app there's code here pasting an image from clipboard into a picturebox for adding a clipboard listener to the app so data can be auto retrieved from the clipboard.

    If the Windows Forms app uses I.E. control for displaying the WebPages for the URL's in question regarding the New Ticket page(s) (don't know why there would be multiple URL's for that) then you could use a Tab Control for placing multiple I.E.s within knowing which Tab Page would be for which new ticket URL that info from the clipboard needs to be pasted in.

    And I suppose that navigating the WebPage(s) programmatically is possible even using send keys for a focused I.E. control or something in order to navigate the drop down menus and textbox's on the webpage. There's probably other methods for that available.

    But I'm not much up on all that.

    And for C# to VB conversion you can use Telerik for Cor's recommendation.


    La vida loca

    Friday, November 3, 2017 6:03 PM
  • Well if you are using a Windows Forms app there's code here pasting an image from clipboard into a picturebox for adding a clipboard listener to the app so data can be auto retrieved from the clipboard.

    It is my understanding that the requiremt is to do both of putting data into webpages and getting data from them. In that case it is more complicated. You need to have a way to ensure the data is put into the right place and of knowing where the data is coming from. For determining where the data is coming from, if the data is pasted in such a way that a HTML fragment is one of the clipboard formats then it is possible to parse the HTML fragment to determine the URL the data was pasted from and the HTML. I have done that; specifically for the ISS Spot The Station pages. After everything is done, I am certain that the developer would undersand it would have been easier to use the website scraping techniques described in my article.

    And I suppose that navigating the WebPage(s) programmatically is possible even using send keys for a focused I.E. control or something in order to navigate the drop down menus and textbox's on the webpage. There's probably other methods for that available.

    The other methods are described in my article. Typically sending keys to an application becomes more complicated than the programmer anticipated. Using the DOM seems complicated but after everything is done, it is more reliable than sending keys. And sending keys does not solve the problem of getting the data.



    Sam Hobbs
    SimpleSamples.Info


    Friday, November 3, 2017 6:34 PM