Jump to content

LovinItAll

Active Members
  • Posts

    36
  • Joined

  • Last visited

Everything posted by LovinItAll

  1. 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
  2. Would this be better suited for another forum? Thanks ~ Lee
  3. "Winning an online argument is like winning the special olympics....in the end, you are still retarded" - Anonymous
  4. 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
  5. 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!
  6. 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
  7. 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
  8. 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
  9. I tried this originally, but Ping will not detect the existence of folders within a URL. For example: ping("autoitscript.com") - will return the ping time ping("autoitscript.com/AnyFolder") will always return 0, whether AnyFolder exists or not.
  10. Dale - Thank you so much! You have come through for me in a clutch way -- again! Regards ~ Lee
  11. For instance, if I wanted to know if www.AnySite.com/AnyFile.html exists, is there a way to do this? Sort of like: If www.AnySite.com/AnyFile.html exists then else endif
  12. 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
  13. 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...
  14. Never mind -- I figured it out. I need to stop messing with this stuff at 4 AM!
  15. 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
  16. I have written a script that I am selling. At this time, I hard code a user name in the precompiled script and the user is sent through an authentication process. I didn't think there would be a lot of demand for the script, so making changes, recompiling, and redistributing wasn't a concern. Well, I was wrong. I am selling a bunch of these things, and everytime I make a change, I am forced to recompile each user's individual script. Has anyone here written anything that that uses registry values to "marry" their .exe to a unique machine? For that matter, is anyone aware of anything that has already been written to prevent an .exe from being distributed freely? I know I can write code that authenticates against a database or an encrypted file, but I was hoping this issue may have already been addressed. I searched the forums, but I have not found anything as yet. Thanks in advance....
  17. No great minds to lead me in the right direction?
  18. I have a situation where I call a form that, when fully populated, has ten checkboxes. I use the following to check them: $oCust1 = _IEFormElementGetObjByName ($oForm, "selcust", 0) $oCust1.checked = True $oCust2 = _IEFormElementGetObjByName ($oForm, "selcust", 1) $oCust2.checked = True $oCust2 = _IEFormElementGetObjByName ($oForm, "selcust", 2) $oCust3.checked = True (etc, through ten) There are times when there will be less than ten, however. I have used _IEFormElementGetCount($oForm) to play off of the number of elements in the form, but the resulting code is cumbersome, as each reduction in the number of checkboxes does not result in one fewer element in the form, but many. For example, fully populated with 10 checkboxes, the form has 78 elements. With three checkboxes, it only has 18. I don't think the answer lies in examining the number of elements, but rather trapping the error that occurs when there are less than ten. Of course, if there are only three checkboxes and the above code hits, I error out with "Object Not Found" (Note to Dale: This is unrelated to our previous discussion). I have tried something like this: $Count=1 If @error Then $Count = 2 Exit While $Count = 1 $oCust1 = _IEFormElementGetObjByName ($oForm, "selcust", 0) $oCust1.checked = True $oCust2 = _IEFormElementGetObjByName ($oForm, "selcust", 1) $oCust2.checked = True $oCust2 = _IEFormElementGetObjByName ($oForm, "selcust", 2) $oCust3.checked = True $oCust4 = _IEFormElementGetObjByName ($oForm, "selcust", 3) $oCust4.checked = True $oCust5 = _IEFormElementGetObjByName ($oForm, "selcust", 4) $oCust5.checked = True $oCust6 = _IEFormElementGetObjByName ($oForm, "selcust", 5) $oCust6.checked = True $oCust7 = _IEFormElementGetObjByName ($oForm, "selcust", 6) $oCust7.checked = True $oCust8 = _IEFormElementGetObjByName ($oForm, "selcust", 7) $oCust8.checked = True $oCust9 = _IEFormElementGetObjByName ($oForm, "selcust", 8) $oCust9.checked = True $oCust10 = _IEFormElementGetObjByName ($oForm, "selcust", 9) $oCust10.checked = True $count=2 WEnd EndIf I know that ObjEvent (not shown) has to be invoked somewhere, but after reading the docs, I'm not sure how to handle it. The goal, of course, is to check the remaining boxes (if less than ten) and continue the script. Any ideas?
  19. It's late, and I may be getting a little dense, but why do I get: with the following: (forget about the actual code and whether it will work or not. I'm wondering why I get the "no matching If statement") #include <GUIConstants.au3> #include <IE.au3> $Count=1 If @error Then $Count = 2 While $Count = 1 $oCust1 = _IEFormElementGetObjByName ($oForm, "selcust", 0) $oCust1.checked = True $oCust2 = _IEFormElementGetObjByName ($oForm, "selcust", 1) $oCust2.checked = True $count=2 WEnd EndIf and the same message with: #include <GUIConstants.au3> #include <IE.au3> If @error Then $Count = 2 Endif While $Count = 1 $oCust1 = _IEFormElementGetObjByName ($oForm, "selcust", 0) $oCust1.checked = True $oCust2 = _IEFormElementGetObjByName ($oForm, "selcust", 1) $oCust2.checked = True $count=2 WEnd This, of course, is while attempting to "Beta Run"
  20. Dale, I originally wrote the app without any sleep() functions and I only had _IELoadWait() where you identified the need (_IEClickLinkByText() was one of them, I think--but could be wrong). The problem with the user that is having the problem is that not only is she impatient, but every time she gets an error I get an almost angry reply from her-- even though I gave her the script for free! She was supposed to be part of a test group, but I don't think she understands that concept. Maybe I just caught her on a bad day. After I made some minor changes and increased the delay times, she quit receiving the error. I will contact her and see if she would be willing to help trap the error with the earlier script. Some folks are just not "team players"...... Thank you again for your help. I understand your reasons for wanting this error trapped, and I will do what I can to help. This script is about to be in use by a lot of folks, so I'm sure the issue will present itself again. Thanks again ~ Lee
  21. Thank you, Dale. I also modified this: From: $o_IE = _IECreate () _IENavigate ($o_IE, "http://login.passport.net/uilogin.srf?lc=1033&id=2") _IELoadWait ($o_IE,$Delay) To this: $o_IE = _IECreate () _IELoadWait ($o_IE,$Delay) _IENavigate ($o_IE, "http://login.passport.net/uilogin.srf?lc=1033&id=2") I increased $Delay to 2000 in the script she is running and made certain any instance that might require _IELoadWait does indeed have it. She is no longer getting the error, but if it pops up again, I will send her the trace file and report the results to you. Thank you very much for your help ~ Lee
  22. I have made some changes for users of this forum to try and duplicate the above mentioned error. I gave this to the user I have that is receiving the error, and she gets the error (sometimes) under the following circumstances: - When the .exe launches (She always launches the .exe and does not have the source) - After she hits the "Test Mode" or "Send" button Password for Hotmail is ScriptMe She does not get the error every time. While on the phone with her, she received the error about 20% of the time. I changed $Delay to several values, with the largest being 5000 (5 seconds). #include <GUIConstants.au3> #include <IE.au3> ;---Sets various options opt("WinWaitDelay", 100) opt("WinTitleMatchMode", 4) opt("WinDetectHiddenText", 1) opt("MouseCoordMode", 0) opt("SendKeyDelay", 1) ;HotKeySet("^!x", "Exit");---Set Exit method ;---Declare and assign version Dim $Version = "Ver 1.0 Beta" ;---Declare and assign License variable Dim $License = "AutoItUser@hotmail.com" ;----Declare variable for test mode Dim $Test = "F" ;----Declare variables for user input in GUI Dim $Subject Dim $Body Dim $Password Dim $Exit Dim $SendMailButton Dim $TestMailButton Dim $SubjectInput Dim $MailInput Dim $o_IE;---The IE Window object we are operating within Dim $Delay = 1000;---Sets delay for the _IELoadWait function ;MainScreen() ;==========Begin Main GUI======================== ;Func MainScreen() $MailHandler = GUICreate("Mail Handler- " & $Version & " - Licensed to: " & $License & " - MAY NOT BE DISTRIBUTED IN ANY WAY! ", 1016, 734, 193, 115) GUICtrlCreateLabel("Complete the fields below. All Fields Are REQUIRED!", 120, 8, 253, 17) GUICtrlCreateLabel("Subject:", 23, 123, 43, 17) $SubjectInput = GUICtrlCreateInput("", 80, 120, 409, 21, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) GUICtrlCreateLabel("", 576, 176, 4, 4) $MailInput = GUICtrlCreateEdit("", 80, 152, 409, 512, $ES_NOHIDESEL, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) GUICtrlSetData($MailInput, "") GUICtrlCreateLabel("________________________________________________________________________________", 8, 58, 484, 17) GUICtrlCreateLabel("NOTE: You may use any valid HTML code in the body of the mail to be sent.", 8, 80, 484, 17) GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman") GUICtrlSetColor(-1, 0x000080) GUICtrlCreateLabel("Mail Body:", 14, 154, 53, 17) $TestMailButton = GUICtrlCreateButton("Test Mode", 35, 679, 128, 41) GUICtrlSetFont(-1, 14, 800, 0, "Times New Roman") GUICtrlSetColor(-1, 0x000080) $SendMailButton = GUICtrlCreateButton("Send Mail", 200, 679, 129, 41) GUICtrlSetFont(-1, 14, 800, 0, "Times New Roman") $Exit = GUICtrlCreateButton("Exit", 374, 679, 129, 41) GUICtrlSetFont(-1, 14, 800, 0, "Times New Roman") GUICtrlCreateLabel("", 704, 48, 4, 4) $Instructions = GUICtrlCreateLabel("", 536, 16, 441, 273, BitOR($ES_READONLY, $WS_BORDER), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) GUICtrlSetData($Instructions, "A bunch of user instructions") GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman") GUICtrlSetColor(-1, 0x000080) GUISetState(@SW_SHOW) ;EndFunc ;========================================End Main GUI ;-------Start interface and wait for input While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE;---User clicks the X to close the window ExitLoop Case $msg = $Exit;---User clicks the Exit Button ExitLoop Case $msg = $SendMailButton;----User clicks the Send Mail button Main() Exit Case $msg = $TestMailButton;----User clicks the Test Mail button $Test = "T" Main() EndSelect WEnd Exit ;=================================================================================== Func Main() If $SubjectInput = "" Or $MailInput = "" Then;---Check to make sure all fields have input MsgBox(0, "Input Incomplete", "All fields have not been filled in. Please correct and retry") Return EndIf $o_IE = _IECreate () _IENavigate ($o_IE, "http://login.passport.net/uilogin.srf?lc=1033&id=2") _IELoadWait ($o_IE,$Delay) WinSetState("Sign", "", @SW_MAXIMIZE) $Password = InputBox("License Validation", "Please enter your Password:", "", "*") WinActivate("License Validation") $vMsg = GUIGetMsg() Select Case $vMsg = $GUI_EVENT_CLOSE;---User clicks the X to close the window Exit;--Application exits Case $vMsg = 0;---Entry is valid WinActivate($o_IE) $o_SearchForm = _IEFormGetObjByName ($o_IE, "f1") $o_UserName = _IEFormElementGetObjByName ($o_SearchForm, "login") $o_Password = _IEFormElementGetObjByName ($o_SearchForm, "passwd") _IEFormElementSetValue ($o_UserName, $License) _IEFormElementSetValue ($o_Password, $Password) Send("{ENTER}") Case $vMsg = 1;----User clicks the Cancel button Exit EndSelect EndFunc;==>Main edited for typos -- and I forgot to put the password for Hotmail in the post!
  23. Dale, I also read your post on trapping these errors, though I am not entirely clear on this: In my case, I would have to poll for the error throughout the script. I'm working on it
  24. Dale, I have implemented _IELoadWait() functions througout the script, as I thought this might be a problem with the script executing before $oIE had a chance to fully load. The fact that the user gets the error as soon as she clicks the .exe is what is baffling. I have even put the basic sleep(5000) to make SURE the page has loaded before attempting to grab elements within the object. Doesn't seem to matter. All of the other users report zero problems, and I cannot get my script to crash under any circumstances. I thought maybe there was a possibility that an IE setup option was causing the prob, but that still does not explain the error she gets before _IECreate is even called!
×
×
  • Create New...