Jump to content

marsol

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by marsol

  1. Thanks Dale, That makes sense, of course. I'm amazed at the power of autoitscript and it's extensions. Mark
  2. Okay, so I guess this is what I wasn't doing right. I need to have these two statements within the loop for it to work. $oForm = _IEFormGetObjByName ($oIE, "addToCartSearchResults") $CabNumField= _IEFormElementGetObjByName ($oForm, "AddToCart1:cabinNumber") With my admittedly limited understanding I thought $oForm and $CabNumField were object variables and that these were persistent. Obviously some part of my understanding is wrong. Mark
  3. I'm receiving this error when I use the _IEFormElementSetValue more than once for the same field. "IE.au3 Error from function _IEFormElementSetValue, $_IEStatus_InvalidObjectType" The bulk of the original script was kindly provided by SandyD in this post http://www.autoitscript.com/forum/index.php?showtopic=38605 My problem arises when I run a loop trying multiple cabin numbers. Here's a somewhat simplified version of the script that demonstrates the same problem. CODE#include <IE.au3>HotKeySet("^!x", "MyExit") $oIE = _IECreate ("http://www.carnival.com/BonVoyage/AddToCart.aspx?pid=745") _IELoadWait ($oIE) ; Create a variable to store the form $oForm = _IEFormGetObjByName ($oIE, "addToCartSearchResults") $BookNumField = _IEFormElementGetObjByName ($oForm, "AddToCart1:bookingNumber") _IEFormElementSetValue ($BookNumField, "6x14v1") $CabNumField= _IEFormElementGetObjByName ($oForm, "AddToCart1:cabinNumber") $cabnum=1000 While 1 _IEFormElementSetValue ($CabNumField, $cabnum) ; Submit the form _IEFormImageClick ($oIE, "AddToCart1:btnSubmit", "name") ; wait until webpage has loaded _IELoadWait ($oIE) ; get html from page and check if 'Invalid Booking and/or Cabin Number' text is found $sHTML = _IEDocReadHTML ($oIE) If StringInStr($sHTML,"Specify Delivery") Then MsgBox(0,'','Found') Else MsgBox(0,'','NOT Found') EndIf $cabnum=$cabnum+1 Wend FileClose($file) Func MyExit() msgbox(1,"lll","exiting") Exit EndFunc ; Finished! I've tried explicitly declaring the variables but that didn't seem to help. What am I doing wrong? Thanks, Mark
  4. Thank you both. Sandy, that is very much what I was looking for. I'm sure that will get me what I want. Mark
  5. What started as a simple project has turned into a personal challenge for me. My task is to automate the submission of data to a webpage form. This is the page. http://www.carnival.com/BonVoyage/AddToCart.aspx?pid=745 My purpose for doing this is that it is possible to find out cabin assignments by entering your booking number and then cycling through different stateroom numbers until you find the right one. For whatever reason the cruise line doesn't disclose cabin assignments until a couple weeks before sailing even theugh they are assigned. Many people use this technique to find out their cabin assigment in advance. With hundreds of staterooms on a ship doing it manually can take a long time. I was able to make a rather crude script using another macro program. However, it had some limitations I didn't like. The main one was that there was no way to determine if the webpage had reloaded completely to see if it was the right booking number/stateroom combination. The only thing I could do was to wait a specified number of seconds and hope the page was done reloading. This is inefficient and not very elegant. It also makes it difficult to write a script to cover different internet connection speeds and conditions. I'm hoping the IELoadWait function of Autoit can accomplish this. I would like to make a script that is screen resolution, browser version and connection speed independent. While it may be sacreligious to some, I don't necessarily need to support different browsers, IE would suffice for my purposes. Besides being a complete beginner using AutoIT, I don't know javascript, html and probably a few other things to be competent to accomplish what I want. But hey, that never stopped me from trying before. About 1000 years ago my education was in programming. I didn't end up in the field though and I often wish I did. If you happen to have any casino questions feel free to ask, I'd be happy to share any insight I have. So here's my first problem. I need to insure that I select the right stateroom number text input field prior to entering a room number. Easy to do, but not independent by using the mouseclick function. Tabbing to the field doesn't seem solid either as different browser configurations may have a different number of tabs to get the desired field. Any suggestions? I'm not looking for someone to do this for me, only point me in the right direction. Mark
×
×
  • Create New...