;#Region ;**** Directives created by AutoIt3Wrapper_GUI **** ;#AutoIt3Wrapper_Version=Beta ;;#AutoIt3Wrapper_UseX64=n ;#AutoIt3Wrapper_UseX64=Y ;Should be used for stuff like tagpoint having right struct etc. when running on a 64 bits os ;#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;#AutoIt3Wrapper_Run_Debug_Mode=Y ;******************************************************************************************************************** ;NOTE: CAPTURE THE NEW,SELL, etc. ICONS from the portfolios so can be included in the Watchlists spreadsheets ;******************************************************************************************************************** ;INVESTING SCRIPT - Watchlists (Grades & ERD), Zacks & Yahoo Finance websites synced, and Grade Updates ; 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 ;From UI Examples, may not need all #include #include #include #include #include #include "UIAWrappers.au3" #include ;#include <_Dbug.au3> #include ;***** WebDriver Settup **************************************************************** #include "wd_core.au3" #include "wd_helper.au3" Global $sDesiredCapabilities, $sSession, $sScriptName 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 = "C:\Users\dgend\OneDrive\Documents\My Google Docs\main\A TRADING 2023\SCRIPTS DEV\geckodriver.exe" ; <== 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}}' ;***** WebDriver Settup Finish **************************************************************** ;_DebugSetup() ;NOTE: COMMENT THIS OUT TO SEE IF THE ABOVE DEBUG SETUP STATEMENT THEN WORKS ;************************* ;AutoItSetOption ( "option" [, param] ) ;AutoItSetOption ("TrayIconDebug", 1) ;Opt("TrayIconDebug", 0) ;0=no info, 1=debug line info ;*************************** AutoItSetOption("MustDeclareVars", 1) Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client _UIA_Init() HotKeySet("{ESC}","ExitScript") dim $UL[4]=[-1078,226,1078,330] dim $LL[4]=[-1078,556,1078,1538] dim $error ;DECLARATIONS FOR THE BROWSER WEBSITES Global $concactenate Global $tkrURL Global $zacksURL Global $YahooURL Global $AddTkr Global $yahooID ;yahoo session ID Global $sSession ;zacks session ID Global $Hndlzacks Global $Hndlyahoo Global $zacksSite = "http://www.zacks.com" Global $yahooSite = "https://finance.yahoo.com" dim $rtnerror ;AutoItSetOption ( "option" [, param] ) FORMAT ;*****************************************AutoItSetOption ( "WinTitleMatchMode" , 2) ;MATCH SUBSTRING OF TITLE (Zacks & Yahoo) ;#cs _WD_Startup() Global $sUnameElement Global $sExportElement $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://investorplace.com/growthinvestor/portfolio/") _WD_LoadWait($sSession) ;_WD_Window($sSession, "maximize") ;MsgBox(0,"status","Chk Title") $sUnameElement = _WD_GetElementByName($sSession, "username") _WD_SetElementValue($sSession, $sUnameElement, "dgendrud@reagan.com") $sUnameElement = _WD_GetElementByName($sSession, "password") _WD_SetElementValue($sSession, $sUnameElement, "Henderson@1825") $sUnameElement = _WD_GetElementByName($sSession, "TAsubmit") ;_WD_ElementAction($sSession, $sElement, $sCommand[, $sOption = Default]) THIS IS THE FORMAT _WD_ElementAction($sSession, $sUnameElement, "CLICK") _WD_LoadWait($sSession) Sleep(500) ;NOW SIGNED IN, TRY TO ACCESS ALL TICKER-ASSOCIATED ICONS ;NOTE: The csv downloading of the Portfolo was deleted here in this script so that an attempt at accessing the ICONS directly could be tried ;If this does not work, then return to the "IP Portfolios Mgmt" script and try using string search with the full HTML source. ; Locate multiple matching elements for link to TKR inner HTML Global $aElements ;Get the link element - There appears there is only one element due to the XPath locator used (link by text did not seem to work) ;This XPath find now seems to work and return a value Local $aFirstTkr = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/main/article/div/div[1]/table/tbody[1]/tr[1]/td[1]/a", DEFAULT,DEFAULT) ;Can't get a match with this ;$aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByLinkText, "https://investorplace.com/growthinvestor/stock-report/adm/", DEFAULT, TRUE) ;_ArrayDisplay($aFirstTkr, "Found Elements") MsgBox(0,"Returned",$aFirstTkr) ;Now retrieve the inner HTML ;_WD_ElementAction($sSession, $sElement, $sCommand[, $sOption = Default]) FORMAT Global $nam = _WD_ElementAction($sSession, $aFirstTkr, "NAME") Global $text = _WD_ElementAction($sSession, $aFirstTkr, "TEXT") Consolewrite("$nam = " & $nam & @CRLF) ;the name printed as "a", this looks like the same on all of the tickers; Could do a multiple on that? Consolewrite("$text = " & $text & @CRLF) ;THE RETURNS THE TICKER, ADM!! MsgBox(0,"Status ","NAME/TEXT") ;_WD_FindElement($sSession, $sStrategy, $sSelector[, $sStartNodeID = Default[, $bMultiple = Default[, $bShadowRoot = Default]]]) FORMAT $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByTagName, "a", $aFirstTkr, "TRUE", "FALSE") ;$aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByTagName, "a", "", "TRUE", "FALSE") _ArrayDisplay($aElements, "Found Elements") MsgBox(0,"Status","Consolewrite NAME/TEXT") ;#cs Local $Elnum = 0 While $Elnum<40 $Elnum=$Elnum+1 $text = _WD_ElementAction($sSession, $aElements[$Elnum], "TEXT") Consolewrite("$Elnum,$text = " & $Elnum & " " & $text & @CRLF) WEnd ;#ce MsgBox(0,"status","Click to Exit") ExitScript() Func ExitScript() Consolewrite("Got to ExitScript") ;_WD_DeleteSession($sSession) Exit EndFunc