LovinItAll
Active Members-
Posts
36 -
Joined
-
Last visited
LovinItAll's Achievements
Seeker (1/7)
0
Reputation
-
Script errors out when attempting a .click event
LovinItAll replied to LovinItAll's topic in AutoIt General Help and Support
Added the error handler, sent it to the user, and now they do not get the error. No other mods were made, so who knows? Thanks for the suggestion. At least I have the error handler in place should they get that (or another COM) error again. Should have had it in there to begin with: just lazy, I guess! Lee -
Script errors out when attempting a .click event
LovinItAll replied to LovinItAll's topic in AutoIt General Help and Support
Would this be better suited for another forum? Thanks ~ Lee -
"Winning an online argument is like winning the special olympics....in the end, you are still retarded" - Anonymous
-
I have a user that receives an error any time a .click event on a button is attempted. They have (2) machines side by side -- one works, the other does not. Both machines are configured as follows: - Win XP, AutoUpdates (install automatically) turned on - Same mouse, same keyboard (shouldn't matter, I don't think) NOTE: This user was experiencing no probs until a few days ago. They say they have not installed any new software. Does anyone know from which DLL the .click event is called (assuming it is a DLL)? This code from Dale's post for his IE Automation library creates the error also, so I have used it as an example: #include <IE.au3> $oIE = _IECreate() _IENavigate($oIE, "http://www.google.com") $oForm = _IEFormGetObjByName($oIE, "f") $oQuery = _IEFormElementGetObjByName($oForm, "q") $oButton = _IEFormElementGetObjByName($oForm, "btnG") _IEFormElementSetValue($oQuery, "place your search string here") $oButton.click _IELoadWait($oIE) Exit
-
Internet Explorer Automation UDF library
LovinItAll replied to DaleHohm's topic in AutoIt Example Scripts
Dale, Here is an example of aberrant behaviour: (may have nothing to do with IE.au3, but it may....) #include <IE.au3> $o_IEPreview = _IECreate () WinActivate("about:blank - Microsoft Internet Explorer") WinSetOnTop("about:blank - Microsoft Internet Explorer", "", 1) WinSetState("about:blank - Microsoft Internet Explorer", "", @SW_MAXIMIZE) WinSetTitle("about:blank - Microsoft Internet Explorer", "", "Mail Preview - Microsoft Internet Explorer") Running this through Tools->Beta Run, the window is always set on top and is always maximized After Beta Compile, it's a hit-or-miss thing -- sometimes it Maximizes, sometimes not. Sometimes it is set On Top, other times not. Just an FYI..... Edited because I am tired! -
Internet Explorer Automation UDF library
LovinItAll replied to DaleHohm's topic in AutoIt Example Scripts
I like this, and have included it in IE.au3. As I have mentioned, _IECreate is not the only place my users have received the "Object Not Found" error. It will also manifest itself after _IENavigate or any function that relies on the page loading completely, and where I am retrieving objects on the page to which the user navigated. I'll try to narrow it down even more for you. I did have one user who was getting the error check for "ghost" windows immedialtely after receiving the error (I had her on the phone), but none existed. I tried to get her to accept a file with trace lines, but I was met with a lack of comprehension (probably my fault for trying to explain in the first place -- I should have just sent it), but she was pretty angry already, so I just fixed it with a delay. Thanks again ~ Lee P.S. I also throw this into IE.au3 for my own use. I'm sure there is a very good reason you do not wish to include it (keeping individual actions separate -- handy, though, if the user intends to navigate to a page after creating the window object), but I find it helpful (saves a line of code...what can I say?!) Func _IECreateAndNav($s_URL = "About:Blank",$f_visible = 1) $o_object = ObjCreate("InternetExplorer.Application") If IsObj($o_object) Then $o_object.visible = $f_visible $o_object.navigate ($s_URL) While _IEGetProperty($o_object, "busy") or _ ((_IEGetProperty($o_object, "readyState") <> "complete") and (_IEGetProperty($o_object, "readyState") <> 4)) Sleep(100) WEnd _IELoadWait($o_object) SetError(0) Return $o_object Else SetError(1) Return 0 EndIf EndFunc ;==>_IECreateAndNav -
Internet Explorer Automation UDF library
LovinItAll replied to DaleHohm's topic in AutoIt Example Scripts
I can try this, but I suspect that: If IsObj($o_object) Then ;---in _IEGetProperty will SetError(1) because $o_object is not yet recognized. See what I mean? It won't be busy because it won't be anything, if that makes sense. At least that is what the error always says: "Object Does Not Exist" Before I tried the mod I suggested, even a value like Sleep(1000) after _IECreate would fail periodically with some users. Like you, I cannot get the error on my machine (well, I got it once). I assume by relying on a behavior of IE that could change, you are referencing the way IE displays the title. I will try to get the snippet you suggested to users that might cooperate, but they are paying customers, and their tolerance for errors and willingness to test is limited.....go figure! Lee -
Internet Explorer Automation UDF library
LovinItAll replied to DaleHohm's topic in AutoIt Example Scripts
Dale, I'm not sure this is worthy of addressing, as there are ways around it, but: Typically, when I create a new browser window using _IECreate, I am going to perform some action immedialtly following the creation of the new window. For instance: $o_IENewWindow = _IECreate () _IEBodyWriteHTML ($o_IENewWindow, "Some Random Text") or I may simply maximize the new window: $o_IENewWindow = _IECreate () WinSetState("about:blank - Microsoft Internet Explorer", "", @SW_MAXIMIZE) This works MOST of the time, but a significant number of times (>10%?), the script will error out with the dreaded "Object Not Found" error, as the New Window has not yet had time to load the Title (about:blank) I've found if I modify _IECreate, I get the results I want 100% of the time: Func _IECreate($f_visible = 1) $o_object = ObjCreate("InternetExplorer.Application") If IsObj($o_object) Then $o_object.visible = $f_visible $o_object.navigate ("about:blank") WinWait("about:blank - Microsoft Internet Explorer") ;==New Line SetError(0) Return $o_object Else SetError(1) Return 0 EndIf EndFunc ;==>_IECreate Since we are creating "about:blank" every time we use _IECreate(), making certain the title has actually loaded before proceeding has been an important thing for me. $o_object.navigate ("about:blank") does not get it done. Actions such as @SW_MAXIMIZE do not always work if the WinWait() function is not there. At any rate, I am but a neophyte, and as such I realize that suggesting a change to a core function of yours may be pure folly, but I thought you might find it interesting. Have a great week! ~ Lee -
Tabbing Through Controls
LovinItAll replied to LovinItAll's topic in AutoIt General Help and Support
Thank you very much. I fiddled with the $GUI_FOCUS, but I had it in the wrong place. I really appreciate it. Have a great day! ~ Lee -
This is probably a silly question, but I can't seem to get the behaviour I desire. I have multiple controls in a GUI I created. I want the <TAB> key to move to the next edit control or button in a specified order. To wit: #include <GUIConstants.au3> $Window = GUICreate("Tab Problem", 800, 550, -1, -1) $filemenu = GUICtrlCreateMenu ("&File") $helpmenu = GUICtrlCreateMenu ("Help") $infoitem = GUICtrlCreateMenuitem ("Help",$helpmenu) $exititem = GUICtrlCreateMenuitem ("Exit",$filemenu) $separator1 = GUICtrlCreateMenuitem ("",$filemenu,2) $SubjectInput = GUICtrlCreateEdit("", 55, 6, 409, 21,$ES_OEMCONVERT, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE,)) $MailInput = GUICtrlCreateEdit("", 55, 30, 709, 455, $ES_WANTRETURN+$ES_MULTILINE+$ES_AUTOVSCROLL+$WS_VSCROLL, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE,)) GUICtrlCreateLabel("Subject:", 1, 10, 43, 17) GUICtrlCreateLabel("", 400, 176, 4, 4) GUICtrlCreateLabel("Mail Body:", 1, 35, 53, 17) $TestMailButton = GUICtrlCreateButton("Test Mode", 175, 490, 128, 31) GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman") GUICtrlSetColor(-1, 0x000080) $SendMailButton = GUICtrlCreateButton("Send Mail", 350, 490, 129, 31) GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman") $Exit = GUICtrlCreateButton("Exit", 525, 490, 129, 31) GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman") GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Or $msg = $exititem OR $msg = $Exit Then ExitLoop WEnd GUIDelete() This starts with focus on the Body for some reason. I want the control focus to be on "Subject" initally, then tab to Body, Test Mode, Send Mail, Exit edited: removed unecessary control...
-
I am trying to find the number of occurences of a string within the body tags of an HTML page. There will always be at least one and less than 22: (the code below is just one of many things I have tried. I also tried a Do loop -- which I think is what I want -- but no worky) Func NumberOfStrings() $StringToSearch = _IEBodyReadHTML($o_IE) $x = 1 $y = 1 For $y = 1 to 22 StringInStr ($StringToSearch, "MySubString", 0, $x) $x = $x + 1 If @error = 1 Then ; StringInStr() failed $y=22 EndIf Next SplashTextOn("Instances of MySubString", $x) sleep(10000) EndFunc