; ;IPsort Filter GUI development using IPsort aligned buttons ; Install a custom error handler ; if used in a Function, the handler is automatically disable on return. ; If not installed the script will terminated on error Local $oMyError = ObjEvent("AutoIt.Error", "ErrFunc") GLOBAL $oExcel Global $ticker ;Global $oIEPGP ;UI Stuff: global $frmSimpleSpy, $edtCtrlInfo , $lblCapture, $lblEscape, $lblRecord, $edtCtrlRecord, $msg, $x, $y, $oUIElement, $oTW, $objParent, $oldElement, $text1, $t #include #include #include ;#include #include #include #Include #include #include #include #include #include ;From UI Examples, may not need all #include #include #include #include #include #include "UIAWrappers.au3" #include ;#include <_Dbug.au3> #include #include ;***** WebDriver Settup **************************************************************** #include "wd_core.au3" #include "wd_helper.au3" ;************************************************************************************* ;SET LOCATION FOR FILE PATH LOCATIONS: Global $Location $Location = 1 ;2 = Henderson, 1 = Prescott ;************************************************************************************* Local $GKPath[3] $GKPath[1] = "H:\main\A TRADING 2023\SCRIPTS DEV\geckodriver.exe" $GKPath[2] = "H:\Google Drive Folder\main\A TRADING 2023\SCRIPTS DEV\geckodriver.exe" Global $sDesiredCapabilities, $sPSession, $sScriptName = "TradeScript" Global $zacksURL $_WD_DEBUG = 2 ; Set debug level: $_WD_DEBUG_None (0) = No logging to console, $_WD_DEBUG_Error (1) = Error logging to console, $_WD_DEBUG_Info (2) = Full logging to console (Default) ;This is 32B driver (copied from working demo, for example) Global $sDriver = $GKPath[$Location] ; <== Please modify this statement to your environment. Must be a local drive, network drives don't work! ; Setup Firefox _WD_Option("Driver", $sDriver) ;If @error Then Exit SetError(1, @error) _WD_Option('DriverParams', '--binary "C:\Program Files\Mozilla Firefox\firefox.exe" --log trace ') _WD_Option('Port', 4444) _WD_Option('DriverClose', False) $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true,"setWindowRect":true}}' ;THIS IS A SCRATCH COMMENT AREA FOR COPYING INFO FOR EDITING SCRIPT ;/html/body/div[8]/div/div[1]/div[1] LR corner popup in Zacks ;/html/body/div[8]/div/div[1] Another Zacks popup ;***** WebDriver Settup Finish **************************************************************** _DebugSetup() ;*************************** DBUG OPTIONS******************* ;AutoItSetOption ( "option" [, param] ) ;AutoItSetOption ("TrayIconDebug", 1) ;Opt("TrayIconDebug", 0) ;0=no info, 1=debug line info ;*************************** DEBUG OPTIONS****************** AutoItSetOption("MustDeclareVars", 1) ;AutoItSetOption("WinTitleMatchMode", 2) Opt("WinTitleMatchMode", -2) ;Opt("RunErrorsFatal", 0) ;Added for solving the excel read issue random failure Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client ;Opt("GUICoordMode", 2) Opt("GUIResizeMode", 1) Opt("GUIOnEventMode", 0) ;(0) for using switch case for button function calls, (1) for using GUICtrlSetOnEvent(-1, "Func()") HotKeySet("{ESC}","ExitScript") ;HotKeySet("!c","ProcessTkrList") ;Alt-c - Copies filtered tkr rows to IPsort Sheet No 3 _WD_Startup() Local $sPSession = _WD_CreateSession($sDesiredCapabilities) ;******************* ;DOWNLOAD ALL OMNIA PORTFOLIO CSV FILES AND CREATE OMNIA WATCHLIST FILE ; Create individual sheets for each of the OMNIA portfolios ; Create a sheet with all OMNIA portfolio holdings (duplicates across portfolios included) ;PROCESS ALL PORTFOLIOS - Dnld CSVs, Create Tkr arrays and strings, and Save CSVs to sheets in "IP_Watchlists" ;Portfolio Links: Global $Plinks[15] $Plinks[0] = "https://investorplace.com/aitrader/portfolio/" $Plinks[1] = "https://investorplace.com/highvelocitystocks/portfolio/" $Plinks[2] = "https://investorplace.com/innovationinvestor/portfolio/" $Plinks[3] = "https://investorplace.com/earlystageinvestor/portfolio/" $Plinks[4] = "https://investorplace.com/platinumgrowthclub/portfolio/" $Plinks[5] = "https://investorplace.com/platinumgrowthclub/portfolio/top-10-stocks/" $Plinks[6] = "https://investorplace.com/acceleratedprofits/portfolio/" $Plinks[7] = "https://investorplace.com/aiadvantage/portfolio/" $Plinks[8] = "https://investorplace.com/airevolutionportfolio/portfolio/" $Plinks[9] = "https://investorplace.com/omnia/portfolio/" $Plinks[10] = "" ;Filenames for the downloaded portfolios for opening CSV file and accessing the tkrs for TC2000 watchlists Global $IPportsFNs[15] $IPportsFNs[0] = "lukelangosaitrader-portfolio.csv" $IPportsFNs[1] = "highvelocitystocks-portfolio.csv" $IPportsFNs[2] = "lukelangosinnovationinvestor-portfolio.csv" $IPportsFNs[3] = "lukelangosearlystageinvestor-portfolio.csv" $IPportsFNs[4] = "platinumgrowthclub-portfolio.csv" $IPportsFNs[5] = "platinumgrowthclub-top-10-stocks.csv" $IPportsFNs[6] = "acceleratedprofits-portfolio.csv" $IPportsFNs[7] = "louisnavelliersaiadvantage-portfolio.csv" $IPportsFNs[8] = "airevolutionportfolio-portfolio.csv" $IPportsFNs[9] = "omnia-portfolio.csv" $IPportsFNs[10] = "" Global $Pctr = 4 ;Portfolio counter Global $PFctr = 4 ;Portfolio File counter ;Global $sPSession ;Open the first Portfolio and sign in Local $Hndlport = _WD_Window($sPSession, 'new', '{"type":"window"}') ;MsgBox(0,"Status","port window created") _WD_Window($sPSession, 'RECT', '{"x":0, "y":82, "width":1280, "height":635}') Consolewrite( "Sized $HndlIPport window" & @CRLF) _WD_Window($sPSession, 'Switch', '{"handle":"' & $Hndlport & '"}') Consolewrite( "Switched to $HndlIPport window" & @CRLF) ;#cs ;MsgBox(0,"Status","Session switched to IPport window") _WD_Navigate($sPSession, $Plinks[$Pctr]) Consolewrite( "Nav $HndlIPport window to IP Port" & @CRLF) MsgBox(0,"status","Pause for SignIn") ;SIGN-IN TO THE PLATINUM GROWTH PORTFOLIO ;SIGNED INTO THE PG PORTFOLIO CONTAINING THE SUB-PORTFOLIOS ; ACCESS EACH OF THE SUB-PORTFOLIOS - Read a table for each ;Local $sMainContentElement = //*[@id="main-content"] ;ID (XPATH) of Main Content (All sub-portfolios} ;Local $sMainContentCSSsel = "/html/body/main/article/div" ;CSS Selector of Main Content (All sub-portfolios} Local $sDividendTableElement = "/html/body/main/article/div/div[1]" ;XPATH of Dividend Table ;/html/body/main/article/div ;/html/body/main/article/div/div[1] DIVIDEND TABLE (INCLUDES THE HEADER LINE) ;/html/body/main/article/div/div[1]/table ;/html/body/main/article/div/div[1]/table/tbody[1] JUST THE TABLE, NO HEADINGS - Still have the \n & \t characters in array!! ;/html/body/main/article/div/div[1]/table/tbody[1]/tr[1]/td[1] Sticky/wide one ;/html/body/main/article/div/div[1]/table/tbody[1]/tr[1] Just the first ;Local $MainContent = _WD_GetElementById($sPSession, $sMainContentCSSsel) ;Local $MainContent = _WD_FindElement($sPSession, $_WD_LOCATOR_ByXPath, $sMainContentCSSsel, Default, True) ;NOTE: This returns a link to 1st element ;MsgBox(0,"status","Main content element accessed?") ;_ArrayDisplay($MainContent, "Main Content") Global $DividendTable $DividendTable = _WD_GetTable($sPSession, $sDividendTableElement) MsgBox(0,"status","Dividend Table accessed?") Global $iRows = UBound($DividendTable, $UBOUND_ROWS) ; Total number of rows. In this example it will be 10. Global $iCols = UBound($DividendTable, $UBOUND_COLUMNS) ; Total number of columns. In this example it will be 20. Global $Dividend[100][9] MsgBox(0,"Rows = ",$iRows) MsgBox(0,"Cols = ",$iCols) _ArrayDisplay($DividendTable, "Dividend Table") ExitScript() Func ExitScript() ;CLOSE OUT ALL EXCEL INSTANCES ;CLOSE OUT THE WebDriver UDF ;_WD_DeleteSession($sPSession) ;Try _WD_Shutdown() if this doesn't work next time ;_WD_Shutdown() Exit EndFunc