This snippet of VB code, added to a top level object, will first display all the current prices and then display each update as it comes in. In this example I've tied the code to the File->New menu item:
Private Sub mnuFileNew_Click()
' get connection to PSS
Set PSSObject = GetObject(, "PSSScript.PSSScriptModule")
Set PSSApp = PSSObject.Application
Set PSSDoc = PSSApp.ActiveDocument
' get top portfolio
Set Portfolios = PSSDoc.Portfolios
Debug.Print "Looking at Portfolio: " + Portfolios.Item(1).Name
' get tickers at top of portfolio (i.e. ones not in folders)
Set Tickers = Portfolios.Item(1).Tickers
For n2 = 1 To Tickers.Count
Debug.Print "Ticker is " + Tickers.Item(n2).GetProperty("Symbol")
Debug.Print "Starting Price is " + CStr(Tickers.Item(n2).GetProperty("Price"))
Next
' the following is if you have your tickers organized in folders.
Set Folders = Portfolios.Item(1).Folders
For n = 1 To Folders.Count
Debug.Print "Looking at Folder: " + Folders.Item(n).Name
Set Tickers = Folders.Item(n).Tickers
For n2 = 1 To Tickers.Count
Debug.Print "Ticker is " + Tickers.Item(n2).GetProperty("Symbol")
Debug.Print "Starting Price is " + CStr(Tickers.Item(n2).GetProperty("Price"))
Next
Next
' get the EventManager class which will notify us when events happen
Set PSSEventManager = PSSApp.GetObject("EventManager")
' tell the event manager to call the OnTickerUpdated method in our
' tickerEvent handler class for each tick on any ticker that comes in.
' note that this callback can happen up to once a second so it should
' run quickly.
PSSEventManager.RegisterHandlerMethod frmMain, "OnTickerUpdated"
End Sub
Public Function onTickerUpdated(ticker)
Debug.Print "Ticker Update"
Debug.Print " Symbol: " + ticker.GetProperty("Symbol")
Debug.Print " Price: " + CStr(ticker.GetProperty("Price"))
End Function
----------------------
DTLink Software
----------------------
DTLink Software