Palestinian Posted January 20, 2014 Share Posted January 20, 2014 Hello everyone I just registered in these forums, but i've always used them as a reference whenever I ran to something that I couldn't fix, and it helped me with fixing almost each and every single problem I ran into so far, but I didn't search for this priticilar problem because I'm guessing that the problem could be from my side (hardware, internet connection, etc.), but here it is anyway: I'm using ControlClick and ControlSend to automate some tasks for me and help me do my job a bit faster, my problem with it is that ControlSend works with some parts and it doesnt with others, here is a part of the code that contains working/not working parts: $hWnd = WinGetHandle("Health Assistance - Windows Internet Explorer") Sleep(500) ControlClick($hWnd, "", "Internet Explorer_Server1", "left", 1, 650,250) Sleep(200) ControlSend($hWnd,"","","JHA") ;~ Doesn't work. Sleep(500) ControlClick($hWnd, "", "Internet Explorer_Server1", "left", 1, 650,300) Sleep(500) ControlSend($hWnd,"","","B") ;~ Doesn't work. Sleep(200) ControlClick($hWnd, "", "Internet Explorer_Server1", "left", 1, 650,335) Sleep(500) ControlSend($hWnd,"","",$date) ;~ Doesn't work. Sleep(200) ControlClick($hWnd, "", "Internet Explorer_Server1", "left", 1, 677, 452) Sleep(500) ControlSend($hWnd,"","","Con") ;~ Doesn't work. Sleep(200) ControlClick($hWnd, "", "Internet Explorer_Server1", "left", 1, 662, 546) Sleep(500) ControlSend($hWnd,"","","JHAS") ;~ Works. Sleep(200) Each ControlClick clicks on a dropdown menu inside the webpage except the one before ControlSend($hWnd,"","",$date), that one clicks inside an input box, still, it doesn't work either. I just tested the script again to double check, and the ControlSend($hWnd,"","","JHAS") that works stopped working. Link to comment Share on other sites More sharing options...
BrewManNH Posted January 20, 2014 Share Posted January 20, 2014 You should try it with the _IE functions. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Palestinian Posted January 22, 2014 Author Share Posted January 22, 2014 (edited) Hello BrewManNH and sorry for the late reply, been busy with work lately (which is ironcly the reason why I'm facing this problem right now) I tried with some IE functions such as _IEAction and _IEFormGetObjByName, my problem is that I can't find anything in the page source that works with _IEFormGetObjByName or anything related to that. Now here is a tiny party of the page source that I need to be working on: <td align="left"> <select name="ctl00$ContentPlaceHolder1$DropDownListProvidedby0" id="ctl00_ContentPlaceHolder1_DropDownListProvidedby0" class="drop_downs" style="color:#0066CC;font-family:Arial,Verdana,Tahoma;font-size:11px;"> <option selected="selected" value="0">All</option> <option value="10180">AAD</option> <option value="10158">ACTED</option> <option value="10085">Al Bashir H</option> <option value="10146">AlSaqer Optics</option> I don't have any example scripts right now because I keep starting from scratch when something fails, but you still have the ControlSend part that I sent in my previous post which is the only thing I made that almost worked. EDIT: Re-wrote the 1st code I posted here and got it to work using the ControlFocus... Edited January 23, 2014 by Palestinian Link to comment Share on other sites More sharing options...
Palestinian Posted January 26, 2014 Author Share Posted January 26, 2014 Now that I've kinda fixed the ControlSend issue, I'm facing another one, it isn't really a big deal, but would be nice if i could solve it. The page I work on is aspx, its made for data entry and some dropdown menus once their values are changed it effects other dropdown menus, but in order for the other dropdown menu values to change the page must show a "Please Wait" in the middle of the page while graying out the rest of the page, once the menus are loaded with the new values the page gets enabled again. At the moment I'm using PixelCheckSum to wait for the page to load new menus values then continue the script, but that of course means that the page must be on top for the PixelCheckSum which is fine with me most of the time, my question here is; will _IELoadWait do the job instead of PixelCheckSum? considering that the page is already loaded and the changed values don't effect the page as a whole, I'm trying to get rid of the PixelCheckSum so i could search for another case while the script is filling the information for the previous case. Link to comment Share on other sites More sharing options...
Palestinian Posted January 29, 2014 Author Share Posted January 29, 2014 (edited) Alright so I've had enough time to test the _IEAttach and _IELoadWait, managed to attach to the window with no problems, but unfortunitly the IELoadWait doesn't work with the Please Wait pop out that I get in the webpage while the drop down menu values are being updated, it's not an actual pop out window, it's more like some kind of a scripting, is there any other way to wait for the drop down menu values to update beside pixelchecksum? Please keep in mind that my IE.au3 function skills are close to zero, please give me a simple example if you want to referee me to a function EDIT: Here is a screenshot of the Please Wait and the drop down menus Edited January 29, 2014 by Palestinian Link to comment Share on other sites More sharing options...
DaleHohm Posted January 30, 2014 Share Posted January 30, 2014 Looks like asynchronous updates and _IELoadWait is oblivious. You can often check for an element like that... figure out it's ID, check its visibility or content. Try to use DebugBar (see my sig) to get info about the Please Wait element and then use _IEGetObjById and perhaps _IEPropertyGet innerhtml. Dale Palestinian 1 Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Palestinian Posted January 30, 2014 Author Share Posted January 30, 2014 (edited) Looks like asynchronous updates and _IELoadWait is oblivious. You can often check for an element like that... figure out it's ID, check its visibility or content. Try to use DebugBar (see my sig) to get info about the Please Wait element and then use _IEGetObjById and perhaps _IEPropertyGet innerhtml. Dale Thank you for the suggestions, at least I have somewhere to start now, I'll check it out and hopefully get it to work, thanks again. Edited January 30, 2014 by Palestinian Link to comment Share on other sites More sharing options...
Palestinian Posted January 30, 2014 Author Share Posted January 30, 2014 (edited) Thanks to Dale I got the Please Wait object ID and everything, now I'm trying to set the value of some drop down menus (the ones that don't trigger the Please Wait) by using the _IEPropertyGet and _IEPropertySet, but failed to do so with the following message (Warning from function _IEGetObjById, $_IEStatus_NoMatch) DebugBar gave me the following for the "Procedures" drop down menu: <select name="ctl00$ContentPlaceHolder1$DropDownListProcedure" tabindex="-1" class="drop_downs" id="ctl00_ContentPlaceHolder1_DropDownListProcedure" style="color: rgb(0, 102, 204); font-family: Arial,Verdana,Tahoma; font-size: 11px;"></select> I tried with the following but failed: #include <IE.au3> Local $oIE = _IEAttach("Health Assistance") Local $drop = _IEGetObjById ($oIE, "ctl00_ContentPlaceHolder1_DropDownListProcedure") If Not _IEPropertyGet($drop, "Consultation") Then _IEPropertySet($drop, "Consultation", True) EndIf Using the _IEGetObjById I managed to find the Please Wait object and it worked like charm but it doesn't seem to be working with the drop down list, perhaps the drop down list ID is somehow treated differently? Edited January 30, 2014 by Palestinian Link to comment Share on other sites More sharing options...
Solution DaleHohm Posted January 30, 2014 Solution Share Posted January 30, 2014 Can't explain the NoMatch unless there are frames/iframes involved. For working with SELECT elements see _IEFormElementOptionSelect Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Palestinian Posted January 30, 2014 Author Share Posted January 30, 2014 (edited) Can't explain the NoMatch unless there are frames/iframes involved. For working with SELECT elements see _IEFormElementOptionSelect Dale Thank you again Dale for the quick reply. I don't think there are frames/iframes involved considering what DebugBar is telling me, the drop down menu is listed under the Forms, thats all. The following code displays the title of the window (to make sure it attached) and should display the value inside the drop down menu, but it returns 0, error... #include <IE.au3> Local $title = WinGetTitle("Health Assistance","") Local $oIE = _IEAttach($title) MsgBox(0,"",$title) Local $oForm = _IEFormGetObjByName($oIE, "aspnetForm") Local $oText = _IEFormElementGetObjByName($oForm, "ctl00$ContentPlaceHolder1$DropDownListProcedure") MsgBox(0, "Form Element Value", _IEFormElementGetValue($oText)) EDIT: Finally got it to work thanks to Dale's suggestions $oIE = _IEAttach("Health Assistance") $form = _IEFormGetObjByName($oIE, "aspnetForm") $providedthrough = _IEFormElementGetObjByName($form, "ctl00$ContentPlaceHolder1$DropDownListProvidedThrough") $provide = _IEFormElementOptionSelect($providedthrough, 10108, 1, "ByValue") Used the _IEFormElementGetObjByName and the _IEFormElementOptionSelect after getting the values by using DebugBar. Thanks a lot Dale, you are a life saver! Edited January 30, 2014 by Palestinian Link to comment Share on other sites More sharing options...
complexjunk Posted January 31, 2014 Share Posted January 31, 2014 Can't explain the NoMatch unless there are frames/iframes involved. For working with SELECT elements see _IEFormElementOptionSelect Dale If there were frames/iframes involved, what would cause the NoMatch? I've been having an >issue with newer IE.au3 versions no longer matching things in iframes. Link to comment Share on other sites More sharing options...
DaleHohm Posted January 31, 2014 Share Posted January 31, 2014 If there were frames/iframes involved, what would cause the NoMatch? I've been having an >issue with newer IE.au3 versions no longer matching things in iframes. Bad idea to spam a thread like this with an unrelated issue. Since you want to imply a nebulous problem, I'll respond here to clear this up for anyone who may wander in here in the future. There are no changes in the new IE.au3 as it relates to frames. Each frame is a document container, each document has it's own DOM (document object model). Therefore, you cannot reference an element in the DOM of a frame from another DOM - you must get a reference to the new DOM first. Because you cannot know by looking at the screen that there are multiple DOMs at play, people are often confused. Dale Palestinian 1 Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now