
Capel
Active Members-
Posts
56 -
Joined
-
Last visited
Everything posted by Capel
-
How do I determine which IE browser window is on top?
Capel replied to Capel's topic in AutoIt General Help and Support
Ok, JohnOne, I'll try it out. -
How do I determine which IE browser window is on top?
Capel replied to Capel's topic in AutoIt General Help and Support
Z-order is an ordering of overlapping two-dimensional objects, such as windows in a graphical user interface (GUI). In my case, the IE window I need to interact with may not be the currently active window (there could be a windows forms app on top), but I want to interact with the IE browser that is on top of all the other IE browser windows. -
How do I determine which IE browser window is on top?
Capel replied to Capel's topic in AutoIt General Help and Support
How do I get the Z order property of an IE window? I need the one on top. -
If I have multiple IE browser windows with similar titles, how do I determine which one is on top? I'm trying to iterate over all the open browser windows, but the code below shows 2 instances of each browser. They have different handles. This is strange... $lstViewers = WinList($sTitle) For $i = 1 to $lstViewers[0][0] ConsoleWrite("Title=" & $lstViewers[$i][0] & " Handle=" & $lstViewers[$i][1] & @CRLF) Next
-
Psalty, This did not work. The nature of the modal form is that the $oTbox is an object in the DOM all the time, it is just not visible/accessible all the time. So I still need some way to test if $oTbox is accessible without causing a COM error.
-
Thanks Psalty. I deleted the ExitLoop when I cleaned up the code to post in this thread, but good eye! Thanks again and I'll give this a shot.
-
Is "tag not loaded" a method of the DOM?
-
I'm automating an IE page and need to wait for the page to load before populating a textbox. One problem is the way IIS names the DOM objects dynamically. I have to search the DOM looking for a certain string. When I find it, I know I have the right object. $oForm = _IEFormGetObjByName ($oIE, "form1") $oElems = _IEFormElementGetCollection ($oForm) For $oElem in $oElems if StringInStr($oElem.id,"tblEditFilterstxtValue") > 0 Then $oTbox = $oElem EndIf Next _IEFormElementSetValue($oTbox, $sName) The way the page is designed, a modal popup appears, but if the popup has not loaded I get: _IEFormElementSetValue($oTbox, "") _IEFormElementSetValue(^ ERROR So I added _IEErrorHandlerRegister () to the top of my script. (But the custom error handler works sometimes and not others. Odd.) When it does work I get the following output: @@ Debug(704) : $ErrorOutput = --> COM Error Encountered in di.au3 ----> $ErrorScriptline = 2439 ----> $ErrorNumberHex = 80020009 ----> $ErrorNumber = -2147352567 ----> $ErrorWinDescription = ----> $ErrorDescription = Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus. ----> $ErrorSource = htmlfile ----> $ErrorHelpFile = C:\WINDOWS\system32\mshtml.hlp ----> $ErrorHelpContext = 0 ----> $ErrorLastDllError = 0 If I put a sleep() in the code, it will usually work, but depending on the connection it could fail. So with a fast internet connection (LAN) the sleep interval can be small, but across the web, it needs to be large. I end up with a sluggish app on the LAN in order to get the script to work over the web. So what I would like to do is put in a loop that checks for the object, but the script keeps crashing because the object is not visible/enabled or can't accept the focus. $iTimer = TimerInit() ; Timeout timer While 1 $o_Form = _IEGetObjByID($oIE, $oTbox.id) If Not @error And IsObj($o_Form) Then ExitLoop If TimerDiff($iTimer) >= 30000 Then MsgBox(16, "Error", "Timeout.") Exit EndIf Sleep(100) WEnd _IEFormElementSetValue($oTbox, $sName) This crashes at _IEGetObjByID($oIE, $oTbox.id) because $oTbox is not accessable. So how do I test to see if this object is accessable without having to sleep() and making my app sluggish? The second issue is the funky behavior of _IEErrorHandlerRegister (). I did find some reference to this behavior in the forum, but not much.
-
How to access a java_script variable?
Capel replied to Capel's topic in AutoIt General Help and Support
In case others are asking the same question, here is what the page HTML looks like: <script type="text/javascript"> //<![CDATA[ var id='ctl11_id_id'; var name='ctl11_name_name'; var location='ctl11_location_location'; var order_dateTime='ctl11_order_dateTime_order_dateTime'; //]]> </script> And here is the AutoIT code to grab the variable: $oTboxID = _IEGetObjById ($oIE,$oIE.document.parentwindow.eval("id")) Thanks again Dsalty. -
How to access a java_script variable?
Capel replied to Capel's topic in AutoIt General Help and Support
Thanks Psalty, You are the man! -
A page I'm automating has a bunch of js variables that I would like to access using AutoIT. Can this be done and if so how?
-
Psalty, what version are you running. I'm using 3.3.6.
-
Using Psalty's method: For $oTable In $oTables $oTable.style.backgroundColor = 0xFFFF00 ; Yellow Next will set all of the table backgrounds on the page to yellow. However, when I find just the tables I want, it does not work. For $oTable In $oTables If String($oTable.className) = "controlContainer" Then $oTable.style.backgroundColor = 0xFFFF00 ; Yellow EndIf Next What am I missing here? [Edit to add] The filter on "controlContainer" does work and find the 3 tables I'm looking for.
-
I hear you. Yes I know how to loop thru them, but I did not know the prop name. "Class" did not work. Where are the properties documented? Thanks for your help!
-
Psalty, this is great! How do I search for just the 3 tables I want? Just the ones whose class = controlContainer There are 80 tables on the page!
-
Sorry, I stated the problem incorrectly. I'm looking for a specific <table> on the page and want to change the background color of just that table. In fact I know the table's class. Here is the HTML of the table: <table class="controlContainer" cellSpacing="0" cellPadding="0" border-top border="0"> There are actually 3 tables on the page with this class and I want to change the background color of all 3.
-
I want to change the background color of an IE form element. $oForm = _IEFormGetObjByName ($oIE, "form1") $oElems = _IEFormElementGetCollection ($oForm) For $oElem in $oElems if StringInStr(StringRight($oElem.id,9),"name_name") > 0 Then $oTboxName = $oElem ; here I want to find the $oElem parent form and change its background color EndIf Next So I need to go up the DOM to find the parent <form> and then set its background color. How would I do this?
-
Launching AutoIT app with AutoIT app
Capel replied to Capel's topic in AutoIt General Help and Support
Thanks for the responses. This gives me enough to get started. -
Launching AutoIT app with AutoIT app
Capel replied to Capel's topic in AutoIt General Help and Support
The second application is a polling app. Since AutoIT is not multi-threaded, I'm looking for a poor-man's way of polling without bogging down my main app. Snowmaker, the on exit function could terminate the second app, if I can track a process id or something when the first app launches it. -
I have 2 AutoIT apps. I want the first app, with a GUI, to launch the second app. When the first app closes, I want to terminate the second app. BTW, the second app does not have a GUI. I searched for answers to this question, but did not find what I'm looking for. Can anyone point me to a thread that discusses this topic or suggestions on how to monitor the second app so I know what to close?
-
I would prefer not to do polling. What I would like is to intercept the message so the AutoIT script is event driven by the 3rd party application. Here is what I'm doing: $g=GUICreate("",200,200) $bNameSearch = GUICtrlCreateButton("Change Title",50,50,100,25) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND,"MyWM_COMMAND") $handle=WinActivate("FrontRange","") While GUIGetMsg() <> -3 WEnd func MyWM_COMMAND($handle,$Msg, $wParam, $lParam) ConsoleWrite("message received" & @CRLF) EndFunc The problem is that I receive the message when I click the button. That is not what I want. I want to receive the message when the user changes the record. What I do know is that the MDI sub window is a control. I'm still off base here, any ideas?
-
Thanks PsaltyDS, Let me confirm that I'm not chasing my tail. I have an AutoIT script running an AutoIT GUI. I want to monitor a 3rd party application (GoldMine) so that when the GoldMine user changes the current record, I do something with AutoIT. Another detail is that GoldMine is a MIDI application. When the user changes the current contact, the title of the MDI window changes. This change is what I want to monitor. Is this possible with AutoIT? I read a post last night that led me to believe that it is not, so I want to confirm.
-
So if I use GuiRegisterMsg as in: GUIRegisterMsg($WM_SETTEXT,"MyWM_COMMAND") I believe WM_SETTEXT is the message I'm looking for, but it does not seem to work. Let's take something simple. Say I want my AutoIT script to monitor a change in the display of the Windows Calculator. The following code does not work. $handle=WinActivate("Calculator","") GUIRegisterMsg($WM_SETTEXT,"MyWM_COMMAND") while GUIGetMsg() <> -3 WEnd func MyWM_COMMAND($handle,$Msg, $wParam, $lParam) ConsoleWrite("message recieved" & @CRLF) EndFunc What am I missing?
-
The application is NOT .Net.
-
My last sentence may have been misleading. I would like to capture the "on text changed" event or something like that. Polling is not preferred method, but the AutoIT script would be running.