📄 appwizard.js
字号:
function AppWizard(){ var win = application.getWindow(); var wp = new BiWizardPane; wp.setLocation( 0, 0 ); wp.setRight( 0 ); wp.setBottom( 0 ); wp.addEventListener( "finish", this.finish, this ); wp.addEventListener( "cancel", this.cancel, this ); win.add( wp ); //var backdrop = new BiImage( "images/backdrop.gif", 132, 300 ); //////////////////////// // Page 1 var page1 = new BiComponent; wp.addPage( page1 ); page1.addEventListener( "activated", function () { nameTextField.setFocused( true ); nameTextField.selectAll(); win.setAcceptButton( wp.getNextButton() ); } ); var l = new BiLabel( "This wizard helps you get started with your Bindows application.\n\n" + "Type the name of the application:" ); l.setLocation( 0, 0 ); l.setRight( 0 ); l.setBottom( 0 ); l.setWrap( true ); page1.add( l ); var nameTextField = this.nameTextField = new BiTextField( "MyApplication" ); this.nameTextField.setLocation( 0, 55 ); this.nameTextField.setWidth( 200 ); page1.add( this.nameTextField ); //////////////////////// // Page 2 var page2 = new BiComponent; wp.addPage( page2 ); page2.addEventListener( "activated", function ( e ) { win.setAcceptButton( wp.getNextButton() ); wp.getNextButton().setFocused( true ); },this ); var l2 = new BiLabel( "Select the default controls you want included in your application." ); l2.setLocation( 0, 0 ); l2.setRight( 0 ); l2.setBottom( 0 ); l2.setWrap( true ); this.menuBarCheck = new BiCheckBox( "Menu bar", true ); this.menuBarCheck.setMnemonic( "m" ); this.menuBarCheck.setAccessKey( "m" ); this.menuBarCheck.setPadding( 0, 2 ); this.menuBarCheck.setTop( 37 ); this.toolBarCheck = new BiCheckBox( "Tool bar", true ); this.toolBarCheck.setMnemonic( "t" ); this.toolBarCheck.setAccessKey( "t" ); this.toolBarCheck.setPadding( 0, 2 ); this.toolBarCheck.setTop( 57 ); this.sideBarCheck = new BiCheckBox( "Side bar", true ); this.sideBarCheck.setMnemonic( "i" ); this.sideBarCheck.setAccessKey( "i" ); this.sideBarCheck.setPadding( 0, 2 ); this.sideBarCheck.setTop( 77 ); this.statusBarCheck = new BiCheckBox( "Status bar", true ); this.statusBarCheck.setMnemonic( "s" ); this.statusBarCheck.setAccessKey( "s" ); this.statusBarCheck.setPadding( 0, 2 ); this.statusBarCheck.setTop( 97 ); page2.add( l2 ); page2.add( this.menuBarCheck ); page2.add( this.toolBarCheck ); page2.add( this.sideBarCheck ); page2.add( this.statusBarCheck ); //////////////////////// // Page 3 var page3 = new BiComponent; wp.addPage( page3 ); var l3 = new BiLabel; l3.setLocation( 0, 0 ); l3.setRight( 0 ); l3.setBottom( 0 ); l3.setWrap( true ); page3.addEventListener( "activated", function () { var name = nameTextField.getText(); l3.setHtml( "A directory called " + name + " will be created. Inside this directory the following files have been created:<br /><br />" + "<b>index.html</b> - This page can be opened to host the application.<br />" + "<b>launcher.html</b> - A simple page that includes a link that opens the application in a new window.<br />" + "<b>" + name + ".hta</b> - This is a Windows application hosting the application.<br />" + "<b>" + name + ".js</b> - The main source code for the application.<br />" + "<b>" + name + ".xml</b> - The ADF file describing the application." ); win.setAcceptButton( wp.getFinishButton() ); wp.getFinishButton().setFocused( true ); } ); var launchCheck = this.launchCheck = new BiCheckBox( "Launch application when finished", true ); launchCheck.setMnemonic( "l" ); launchCheck.setAccessKey( "l" ); launchCheck.setPadding( 0, 2 ); launchCheck.setTop( 210 ); page3.add( l3 ); page3.add( launchCheck ); //////////////////////// //wp.setSelectedIndex( 0 ); win.setCancelButton( wp.getCancelButton() );}_p = AppWizard.prototypeAppWizard.main = function (){ new AppWizard;};AppWizard.prototype.finish = function (){ // test name var name = this.nameTextField.getText(); if ( !/^[a-zA-Z_\$][a-zA-Z0-9_\$]*$/.test( name ) ) { alert( "Invalid application name \"" + name + "\"" ); this.showPage( 0 ); return; } // use function directly if defined if ( typeof makeNewApp == "function" ) { sAppName = name; bMenuBar = this.menuBarCheck.getValue(); bToolBar = this.toolBarCheck.getValue(); bSideBar = this.sideBarCheck.getValue(); bStatusBar = this.statusBarCheck.getValue(); if ( makeNewApp() ) { if ( !this.launchCheck.getValue() || biExec( application.getPath(), sAppName + "/" + sAppName + ".xml" ) ) { application.getWindow().close(); } } } // otherwise call the script file else { var s = "cscript MakeNewApp.js " + name + (this.menuBarCheck.getValue() ? "" : " /nomenubar") + (this.toolBarCheck.getValue() ? "" : " /notoolbar") + (this.sideBarCheck.getValue() ? "" : " /nosidebar") + (this.statusBarCheck.getValue() ? "" : " /nostatusbar"); var wsh = new ActiveXObject("WScript.Shell"); var res = wsh.Run( s ); }};AppWizard.prototype.cancel = function (){ application.getWindow().close();};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -