Jump to content

Jefferds44

Active Members
  • Posts

    36
  • Joined

  • Last visited

Jefferds44's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hi guys, My goal is to collect data from a series of webpages and write that date to a single Excel worksheet. I spent the morning trying to get this to work but I'm stuck on where to go. I'm using _IETableWriteToArray to get data from a website into an array. I managed to write the table to Excel using _ExcelWriteSheetFromArray. Now where I'm stuck is I can't figure out how to append the Excel sheet once I fill the array with new data. Either I can append the Array before writing to Excel or append the Excel file as I go. Which strategy is best? And if so, could I get a quick sample on how to implement this functionality? Thanks! Jeff EDIT: Here's my non-working code so far: #include <IE.au3> #include <Excel.au3> #include <Array.au3> Global $ESRB = "http://www.esrb.org/ratings/search.jsp?titleOrPublisher=&rating=&ratingsCriteria=&platforms=&platformsCriteria=&searchVersion=compact&content=&searchType=title&contentCriteria=&newSearch.x=33&newSearch.y=11" Global $DataFile = "C:TempDataFile.xls" Global $aGlobalData ; Load ESRB webpage $oIE = _IECreate($ESRB, 1) Do $oTable = _IETableGetCollection($oIE, 2) ; Get Table from webpage $aTableData = _IETableWriteToArray($oTable,1) ;Write table to array ;~ _ArrayDisplay($aTableData) _ArrayAdd($aGlobalData, $aTableData) ; Add more data to array _ArrayDisplay($aTableData) $o_nextPage = _IEGetObjByName($oIE, "nextPage") ;Get nextPage Object $p_nextPageDisabled = _IEPropertyGet($o_nextPage, "isdisabled") If $p_nextPageDisabled == False Then _IEAction($o_nextPage, "click") EndIf Until $p_nextPageDisabled == True
  2. Thank you so much for testing for me. Silly me, I changed my password recently and was using my old one... *embarrassed*
  3. Ok here you go: ; ;################################## ; Include ;################################## #Include<file.au3> ;################################## ; Variables ;################################## $SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED $FromName = "Jeff Test" ; name from who the email was sent $FromAddress = "tester@gmail.com" ; address from where the mail should come $ToAddress = "jtest@gmail.com" ; destination address of the email - REQUIRED $Subject = "testing 1-2" ; subject from the email - can be anything you want it to be $Body = "this is a test" ; the messagebody from the mail - can be left blank but then you get a blank mail $AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed $CcAddress = "jeff.tester@test.com" ; address for cc - leave blank if not needed $BccAddress = "" ; address for bcc - leave blank if not needed $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" $Username = "jtest@gmail.com" ; username for the account used from where the mail gets sent - REQUIRED $Password = "asdfasdfasdf" ; password for the account used from where the mail gets sent - REQUIRED ;~ $IPPort = 25 ; port used for sending the mail ;~ $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS $IPPort=465 ; GMAIL port used for sending the mail $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS ;################################## ; Script ;################################## Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl) If @error Then MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc) EndIf ; ; The UDF Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0) Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress Local $i_Error = 0 Local $i_Error_desciption = "" If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf If $s_AttachFiles <> "" Then Local $S_Files2Attach = StringSplit($s_AttachFiles, ";") For $x = 1 To $S_Files2Attach[0] $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x]) ;~ ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console If FileExists($S_Files2Attach[$x]) Then ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF) $objEmail.AddAttachment($S_Files2Attach[$x]) Else ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF) SetError(1) Return 0 EndIf Next EndIf $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 then $IPPort = 25 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password EndIf If $ssl Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True EndIf ;Update settings $objEmail.Configuration.Fields.Update ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low" EndSwitch $objEmail.Fields.Update ; Sent the Message $objEmail.Send If @error Then SetError(2) Return $oMyRet[1] EndIf $objEmail="" EndFunc ;==>_INetSmtpMailCom ; ; ; Com Error Handler Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) $oMyRet[0] = $HexNumber $oMyRet[1] = StringStripWS($oMyError.description, 3) ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF) SetError(1); something to check for when this function returns Return EndFunc ;==>MyErrFunc
  4. Hi guys, Looking through the forums I couldn't quite pinpoint what I'm doing wrong here. I want to send an e-mail with _INetSmtpMailCom using GMail SMTP credentials. However, I get the following error. ### COM Error ! Number: 80020009 ScriptLine: 564 Description:The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available Any direction would help me out. Thanks,
  5. Hi guys, I have a question relating to identifying windows. I put the option "Opt("WinTitleMatchMode", 2)". Now I'm wondering if I can identify a window based on 2 key strings. For example I have 4 windows with the titles: a) "Windows Explorer - User XYZ - Login user accounts" >_< "Windows Explorer - User ABC - Login user accounts" c) "Windows Explorer - User XYZ - Admin" d) "Windows Explorer - User ABC - Admin" How would I go about identifying the Windows that have both "Windows Explorer" AND "Admin in the title? I'm trying this but it doesn't work: Winexists ("Windows Explorer" AND "Admin")
  6. Very weird. I rebooted my pc and it works now... oh well. Thanks for the replies guys.
  7. Something weird is going on. I'm using the window info tool to find the color of a given pixel but no matter where I put it throughout my screen it always returns 0xFFFFFF. Any thoughts on why this is the case? I'll try rebooting and hopefully someone will have answered by then!
  8. Hi Guys, I read through the documentation on Advanced Window Descriptions and I would need some help. I would like to GetWinList a specific set of windows. However, I have multiple windows with the same title and want to exclude a specific class. I have this so far: Opt("WinTitleMatchMode", 2) $Windows = WinList ("Explorer") This gets the list of windows that have Explorer in the title. However, I want to exclude windows that have Explorer in the title and that are a specific class. Help please... I'm not sure how to write up the syntax with REGEXPCLASS, Thanks,
  9. What the heck are you talking about? I had a fully functioning auto-it script working for me before Full Tilt's graphical update. My script was registering tournaments for me and placing my windows fine. For all intents and purposes I learned auto-it myself and have read through the entire help file many times over. Why the hate? I always read the help file and search the forums first before posting. I'm hitting a wall and that's why I'm calling out to the community here. With respect to your post, why do you feel I'm going about it all wrong? The many scripts I've made for Full Tilt have also never consisted of using OCR. But things have changed. Now, I lay out my strategy for all to see and if you feel I'm not looking at this problem from the right angle, feel free to nudge me in the right direction. I'm not asking anyone to do the work for me, all I ask is for guidance and wisdom. I don't generally provide code, because I'm just asking for general design philosophy. But if you must, here's a snippet of my script. It used to read through the lobby and pull the table information from each line. Now that it is completely graphical, I can't do it that way anymore. [Note: Don't try running it, there are a few other outside functions and variables; but you'll get the general idea] Func GetPlayableTable($SlotNum) ;Checks lobby to get Table ID's that mach session/buy-in parameters Dim $FoundTable = False; Dim $LobbyItemCount; # of lines in lobby Dim $LobbyItem0Text; Table ID Dim $LobbyItem1Text; Game Dim $LobbyItem2Text; Type Dim $LobbyItem3Text; Buy-In Dim $LobbyItem4Text; Status Dim $LobbyItem5Text; Plrs Dim $Line; Line number in tournament list If $SlotTournamentID[$SlotNum] == -1 Then EnsureWinActive($LobbyhWnd) dbg("SlotTournamentID #" & $SlotNum & " == -1. Attempting to get playable table...") Dim $ListViewHandle = ControlGetHandle($FTPLobbyTitle, "", 520) $LobbyItemCount = ControlListView($FTPLobbyTitle, "", 520, "GetItemCount"); dbg("Number of registering tournaments: " & $LobbyItemCount) For $Line = 0 To $LobbyItemCount - 1 Step +1 $FoundTable = False ControlListView($FTPLobbyTitle, "", 520, "Select", $Line); dbg("Listing lobby fields") $LobbyItem0Text = ControlListView($FTPLobbyTitle, "", 520, "GetText", $Line, 0); dbg($LobbyItem0Text) $LobbyItem1Text = ControlListView($FTPLobbyTitle, "", 520, "GetText", $Line, 1); dbg($LobbyItem1Text) $LobbyItem2Text = ControlListView($FTPLobbyTitle, "", 520, "GetText", $Line, 2); dbg($LobbyItem2Text) $LobbyItem3Text = ControlListView($FTPLobbyTitle, "", 520, "GetText", $Line, 3); dbg($LobbyItem3Text) $LobbyItem4Text = ControlListView($FTPLobbyTitle, "", 520, "GetText", $Line, 4); dbg($LobbyItem4Text) $LobbyItem5Text = ControlListView($FTPLobbyTitle, "", 520, "GetText", $Line, 5); dbg($LobbyItem5Text) $RegTableSuccess = False If (Not CheckAlreadyRegistered($LobbyItem0Text) And ($LobbyItem1Text == $FTPGame) And ($LobbyItem2Text == $FTPType) And ($LobbyItem3Text == $FTPBuyIn) And ($LobbyItem4Text == $Status) And (CheckTableCapacity($LobbyItem5Text))) Then $FoundTable = True; dbg("Found new table #" & $SlotTournamentID[$SlotNum] & " at line " & $Line & ".") $SlotTournamentID[$SlotNum] = $LobbyItem0Text; _GUICtrlListView_SetItemSelected($ListViewHandle, $Line, True, True) EnsureWinActive($LobbyhWnd) ControlClick($FTPLobbyTitle, "", 1031); RegisterTable($SlotTournamentID[$SlotNum]) If $RegTableSuccess == True Then $SlotRegistration[$SlotNum] = 1 ExitLoop Else dbg("$RegTableSuccess Error") EndIf EndIf ControlListView($FTPLobbyTitle, "", 520, "DeSelect", $Line); Next EndIf EndFunc ;==>GetPlayableTable
  10. Sean (or anyone else), I'm trying to work with the UDF, but I don't seem to be able to make it work. It seems to be broken for me at the base level. I'm testing the CaptureToTIFF() function, and it only outputs a blank .tif file. I have the latest version of Tesseract installed in my program files directory. Here's my script: #include <Tesseract.au3> $left_indent = 0 $top_indent = 0 $right_indent = 0 $bottom_indent = 0 $show_capture = 1 CaptureToTIFF("Calculator", "", "", "test01.tif", "", $left_indent, $top_indent, $right_indent, $bottom_indent)
  11. Hi guys, here's what I'm trying to do. I am creating a script that opens poker tables automatically so that I can play. The Full Tilt poker lobby that I want to automate is completely image based. I don't have access to the controls and I can't read from them. The Window Info tool gives me nothing in the control properties and the window itself comes up as class QWidget. It looks like I'm going to have to use an OCR strategy. My strategy is as follows; - The poker lobby lists 18 rows each with a different table. - I want to break down the lobby into 18 different images (1 per row). - I will then scrape the text of each row - Based on the scraped text, I will register the table or not depending on the info I get back. What I would like to know is, are there any UDF's for auto-it that help me out with any of these? Is there an OCR collection of UDFs that allow me to break down the poker lobby into separate images and give me back the text? Thanks for any help you guys may offer up! Thanks, Jeff
  12. What I'm looking for is unrelated to my specific problem. My explanation about my setup is there only to give a certain amount of context. What I'm looking for is some advice on common mistakes done with Auto-it that could throw everything else out of whack. But that's fine, I understand if my request is too generic to warrant a clear cut answer. I was just looking for things like basic tips & tricks. The kind of stuff veterans like yourself learned the hard way and are kind enough to share with nooblers.
  13. damn Not even a push in any direction....
  14. Hi guys, I'm running an auto-it script that is performing a certain action on the side of another program. This other program isn't an auto-it script but it has some automated features. When I run my auto-it script simultaneously with my 1st program, the auto-it script cause the first program to make mis-clicks. Can someone please help guide me in how to debug this? I'm lost and don't know where to start. Thanks, Jeff
×
×
  • Create New...