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 /> Account Tab Name:
<input type="text" size="25" name=CAT_Form_searchtext value=""/>
<br />
</td>
</tr>
<tr>
<td align="center">
<input type="submit" value="Run" />
<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>