This is the Personal Stock Monitor scripting developers forum.
Subscribe to RSS Feed
Developing Custom Stock Market Software using PSM -> Script selected tab & ticker?
Not logged in.
2011-03-09 21:47:22
16 of 21
#3133
in reply to #3127
Howdy Yermo!

Long time no posts. Glad to see you're still with us Yermo

Sounds like a wonderful idea! Sure hope you guys get many new PSM/PSS customers so you can squeeze a bit more time into PSM/PSS stuff.

Cheers,

-Don
Posted by: dgoyette
2011-03-10 10:48:27
17 of 21
#3141
in reply to #3132
dgoyette wrote
Maybe because the account tab item list is being created dynamically, depending on the contents of the portfolio file?

Yes, it's likely to do with that. When I checked the code, it was updating the menu before doing the search for the account tab name, but when I get a chance I will actually write a test script and run it through debugger to see why it's failing.
Posted by: Anatoly
2011-03-11 19:57:07
18 of 21
#3146
in reply to #3141
Thank you Anatoly.
Posted by: dgoyette
\n\n[/code]");
2011-03-14 03:20:05
19 of 21
#3154
in reply to #3141
Howdy Anatoly,

Here's a test script for you. I'll also e-mail it to you.

-Don

<pss_extension name="Change Account Tabs" version="1.0">Change Account Tabs.

<author name="Don Goyette">
</author>


'		HTML text for the mini-browser window form to be displayed later ...
    <resource name="CAT_EntryFormResource">
      <![CDATA[
        <body bgcolor="white">
          <form name="CAT_EntryForm" method="post" target="x">
            <table width="100%" cellspacing="0" cellpadding="2" border="0">

              <tr>
                <td align="center"><br /> &nbsp;Account Tab Name:
									<input  type="text"  size="25"  name=CAT_Form_searchtext  value=""/>
									<br />&nbsp;
								</td>
              </tr>

              <tr>
                <td align="center">
									<input type="submit" value="Run" /> &nbsp;&nbsp;&nbsp;&nbsp;
									<input type="submit" value="Close" />
								</td>
              </tr>

            </table>
          </form>
        </body>
      ]]>
    </resource>


<script language="VBScript">

<![CDATA[

	Class CAT_FormHandlerClass


'-----------------------------------------------------------------------------
	Public Function OnMenuItemSelected ( id )
'-----------------------------------------------------------------------------
    If (id <> G_CAT_MyForm) Then
      Exit Function
		Else
			G_CAT_MyScriptName = "Change Account Tabs"  ' Define our global script-name text
    End If

'		Build and display a PSM mini-browser window ...
'   Create a PSM mini-browser window ...
    Set CAT_wndManager = Application.GetObject("WindowManager")
    Set G_CAT_wndBrowser = CAT_wndManager.CreateBrowserWindow(200, 125, me)

'   Get the pre-defined HTML form text (defined above) ...
    G_CAT_FormText = Script.GetResource("CAT_EntryFormResource")

'   Put the HTML into the browser window ...
    G_CAT_wndBrowser.SetHTML(G_CAT_FormText)
    G_CAT_wndBrowser.Title = G_CAT_MyScriptName

    OnMenuItemSelected = True

  End Function


'-----------------------------------------------------------------------------
	Public Function OnFormSubmitted ( Form )
'-----------------------------------------------------------------------------
    If (Form.Value("submit") = "Run") Then
			G_CAT_AcctTabName = CStr(Form.Value("CAT_Form_searchtext"))
			If G_CAT_AcctTabName = "" Then
				MsgBox "Please enter an Account Tab name.", vbOKOnly, G_CAT_MyScriptName
				Exit Function
			End If

'			Change account tabs ...
			CAT_MenuManager.SelectItem(CStr(G_CAT_AcctTabName))

		Else  ' The Close button was clicked ...
			Set G_CAT_wndBrowser = Nothing
		End If

		OnFormSubmitted = True

	End Function


'-----------------------------------------------------------------------------
' Define our Global variables ...
'-----------------------------------------------------------------------------
	Dim G_CAT_MyScriptName
	Dim G_CAT_SearchText
	Dim G_CAT_MyForm
  Dim G_CAT_wndBrowser
	Dim G_CAT_FormText
	Dim G_CAT_WindowText


End Class  ' CAT_FormHandlerClass


'-----------------------------------------------------------------------------
' Initialization ...
'-----------------------------------------------------------------------------
' Get the Event & Menu Manager objects ...
	Set CAT_EventManager = Application.GetObject("EventManager")
  Set CAT_MenuManager = Application.GetObject("MenuManager")

' Create a new FormHandler object ...
  Set CAT_FormHandler = new CAT_FormHandlerClass

' Add a sub-menu item to the Edit top-level menu ...
  If (Not CAT_MenuManager Is Nothing) Then
    Set CAT_MainMenu = CAT_MenuManager.MainMenu
    CAT_nToolsMenu = CAT_MainMenu.Find("Tools")

'   Create the Edit top-level menu if it doesn't exist ...
    If (CAT_nToolsMenu = -1) Then
      CAT_nHelpMenu = CAT_MainMenu.Find("Help")
      Set CAT_ToolsMenu = CAT_MainMenu.InsertMenu(CAT_nHelpMenu, "Tools")
    Else
      Set CAT_ToolsMenu = CAT_MainMenu.GetSubMenu(CAT_nToolsMenu)
    End If

'   Actually create the sub-menu item ...
    If (Not CAT_ToolsMenu Is Nothing) Then
      CAT_ToolsMenu.InsertSeparator CAT_ToolsMenu.ItemCount  ' Insert a separator line
      CAT_FormHandler.G_CAT_MyForm = CAT_ToolsMenu.InsertItem(CAT_ToolsMenu.ItemCount, "Change Account Tabs")
    End If
  End If

' Register our event handlers ...
  If (Not CAT_EventManager Is Nothing) Then
    CAT_EventManager.RegisterHandlerMethod CAT_FormHandler, "OnMenuItemSelected"
  Else
'   Could not get EventManager object.
  End If


]]>
</script>
</pss_extension>
Posted by: dgoyette
2011-03-14 10:53:43
20 of 21
#3157
in reply to #3146
Thanks!
Posted by: Anatoly
2011-03-14 15:57:06
21 of 21
#3160
in reply to #3157
My pleasure.
Posted by: dgoyette
<< 1 2