-
Posts
183 -
Joined
-
Last visited
About MuffettsMan
- Birthday 06/04/1979
Profile Information
-
Location
Dallas, TX
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
MuffettsMan's Achievements
-
my code runs in a looooong loop and runs fine for a while but then crashes at random with the following errors: --> IE.au3 T3.0-2 Error from function _IENavigate, $_IESTATUS_InvalidObjectType --> IE.au3 T3.0-2 Error from function _IENavigate, $_IESTATUS_InvalidObjectType --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType () --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidObjectType --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType () --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidObjectType TITLE: 0 --> IE.au3 T3.0-2 Error from function _IETagNameGetCollection, $_IESTATUS_InvalidObjectType actual code (its hitting a local Nginx server to get a list of URLs to loop through and signup udemy classes with lol (it works when you are already logged into udemy) - though technically if anyone runs it as it is will mess up my tracking as that update.php returns the user_id of the current friend I'm hooking up with classes lol #include <file.au3> #include <IE.au3> $file = FileOpen("urls.txt", 0) $found = 0 $oIE = _IECreate(1, 1) _IENavigate($oIE, "http://nerdsolve.com/udemy/list.php") _IELoadWait($oIE) $sHTML = _IEDocReadHTML($oIE) $sHTML = StringReplace($sHTML, "<html><head></head><body>", "") $sHTML = StringReplace($sHTML, "</body></html>", "") $urls = StringSplit($sHTML, "<br>", 1) _IEQuit($oIE) For $i = 1 To $urls[0] ; ConsoleWrite($urls[$i] & @CRLF) $url_arr = StringSplit($urls[$i], "|", 1) $coupon_id = $url_arr[1] $coupon_url = $url_arr[2] ConsoleWrite("ID: " & $coupon_id & " URL: " & $coupon_url & @CRLF) $oIE = _IECreate(1, 1) _IENavigate($oIE, $coupon_url) _IELoadWait($oIE) $hIE = _IEPropertyGet($oIE, "HWND") WinActivate($hIE) _IELoadWait($oIE) ; _IEPropertySet($oIE, "theatermode", True) $title = _IEPropertyGet($oIE, "title") ConsoleWrite ("TITLE: " & $title & @CRLF) If ($title == 'Access to this page has been denied.') Then $oIE = _IEAttach($coupon_url, "url") Local $hIE ; Force to get window handle While Not IsHWnd($hIE) $hIE = _IEPropertyGet($oIE, "hwnd") Sleep(10) WEnd ConsoleWrite($hIE & @CRLF) ; Force activation of window While Not WinActive($hIE) WinActivate($hIE) Sleep(10) WEnd sleep(2000) WinSetState($hIE, "", @SW_MAXIMIZE) sleep(2000) MouseClick("left",202, 412) EndIf ; MouseClick($MOUSE_CLICK_LEFT, 917, 328) ; udlite-btn udlite-btn-small udlite-btn-secondary udlite-heading-sm udlite-btn-experiment-primary styles--btn--express-checkout--28jN4 ; udlite-btn udlite-btn-small udlite-btn-secondary udlite-heading-sm udlite-btn-experiment-primary styles--btn--express-checkout--28jN4 ; _IENavigate($oIE, 'javascript:document.querySelector(".udlite-btn udlite-btn-small udlite-btn-secondary udlite-heading-sm udlite-btn-experiment-primary styles--btn--express-checkout--28jN4").button') ; data-purpose == "buy-this-course-button" $oInputs = _IETagNameGetCollection($oIE, "button") Local $sTxt = "" $target = "" For $oInput In $oInputs ; ConsoleWrite ( $oInput.type & " - InnerText: " & $oInput.innertext & @CRLF) If ($oInput.innertext == 'Enroll now') Then ConsoleWrite ("FOUND BUTON....") $target = $oInput _IELoadWait($target,"",Random(1500, 3500, 1)) _IEAction($target, "click") $found = 0 sleep(250) _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=successful&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf If ($oInput.innertext == 'Go to course') Then ConsoleWrite ("FOUND BUTON.... already enrolled...") $target = $oInput $found = 0 sleep(250) _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=previously enrolled&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf If ($oInput.innertext == 'Add to cart') Then ConsoleWrite ("Add to cart dead link") $target = $oInput $found = 0 sleep(250) _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=failed&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf Next ; http://nerdsolve.com/udemy/update.php?user_id=2&status=successful&coupon_id=231 ; http://nerdsolve.com/udemy/list.php ; check if no longer available..... $oInputs = _IETagNameGetCollection($oIE, "h4") Local $sTxt = "" $target = "" For $oInput In $oInputs ; ConsoleWrite ( "H4 - InnerText: " & $oInput.innertext & @CRLF) ; eventually want to update a db or something here to remove it from trying again.... If (StringInStr ($oInput.innertext, 'available')) Then ConsoleWrite ("no longer available" & @CRLF) $found = 0 _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=failed&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf Next For $oInput In $oInputs ; ConsoleWrite ( "H4 - InnerText: " & $oInput.innertext & @CRLF) ; eventually want to update a db or something here to remove it from trying again.... If (StringInStr ($oInput.innertext, 'approved')) Then ConsoleWrite ("not approved" & @CRLF) $found = 0 _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=failed&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf Next ; check if no longer available..... $oInputs = _IETagNameGetCollection($oIE, "h2") Local $sTxt = "" $target = "" For $oInput In $oInputs ; ConsoleWrite ( "H4 - InnerText: " & $oInput.innertext & @CRLF) ; eventually want to update a db or something here to remove it from trying again.... If (StringInStr ($oInput.innertext, 'available')) Then ConsoleWrite ("no longer available" & @CRLF) $found = 0 _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=failed&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf Next ; check if no longer available..... $oInputs = _IETagNameGetCollection($oIE, "div") Local $sTxt = "" $target = "" For $oInput In $oInputs ; ConsoleWrite ( "H4 - InnerText: " & $oInput.innertext & @CRLF) ; eventually want to update a db or something here to remove it from trying again.... If (StringInStr ($oInput.innertext, 'approved')) Then ConsoleWrite ("not approved" & @CRLF) $found = 0 _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=failed&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf ;Enter Password If (StringInStr ($oInput.innertext, 'Enter Password')) Then ConsoleWrite ("Enter Password" & @CRLF) $found = 0 _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=failed&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf ; Request Invitation If (StringInStr ($oInput.innertext, 'Request Invitation')) Then ConsoleWrite ("Request Invitation" & @CRLF) $found = 0 _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=failed&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf ; enrollments If (StringInStr ($oInput.innertext, 'enrollments')) Then ConsoleWrite ("enrollments" & @CRLF) $found = 0 _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=failed&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf Next $found = $found + 1 If ($found > 15) Then ConsoleWrite('ERROR - Failed to enroll on 15 in a row' & @CRLF) Exit EndIf sleep(Random(1500, 3500, 1)) _IEQuit($oIE) Next #cs id to 25476 data-purpose == "buy-this-course-button" _IELinkClickByText($oIE, "Upload") #ce
-
Variable is not or <> comparison failing....
MuffettsMan replied to MuffettsMan's topic in AutoIt General Help and Support
rotflmao yes its doing what I said not what I meant omg... so if I set it = '' then it correctly changes the value..... its a sign I need to stop now and enjoy the weekend!! -
$sftpStatus = 'FAILED' If $sftpStatus <> 'FAILED' Then $sftpStatus = 'SUCCESS' EndIf ConsoleWrite($sftpStatus & @CRLF) $sftpStatus = 'FAILED' If Not($sftpStatus = 'FAILED') Then $sftpStatus = 'SUCCESS' EndIf ConsoleWrite($sftpStatus & @CRLF)Outputs: >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\tmp\test.au3" FAILED FAILED >Exit code: 0 Time: 0.047 trying to toggle the variable but can't seem to find a valid workaround for !=... assuming I'm having an id10t error
-
attempting to call a command line zip utility ( http://stahlworks.com/dev/zip.exe) via the Run() command and not getting any output - for sanity sake i spit out the command to the console and copy paste that into the command prompt in the script dir and it runs just fine any ideas? $source = "D:\-= Audio Books =-\WoT\11 - Knife of Dreams\AlbumArtSmall.jpg" $destZip = @ScriptDir & "\tmp\2m5.zip" ; RAR can't zip on the command line >_< use zip.exe instead..... ; zip.exe -r mydir.zip mydir ; data\zip\zip.exe -r tmp\output.zip "D:\-= Audio Books =-\WoT\11 - Knife of Dreams\AlbumArtSmall.jpg" $runCmd = 'data\Zip\zip.exe -r "' & $destZip & '" "' & $source & '"' ConsoleWrite("$runCmd: " & $runCmd & @CRLF) Local $iPID = Run(@ComSpec & 'data\Zip\zip.exe -r "' & $destZip & '" "' & $source & '"', @ScriptDir, @SW_HIDE, $STDOUT_CHILD) ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead. ; Local $sOutput = StdoutRead($iPID) ; ConsoleWrite($sOutput) ConsoleWriteGUI("Stdout Read START:" & @CRLF) While 1 $sOutput = StdoutRead($iPID) If @error Then ; Exit the loop if the process closes or StdoutRead returns an error. ExitLoop EndIf ConsoleWriteGUI($sOutput) WEnd ConsoleWriteGUI("Stdout Read COMPLETED." & @CRLF) ; Wait until the process has closed using the PID returned by Run. ProcessWaitClose($iPID) Console Output: $runCmd: dataZipzip.exe -r "D:scriptsrift_fisherccdtmp2m5.zip" "D:-= Audio Books =-WoT11 - Knife of DreamsAlbumArtSmall.jpg" Stdout Read START: Stdout Read COMPLETED. (in which when i call rar.exe i do get results in standard out.... and if i copy the runCmd output and paste to the command line it makes the zip just fine Cmd Line Output: D:scriptsrift_fisherccd>dataZipzip.exe -r "D:scriptsrift_fisherccdtmpmanual.zip" "D:-= Audio Books =-WoT11 - Knife of DreamsAlbumArtSmall.jpg" adding: -= Audio Books =-/WoT/11 - Knife of Dreams/AlbumArtSmall.jpg (160 bytes security) (deflated 3%) (so i'd expect to be getting that adding line in stout)
-
Thx Melba, I think the definition of clearly starts to degrade when you don't know what you are doing - I must have jacked up when using Number($selectedRow) instead $selectedRow[0] like I should have been using looking at it now i don't know what i was thinking Edit: blaugh i think i get it... the code was doing what i said not what i meant.... when i did the number($var) of a null it prob just sets it to 0 - no where did i actually check to see if it was legit /sigh
-
MuffettsMan reacted to a post in a topic: can _GUICtrlListView_GetSelectedIndices distinguish between selected or not?
-
Mathematics, coordinates with radius of a circle?
MuffettsMan replied to sphexion's topic in AutoIt General Help and Support
sounds like a game bot in the making... i want in! -
Button enabled only when a ListViewItem is selected
MuffettsMan replied to TheDcoder's topic in AutoIt GUI Help and Support
you might want to consider WM_NOTIFY (i'm using it to detect listview clicks then call a function accordingly.. or in this example when i click on a listview it updates input boxes on different tabs but enabling or disabling a button would be the same logic ; Handle WM_NOTIFY messages ; used to get listview clicks on the fly Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo, $sClickType $hListView = $GUI_BackupQueueListView $hWndListView = $hListView If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button $sClickType = "Left Click" Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button $sClickType = "Left Double-Click" Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button $sClickType = "Right Click" Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button $sClickType = "Right Double-Click" Case Else ; We aren't interested in other messages Return $GUI_RUNDEFMSG EndSwitch $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) ConsoleWriteGUI("WM_NOTIFY: " & $sClickType & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF) ; Get ListView item by index.... [1] ID... [2] File Name... [3] Path... Global $selectedItem = _GUICtrlListView_GetItemTextArray($GUI_BackupQueueListView, DllStructGetData($tInfo, "Index")) GUICtrlSetData($GUI_Action_SourceInput, $selectedItem[1] & " - " & $selectedItem[2]) GUICtrlSetData($GUI_Schedule_SourceInput, $selectedItem[1] & " - " & $selectedItem[2]) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY -
running the following code on a listview that has nothing selected: $selectedRow = _GUICtrlListView_GetSelectedIndices($GUI_BackupQueueListView) ; return the selected row ConsoleWriteGUI("$selectedRow ID: " & $selectedRow & @CRLF) $rowID = _GUICtrlListView_GetItemText($GUI_BackupQueueListView, Number($selectedRow), 0) $rowName = _GUICtrlListView_GetItemText($GUI_BackupQueueListView, Number($selectedRow), 1) ConsoleWriteGUI("ID: " & $rowID & " Name: " & $rowName & @CRLF) i was hoping it would error or something but it returns the first value in the list (which when the script loads nothing is selected) is there a way to distinguish if something is selected or not?
-
attempted HH:mm:ss (military time) to no avail: local $testDate = GUICtrlCreateDate("2015/01/14 21:00:00",15,20,90,20,9) testDate BEFORE (Should be 2015/01/14 21:00:00): 8:05:01 PM EDIT: spoke to soon...it seems to take it ok as an update so will just work with that.... local $test = GUIctrlSetData($testDate,"2015/01/14 22:00:00") $val = GUICtrlRead($testDate) ConsoleWrite("testDate AFTER (should be 2015/01/14 22:00:00): " & $val & @CRLF) Log: testDate AFTER (should be 2015/01/14 22:00:00): 10:00:00 PM hopefully there is a time conversion function else will be a pita that reading yields AM/PM but writing has to be HH:mm:ss
-
it seems to read from ok but updating the date field seems jacked on two fronts - first the BEFORE isn't sending the right time at all..... the second example doesn't take account of the am/pm is something getting converted? local $GUI = GuiCreate("",200,75) local $testDate = GUICtrlCreateDate("2015/01/14 09:00:00 PM",15,20,90,20,9) $val = GUICtrlRead($testDate) GUIsetState(@SW_SHOW) ConsoleWrite("testDate BEFORE (Should be 2015/01/14 09:00:00 PM): " & $val & @CRLF) sleep(1000) local $test = GUIctrlSetData($testDate,"2015/01/14 10:00:00 PM") $val = GUICtrlRead($testDate) ConsoleWrite("testDate AFTER (should be 2015/01/14 10:00:00 PM): " & $val & @CRLF) While 1 switch GUIgetMsg() Case -3 Exit EndSwitch WEnd