Here is some basic VBScript startup code for a standalone script. It doesn't do anything useful yet. You can save it to a .vbs file and run it using the Tools->Run Script command.
' get the active document
Dim document
set document = application.ActiveDocument
' show something
MsgBox "Version: " + application.Version + " Current Document: " + document.Name
Ok, let's play with portfolios:
' get the portfolios collection
Dim portfolios
set portfolios = document.Portfolios
' show something
MsgBox "Got portfolios object (" + CStr(portfolios.Count) + " portfolios)"
Dim portfolio, tickers, ticker
' show something about each portfolio
for each portfolio in portfolios
MsgBox "Got Portfolio: " + portfolio.Name + "(" + CStr(portfolio.Tickers.Count) + _
" tickers, " + CStr(portfolio.Folders.Count) + " folders)"
next
Show a historical chart for MSFT:
for each portfolio in portfolios
set tickers = portfolio.Tickers
for each ticker in tickers
symbol = ticker.GetProperty("Symbol")
if (symbol = "MSFT") then
application.ShowChart ticker, false
end if
next
nextInsert a new portfolio:
set newfolder = document.CreateFolder
if (Not newfolder Is Nothing) then
newfolder.Name = "Screens"
document.InsertPortfolio -1, newfolder
document.CurrentPortfolio = newfolder
end if
Insert a new ticker into the portfolio:
set newticker = document.CreateTicker
if (Not newticker Is Nothing) then
newticker.SetProperty "Symbol", "AMZN"
newticker.SetProperty "Type", "Stock"
newfolder.Insert -1, newticker
end if
These are just a few samples.

