Forum

Free Download More Info
Welcome to the Personal Stock Streamer Developers Forum. Anyone can read messages, but you must be a registered user in order to post. (Sorry, we did this in order to prevent forum spam.)

Everyone who is registered for the Developers Forum on this site should now also have permission to log in and post to the Support Forum.  This was done by hand, so we may have missed a couple of people.  Please let us know if you do not have access to both forums.
Subscribe to RSS Feed
PSS Developers Forum -> Extension stops streaming
Not logged in.
2008-03-17 10:28:28
1 of 5
#1209
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>

 


Posted by: ksturgis
2008-03-18 09:49:42
2 of 5
#1210
in reply to #1209
It looks like your extension creates an infinite loop that never returns control to the main application. In order to get quotes updated, your extension will have to be rewritten to be event-driven so that the main application can run and update quotes.

If you take a look at our sample extensions, in particular the Trailing Stop extension, (in the Articles section of the web site) you will see how it creates and installs a handler object that gets called whenever a ticker gets updated. So you could do it this way, or with a timer handler (see EventManager::OnAppTimer).
      
Anatoly Ivasyuk
DTLink Software

Anatoly Ivasyuk
DTLink Software
2008-03-18 11:35:57
3 of 5
#1212
in reply to #1211
Sorry, can't log in automatically. But it's just one button after the username and license key are entered the first time.
      
Anatoly Ivasyuk
DTLink Software

Anatoly Ivasyuk
DTLink Software
2008-03-18 12:13:23
4 of 5
#1211
in reply to #1210
That worked perfectly. Thank you, thank you! Now can you tell me just one more thing? Is it possible to set the PSS to automatically log in to the quote service (once he is signed up)? I'm trying to make this as easy as possible for my friend, so that all he has to do is run the program.
      

Posted by: ksturgis
2008-03-18 13:19:34
5 of 5
#1213
in reply to #1212
Ok... he'll have to live with that. Thanks so much for you help.
      

Posted by: ksturgis