I've created a short script that saves specific information to a text file so that it can be transmitted to a digital outdoor sign. When I run it as a script, it works great. When I enclose it in the xml code and install it as an extension, it stops the streaming updates. The script still runs and save the information to the text file, but the numbers in the PSS never get updated. Below is the script. Can you tell me what I've done wrong?
<pss_extension name="Sign Ticker" version="1.0">Sign Ticker Extension
<author email="kim@ddcnet.com" name="Sign Ticker Software" url="http://www.ddcnet.com"
/>
<script language="VBScript">
<![CDATA[
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.currentdirectory = "C:\Program Files\Personal Stock Streamer"
'MsgBox WshShell.SpecialFolders("Desktop")
' get the active document
Dim document
set document = application.ActiveDocument
' get the portfolios collection
Dim portfolios
set portfolios = document.Portfolios
Dim portfolio, folders, folder, tickers, ticker, foldername, change
' show something about each portfolio
for each portfolio in portfolios
set folders = portfolio.Folders
for each folder in folders
foldername = folder.GetProperty("Name")
'MsgBox foldername
if (foldername = "Sign") then
set tickers = folder.Tickers
for each ticker in tickers
symbol = ticker.GetProperty("Symbol")
change =
change+CStr(Round(ticker.GetProperty("Change"),2))+chr(10)
'MsgBox "Got symbol: " + symbol
next
end if
next
next
Dim objFSO, objFolder, objShell, objTextFile, objFile
Dim strDirectory, strFile, strText
strDirectory = WshShell.SpecialFolders("Desktop")
strFile = "\stocks.txt"
' Create the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Check that the strDirectory folder exists
If objFSO.FolderExists(strDirectory) Then
Set objFolder = objFSO.GetFolder(strDirectory)
Else
Set objFolder = objFSO.CreateFolder(strDirectory)
'MsgBox "Just created " & strDirectory
End If
If objFSO.FileExists(strDirectory & strFile) Then
Set objFolder = objFSO.GetFolder(strDirectory)
Else
Set objFile = objFSO.CreateTextFile(strDirectory & strFile)
'MsgBox "Just created " & strDirectory & strFile
End If
set objFile = nothing
set objFolder = nothing
' OpenTextFile Method needs a Const value
' ForAppending = 8 ForReading = 1, ForWriting = 2
Const ForWriting = 2
Do
WshShell.currentdirectory = "C:\Program Files\Personal Stock Streamer"
change=""
for each ticker in tickers
symbol = ticker.GetProperty("Symbol")
change = change+CStr(Round(ticker.GetProperty("Change"),2))+chr(10)
'MsgBox "Got symbol: " + symbol
next
Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, ForWriting, True)
objTextFile.WriteLine change
objTextFile.Close
Call WshShell.Run ("sleep.vbs", ,true)
Loop
]]>
</script>
</pss_extension>