308
Third-party add-ins
Scripting support offers many possibilities for third-party developers. For the latest
news on third-party add-ins, visit the VTOM Scripts section of the Macromedia
Developer Exchange at www.macromedia.com/desdev/developer/.
Running a script at startup
If you want to distribute an add-in, you can register it to run a script the first time the
program loads.
At start-up, the program executes any scripts it finds listed in this Windows Registry
key:
HKEY_CURRENT_USER\Software\Macromedia\HomeSite+\RunOnce
You can create this key and enter the script name. After this key is read, the program
deletes the entries so that they do not execute again.
Sample startup script
//*************************************************//
// This script adds a toolbar for an application.
// Add a string entry whose value contains the
// absolute path to the script you want to run
//*************************************************//
"MyAppScript"="c:\\MyApp\\MyAppScript.bas"
Sub Main
const TB_NAME = "MyApp"
Dim app
set app = Application
' delete toolbar if it already exists
if app.ToolbarExists(TB_NAME) then
app.DeleteToolbar(TB_NAME)
end if
' recreate toolbar
app.CreateToolbar TB_NAME
' dock it to the bottom
app.SetToolbarDockPos TB_NAME, 2
' add app toolbutton
app.AddAppToolbutton TB_NAME, "c:\MyApp\MyApp.exe", "", "Click to run
MyApp"
' add tag toolbutton
app.AddTagToolbutton TB_NAME, "<div>", "</div>", "DIV Toolbutton",
"DV", ""
' add script toolbutton
app.AddScriptToolbutton TB_NAME, app.AppPath + "test.bas" , "Script
Chapter 15 Scripting the Visual Tools Object Model