oemript Posted October 29, 2018 Author Share Posted October 29, 2018 (edited) Deleted Edited October 29, 2018 by oemript Link to comment Share on other sites More sharing options...
oemript Posted October 29, 2018 Author Share Posted October 29, 2018 (edited) Deleted Edited October 29, 2018 by oemript Link to comment Share on other sites More sharing options...
oemript Posted October 29, 2018 Author Share Posted October 29, 2018 (edited) Deleted Edited October 29, 2018 by oemript Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted October 29, 2018 Share Posted October 29, 2018 @oemript Same discourse here. Add error checking to your script and then post the results. And please, don't delete your posts, since they could be helpful to others. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
oemript Posted October 29, 2018 Author Share Posted October 29, 2018 (edited) Deleted Edited October 29, 2018 by oemript Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted October 29, 2018 Share Posted October 29, 2018 1 minute ago, oemript said: There is no error message, but $FO_Append do not seem working with $FileWriteFromArray. I don't see it in the code you posted. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
oemript Posted October 29, 2018 Author Share Posted October 29, 2018 (edited) Deleted Edited October 29, 2018 by oemript Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted October 29, 2018 Share Posted October 29, 2018 @oemript I don't see error checking in your code. Please, stop semi-asking to questions and debug your code. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
oemript Posted October 29, 2018 Author Share Posted October 29, 2018 (edited) Deleted Edited October 29, 2018 by oemript Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted October 29, 2018 Share Posted October 29, 2018 (edited) 34 minutes ago, oemript said: Do you have any suggestions on how to append array into file using _FileWriteFromArray? You are already doing it. But, what does tell you if you have or not a valid array to write/append to your file? Edited October 29, 2018 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
oemript Posted October 29, 2018 Author Share Posted October 29, 2018 (edited) Deleted Edited October 29, 2018 by oemript Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted October 29, 2018 Share Posted October 29, 2018 (edited) @oemript Is so difficult to do what we're trying to suggest you from yesterday? Add error checking to your code. What are you expecting to write to your file? An array? See if your functions return a valid array. Do it your own. Edited October 29, 2018 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
oemript Posted October 29, 2018 Author Share Posted October 29, 2018 (edited) Deleted Edited October 29, 2018 by oemript Link to comment Share on other sites More sharing options...
oemript Posted October 29, 2018 Author Share Posted October 29, 2018 (edited) Within loop, when I only run Test1, it can run until the end of next button without any problem. Within loop, when I only run Test2 without running other application, it stops in the middle of loop. I would like to know on how to solve this strange behavior on repeat running following code. Local $otradeLog1 = _IEGetObjById($oIE, "tradeLog1") Any debug tools on showing what error is about. Does anyone have any suggestions? Thanks, to everyone very much for any suggestions (^v^) expandcollapse popup#include <Array.au3> #include <IE.au3> #include <File.au3> Global $oGlobalCOMErrorHandler = ObjEvent("AutoIt.Error", "_ErrFuncGlobal") ; Global COM error handler Global $bTradeLog = False, $aTradeLog Global $oIE = _IECreate("http://www.aastocks.com/en/stocks/analysis/transaction.aspx?symbol=00005", 1) $HWND = _IEPropertyGet($oIE, "hwnd") WinSetState($HWND, "", @SW_MAXIMIZE) _IELoadWait($oIE, 5000) Global $otradeLog = _IEGetObjByName($oIE, "charttype") _IEAction($otradeLog, "click") Global $odivlogNext = _IEGetObjById($oIE, "divLogNext") While $odivlogNext.ClassName = "float_r pad0imp rel jshoverwithclass sel" _IEAction($otradeLog, "focus") _IEAction($odivlogNext, "focus") Sleep(200) ;_Test1() ; it works until the end of next button _Test2() ; it stops in the middle of loop _IEAction($odivlogNext, "focus") Sleep(200) _IEAction($odivlogNext, "click") Sleep(200) WEnd _IEQuit($oIE) Func _Test1() Local $oLocalCOMErrorHandler = ObjEvent("AutoIt.Error", "_ErrFuncLocal") ; Local COM error handler Local $sFilePath = "D:\stocks.txt" EndFunc Func _Test2() Local $oLocalCOMErrorHandler = ObjEvent("AutoIt.Error", "_ErrFuncLocal") ; Local COM error handler Local $sFilePath = "D:\stocks.txt" Local $otradeLog1 = _IEGetObjById($oIE, "tradeLog1") EndFunc Edited October 29, 2018 by oemript Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 29, 2018 Moderators Share Posted October 29, 2018 @oemript Care to explain the thinking behind deleting post after post in this thread? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
oemript Posted October 29, 2018 Author Share Posted October 29, 2018 (edited) Can forum offer a delete option? after testing and finding, the latest post would be the most appropriated for this issue. Do you have any suggestions? Thanks, to everyone very much for any suggestions (^v^) Edited October 29, 2018 by oemript Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 29, 2018 Moderators Share Posted October 29, 2018 Yes, the suggestion would have been to leave the context and simply edit. Or just leave it and state in your most recent post what finally worked, so someone encountering the same in the future would be able to see the steps you tried to get to the end result, rather than interrupting the flow of the thread with a bunch of blank posts - in other words, the suggestion would be to follow exactly what the forum rules state not to do in point 8. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
oemript Posted October 29, 2018 Author Share Posted October 29, 2018 (edited) Do you have any suggestions on what kind of error is that with err.windescription? Thanks, to everyone very much for any suggestions (^v^) Edited October 29, 2018 by oemript Link to comment Share on other sites More sharing options...
oemript Posted October 29, 2018 Author Share Posted October 29, 2018 I would like to know on how to handle error with loop, which ignore any error, and keep going to do the rest of process. Does anyone have any suggestions? Thanks in advance for any suggestions Link to comment Share on other sites More sharing options...
Subz Posted October 29, 2018 Share Posted October 29, 2018 You can use something like this, this has been tested several times and writes the data into csv format D:\stocks.csv. What I suggest is open IE navigate to the page first, check that the Full Transaction log includes data, when I run it now, there is no data, however if I select yesterdays info it populates. Now run the script, if you get errors: Check the source code of the page and make sure "charttype" id exists on the page, check "divLogNext" id exists on the page and lastly check that the divLogNext classname matches "float_r pad0imp rel jshoverwithclass sel". As mentioned this runs fine for me and I get csv file which I can open in Excel without any issues. Anyway don't have any further time for this, so will leave it with you. expandcollapse popup#include <Array.au3> #include <IE.au3> #include <File.au3> _IEErrorNotify(True) Global $sStartTime = "Start Date/Time: " & @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC Global $bTradeLog = False, $aTradeLog Global $oIE = _IECreate("http://www.aastocks.com/en/stocks/analysis/transaction.aspx?symbol=00005", 1) ;~ Global $hWnd = _IEPropertyGet($oIE, "hwnd") ;~ WinSetState($hWnd, "", @SW_MAXIMIZE) ;~ Sleep(5000) Global $otradeLog = _IEGetObjByName($oIE, "charttype") _IEAction($otradeLog, "click") Global $odivlogNext = _IEGetObjById($oIE, "divLogNext") While $odivlogNext.ClassName = "float_r pad0imp rel jshoverwithclass sel" _GetTradeLog() _IEAction($odivlogNext, "click") Sleep(100) WEnd ;~ Get the last Transaction Log page. _GetTradeLog() _ArrayDisplay($aTradeLog) ;~ Write Data to file Global $sFileOpen = "D:\Stocks.csv" Global $hFileOpen = FileOpen($sFileOpen, 2) ;~ This will create a new file name overwriting content, use flag 1 if you wish to append data FileWrite($hFileOpen, $sStartTime & @CRLF) Global $sTradeLog = '"' & _ArrayToString($aTradeLog, '","', -1, -1, '"' & @CRLF & '"') & '"' ;~ To get a proper csv file, convert the array to string and then change "|" to '","' since Array data inludes commas FileWrite($hFileOpen, $sTradeLog & @CRLF) FileWrite($hFileOpen, "End Date/Time: " & @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF) FileClose($hFileOpen) ShellExecute($sFileOpen) Func _GetTradeLog() Local $atradeLog1, $btradeLog1 = True, $atradeLog2, $btradeLog2 = True ;~ Get left Trade Log table Local $otradeLog1 = _IEGetObjById($oIE, "tradeLog1") If IsObj($otradeLog1) Then $atradeLog1 = _IETableWriteToArray($otradeLog1, True) Else ConsoleWrite("$otradeLog1 is not an object, check the source code to see if tradeLog1 exists." & @CRLF) $btradeLog1 = False EndIf ;~ Get right Trade Log Table Local $otradeLog2 = _IEGetObjById($oIE, "tradeLog2") If IsObj($otradeLog2) Then $atradeLog2 = _IETableWriteToArray($otradeLog2, True) Else ConsoleWrite("$otradeLog2 is not an object, check the source code to see if tradeLog2 exists." & @CRLF) $btradeLog2 = False EndIf If $bTradeLog = False Then If $btradeLog1 Then $aTradeLog = $atradeLog1 ElseIf $btradeLog2 Then $aTradeLog = $atradeLog2 EndIf If $btradeLog1 And $btradeLog2 Then _ArrayConcatenate($aTradeLog, $atradeLog2, 1) $bTradeLog = True ElseIf $btradeLog1 Then $bTradeLog = True ElseIf $btradeLog2 Then $bTradeLog = True EndIf Else If $btradeLog1 Then _ArrayConcatenate($aTradeLog, $atradeLog1, 1) If $btradeLog2 Then _ArrayConcatenate($aTradeLog, $atradeLog2, 1) EndIf EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts