Jump to content

JohnGetzke

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by JohnGetzke

  1. Hello again, While the code from above has been working great on my primary machine when I kick it off by hand my real goal is to have a fully automated solution. This would require the use of a virtual machine periodically calling my script every few hours and checking for updates on a website. From what I have seen the ControlClick method is not able to run when a user is not technically sitting at and viewing the desktop. My guess is that even though the user is signed in the screen is still technically sitting behind the Windows lock screen and the clicks do not make it to the IE browser. A work around for full automation is to rely completely on ControlSend which can be run from the Task Scheduler. The code is actually much simpler considering what I have learned about the IE Handles and behavior involved. Here's the code for the Save button using Tabs: ;If you wait long enough then IE9 will automatically give focus to the Save As popup box Sleep(10000) Local $hIE = WinGetHandle("[Class:IEFrame]") Local $hCtrl = ControlGetHandle($hIE, "", "[ClassNN:DirectUIHWND1]") ControlSend($hIE ,"",$hCtrl,"{TAB}") ; Gives focus to Open Button Sleep(500) ControlSend($hIE ,"",$hCtrl,"{TAB}") ; Gives focus to Save Button Sleep(500) ControlSend($hIE ,"",$hCtrl,"{enter}") ; Submit whatever control has focus ;Give IE enough time to complete the download before proceeding Sleep(10000) As I noted, if you watch the behavior of the IE Save As popup you will notice that it will flash Orange once it is ready. This is what you need to wait for before sending your TAB and ENTER keys. I assume these hard coded sleeps will need to adjust depending on the download. I happen to be downloading a 45K CSV file with my code.
  2. Well I originally intended to go to the Save As option, however the X,Y coordinate feature was giving me some grief. I managed to hit the normal Save button and now think that button will actually work better. When you click the Save button IE automatically saves the content to your Downloads folder (C:users<userid>Downloads). It is much easier to write a some follow up logic to find that file and move it manually than it is to have IE save it directly to a specific location. Less screen clicks and faster that way, assuming your default downloads folder doesn't ever change. I measured the window with a ruler on my screen and then displayed the $apos[2] and compared the two. This allowed me to estimate approximately how many pixels across the screen the button was located from the edge of the control. I used $aPos[2] - 150 and it is working fine. Here's my code for the Save button: If WinActive("[Class:IEFrame]") Then Local $hIE = WinGetHandle("[Class:IEFrame]") Local $hCtrl = ControlGetHandle($hIE, "", "[ClassNN:DirectUIHWND1]") Local $aPos = ControlGetPos($hIE, "", $hCtrl) Local $aWinPos = WinGetPos($hIE) ; Check if the control is in the bottom 25% of the page. If ControlCommand($hIE, "", $hCtrl, "IsVisible") And $aPos[1] > .75 * $aWinPos[3] Then ControlClick($hIE, "", $hCtrl, "middle", 1, $aPos[2] - 150, $aPos[3] - 30) Sleep(500) ControlSend($hIE, "", $hCtrl, "{enter}") EndIf EndIf
  3. Hello, The code from DW1 works great for selecting the Cancel button on the IE Do you want to open or save xxxxx from zzzzz popup. How can I modify it so that it selects the Save As option? This one is tucked under the default Save option. I'm not familiar with the X, Y coordinate targeting system of ControlClick.
  4. Wonderful! Thanks for the quick response. Works great now.
  5. Hello, Noobie question here. How can I install AutoIT silently? I'm not referring to the autoIT scripts but the actual setup.exe from the downloads page of http://www.autoitscript.com/site/autoit/downloads/ I've tried -r to create a .iss file but cannot find it in %windir% or a custom f1 dir. tried -s -a -s. tried /q. Am I overlooking the obvious here? Thanks! John
×
×
  • Create New...