09-08-2011 05:00 PM
Hello,
I am trying to acquire image from an Encoder's IP address, but I'm facing some problems:
1. Once the Ip address is loaded, the web page asks for authentication (user and password), so I don't know how I can send this information to IE through Labview.
2. Once one has logged in, the web page shows a window with ActiveX controls in which the image from a camera is acquired and can be zoomed in and out, or saved. I need to saved the image, so I would need to send an instruction to the page as if I had clicked in the "Save" icon. I wonder if I can send some sort of instructions telling "buttonX=ON" or using the coordinates in the window to simulate a click or sth.
I tried the "AutoIT Example.vi" and changed it to call internet explorer and then sending the URL, and I also tried the "open_browser_send_URL.vi" but as I said, I'm stuck in the authentication part.
I would greatly appreciate any suggestions you may have to deal with this problem.
Thanks
Solved! Go to Solution.
09-09-2011 08:26 AM
I have used simulate_keybaord.vi with some success to enter data into webpage forms. As far as the button you want to press, if there's a function key that does the same thing, or <alt>+Save, or something where the keyboard can get to that button, then you can do that also.
09-09-2011 08:46 AM
Good morning, Kalinikos
I attach some links below, guidelines that can be made. Any questions please contact us.
http://zone.ni.com/reference/en-XX/help/371361G-01/lvhowto/send_email_from_vi/
Sending HTML Emails in LabVIEW
https://decibel.ni.com/content/docs/DOC-9233
http://zone.ni.com/devzone/cda/epd/p/id/3708
Sincerely,
09-09-2011 01:11 PM
When you attempt to log in to the web page, does it use a form on the web page, or does it pop up a separate authentication dialog? If it's a form within the web page, you may be able to do this using Internet Explorer and LabVIEW. The details will depend on your web page - if it uses a form submit then it should work, if it relies on Javascript then it may be more trouble. You'll have to look at the web page source to identify the correct form elements. I'm attaching a VI that demonstrates how I handled this in one previous project. The VI expects that you'll pass in a reference to a WebBrowser object.
To save the image, you may again be able to dig into the HTML source of the web page to find out what method of the ActiveX object is being called. You can then obtain a reference to that ActiveX object, cast it to the appropriate type, and call that same method from your VI. I've done this before for a web-based label-printing application, as shown in the attached image. In this case the ActiveX component is called TidAx1 (which I found from looking at the source of the web page). After obtaining a reference to the ActiveX component within the web page, the LabVIEW programmer has access to all its properties and methods.
@Mauro Vera wrote:
I attach some links below, guidelines that can be made. Any questions please contact us.
Sometimes it's really hard to know if you NI people (so I'm assuming, from the blue username) actually read the questions before you attempt to answer them... why would you attach links about sending email when the poster asked about reading data from a web page?
09-09-2011 04:49 PM
Hello nathand,
It is a form within the web page that asks for user and password. Thank you very much for your answer. l'll try it out
09-12-2011 01:56 PM
The web login part is working thanks to nathand's vi. Now, to simulate the click I'm confused about using "Property Node" and "Invoke Node". How do I know how far I have to get using these elements to get to the element I want to get to. Is there a guide to do this?, to know if I need a IHTMLElement, ElementCollection or whichever function I would need to use.
Thank you very much for your time.
09-12-2011 02:09 PM - edited 09-12-2011 02:09 PM
There's a lot of documentation on the properties and methods available in Internet Explorer through MSDN. You'll at least need to dig as far as I did in the image I posted (get a reference to the IHTMLElementCollection of all elements on the page, then identify the correct element by name). If you need help, I'm willing to take a look, but you'll need to post the source of the relevant web page (View Source in your web browser, then copy/paste or save to a new file and upload that).
09-12-2011 03:57 PM
Thanks again for your time. I took a screenshot of the icon that I have to click on and the code that the browser shows. I guess I would have to call the on_snapshot() function but I am not sure how to do that.
Thanks
09-12-2011 04:08 PM
I don't see any reference to an ActiveX control there, just Javascript. Why did you mention an ActiveX component in your original post? I can't do anything with that screenshot; I'd need the entire web page source so I can see what the javascript functions are doing. However, since the image seems to be displayed without the assistance of any ActiveX control, you should be able to set the browser to navigate directly to the image (rather than to the web page in which it is embedded), and from there I would guess you can retrieve or save the image directly in LabVIEW, unless there's some particularly good reason to go through the web page to do it.
09-12-2011 04:35 PM
I thought they were ActiveX controls. Attached is the web page saved as .mht (I hope that is the full source code). Regarding what you said of taking the picture, I had thought taking it the same way I do it manually, but taking it directly from LabView totally makes sense to me. The problem is that I don't know how to do neither of those. Once again, thank you for your help and please pardon me if I'm not being perfectly clear.