新しいツールバーを作成します。CreateToolbarButton コマンドでツールバーにボタンを追加し、 CreateToolbarControl コマンドを使用してコントロール(区切り線、カスケード メニューなど)を追加して外観を調整できます。
oString = CreateToolbar( Name ); |
新しいツールバーのユニークなString識別子を戻します。
| パラメータ | タイプ | 説明 |
|---|---|---|
| Name | 文字列 | 新しいツールバーの名前 |
sub Install()
dim file, toolbar, command, path
path = Application.InstallationPath( siUserPath )
file = path & "\Data\Scripts\myUtils.vbs"
'Create Toolbar
toolbar = CreateToolbar("Utilities")
'Create Commands
command = CreateScriptCommand( "Simplify It" ,_
"makeSimple" ,_
file ,_
"MakeSimple",_
"Makes life easier." )
'Add button to toolbar.
CreateToolbarButton toolbar, command
end sub |
// This example illustrates how to use the self-installing plugins to
// create a toolbar.
function XSILoadPlugin( in_reg )
{
in_reg.Author = "YourName";
in_reg.Name = "MyToolbarPlugin";
in_reg.Major = 1;
in_reg.Minor = 1;
in_reg.RegisterCommand( "Create My Toolbar", "CreateMyToolbar" );
if ( ! ToolBar_Exists("My Toolbar") )
CreateMyToolbar_Execute(0);
return true;
}
function CreateMyToolbar_Execute( in_arg0 )
{
var uidToolbar = CreateToolbar( "My Toolbar" );
var uidCmd = Commands("Info Scene").UID;
CreateToolbarButton( uidToolbar, uidCmd );
return true;
}
function ToolBar_Exists(name)
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var folderspec = Application.InstallationPath(siUserPath);
folderspec = fso.BuildPath( folderspec, "Data" );
folderspec = fso.BuildPath( folderspec, "Preferences" );
folderspec = fso.BuildPath( folderspec, "Toolbars" );
var folder = fso.GetFolder(folderspec);
var eFiles = new Enumerator( folder.files );
var re = new RegExp(name,"i");
for ( ; !eFiles.atEnd(); eFiles.moveNext() )
{
var f = eFiles.item();
if ( f.path.search( re ) != -1 )
return true;
}
return false;
} |