Developing Scripts in NetBeans
This 文書 述べるs how to 始める,決める up NetBeans for Office Scripting and how to 令状 a simple script using NetBeans. You can download the NetBeans IDE from the NetBeans download page.Contents:
Pre-requisites
- The Office Scripting module 作品 with NetBeans 3.4
- You should have 任命する/導入するd the Office Scripting module during the 取り付け・設備 過程 for the Scripting 枠組み. If you have not 任命する/導入するd it, see the 取り付け・設備 Guide for 指示/教授/教育s on how to 任命する/導入する.
- On Linux, you will need to 確実にする that your DISPLAY 環境 variable is 始める,決める to <your hostname>:0 in the 爆撃する from which you start NetBeans to work around a problem with Java GUIs in Office.
- Create a directory somewhere on your machine in which you will develop your scripts.
Creating a 小包 Recipe
Office scripts are 配達するd in Script 小包s. Like Office 文書s they are zip とじ込み/提出するs. Script 小包s have the .sxp 拡張. Script 小包s are 生成するd from 小包 Recipes where all of the とじ込み/提出するs that are necessary to create the 小包 are put together. To create a new 小包 Recipe:- 権利 click on your 機動力のある filesystem
- Select New/Office Scripting/小包 Recipe
- In the New Wizard window that appears enter a 指名する for your 小包 Recipe
- Select a language for your 小包 Recipe from the 初期の Script Language dropdown 名簿(に載せる)/表(にあげる).
- Click the Finish button to create your 小包 Recipe
公式文書,認める: To 追加する その上の empty stub scripts to your 小包 Recipe, 権利 click on the Contents directory and use the New/Office Scripting/Empty Script menu item.
活動/戦闘s 利用できる for 小包 Recipe
If the 使用者 権利 clicks on the 小包 directory they should be able to use the に引き続いて 活動/戦闘s:- 収集する: 収集するs all of the .java とじ込み/提出するs in the 小包 Recipe
- Build: 収集するs all of the .java とじ込み/提出するs in the 小包 Recipe. It then searches for valid Office scripts in the language you selected in the Contents directory とじ込み/提出するs and pops up a dialog which 許すs you to select which Java methods or BeanShell scripts you wish to 輸出(する) as Office scripts. Once you have finish making your 選択s, it creates a <小包 Recipe 指名する>.sxp Script 小包 とじ込み/提出する in the 小包 Recipe directory. You can configure what とじ込み/提出するs are put into the Script 小包 using the とじ込み/提出する Filter 所有物/資産/財産. If you script 含むs any jar とじ込み/提出するs that need to be in the classpath when it is 遂行する/発効させるd you should 追加する them to the Classpath 所有物/資産/財産 of your 小包 Recipe.
- Configure: This pops up the Configure dialog, which 許すs you to select what Office scripts to 輸出(する). Any changes you make in this dialog will only appear in your Script 小包 after you run Build again.
活動/戦闘s 利用できる for Script 小包s
Script 小包s supports only one 活動/戦闘:- (軍隊を)展開する,配備する: This will (軍隊を)展開する,配備する the Script 小包 to an Office 文書 or to an Office 取り付け・設備. If the Script 小包 already 存在するs in the 的, you will be asked whether you want to overwrite.
公式文書,認める: If you (軍隊を)展開する,配備する a Script 小包 to an OpenOffice.org 取り付け・設備 you need to use the 道具s/Scripting 追加する-on's/Refresh All Scripts menu item for the new script to appear in the 割り当てる Script dialog.
公式文書,認める: You can also (軍隊を)展開する,配備する to Office 文書s within NetBeans using drag and 減少(する) or 削減(する) and paste.
活動/戦闘s 利用できる for Office 文書s
Office 文書s are also recognised by NetBeans. Any 小包s 含む/封じ込めるd in the 文書 will be 陳列する,発揮するd as nodes of the Office 文書. 削除するing one of these nodes will 除去する the Script 小包 from the 文書. You should 確実にする that the 文書 is not open in OpenOffice.org before 削除するing any 小包s it may 含む/封じ込める. Office 文書s support the 基準 削除する, 削減(する) and Copy 活動/戦闘s and the に引き続いて custom 活動/戦闘s:- Open: This will open the 文書 in Office using the path
in the Office Settings 所有物/資産/財産 to find the Office 取り付け・設備.
If the path to Office is not valid, an error dialog will be popped up 知らせるing the 使用者 that they need to 始める,決める their Path to Office 取り付け・設備 所有物/資産/財産. This setting can be changed by bringing up the 道具s/選択s dialog and changing IDE Configuration/Server and 外部の 道具 Settings/Office Settings
Debugging Java Office scripts in NetBeans
- Follow the 指示/教授/教育s at Debugging Java 構成要素s in NetBeans/Forte for Java to 始める,決める up your Office 取り付け・設備 to 許す debugging of the JVM.
- Start OpenOffice and run one of your Java scripts. This will make sure the JVM is running.
- Attach to Office JVM using the NetBeans Debug/Start 開会/開廷/会期/Attach... menu 選択.
- 負担 a script source in NetBeans and 始める,決める up breakpoints using Debug/New Breakpoint... menu 選択.
- Run the script in Office.
公式文書,認める: As the BeanShell scripting language does not support debugging it is not possible to debug BeanShell Office scripts from NetBeans. You can however use the Interactive BeanShell scripting menu item under the 道具s menu in OpenOffice.org to 実験(する) BeanShell code. Just enter any BeanShell code and 攻撃する,衝突する the Eval button to 遂行する/発効させる it.
Troubleshooting
If you 遭遇(する) problems when developing or (軍隊を)展開する,配備するing scripts in NetBeans, one thing you can try is to move your NetBeans settings directory (.netbeans on UNIX, netbeans in Windows - can be 設立する in your home directory) to another 指名する and 再開する NetBeans.
The Choose What to 輸出(する) as Scripts dialog only 陳列する,発揮するs methods which are defined within class とじ込み/提出するs, it will not 陳列する,発揮する methods in class とじ込み/提出するs which are within jar とじ込み/提出するs in the 小包 Recipe.
If you 含む 一括 指示的なs in the Java source とじ込み/提出するs of your 小包 Recipe, you should 確実にする that the source とじ込み/提出するs are in the appropriate directories for your 一括 指示的なs. This is because the default NetBeans compiler 実施 does not use the -d switch to the Java compiler. As a result class とじ込み/提出するs do not get placed in the appropriate directories and methods in these classes will not appear in the Choose What to 輸出(する) as Scripts dialog.
There are a couple of workarounds for this problem:
- Use the 命令(する) line 道具s
- 始める,決める the 的 旗 in the 道具s/選択s window under Building/Compiler Types/内部の 編集
Last 修正するd: Tue 損なう 12 11:40:28 GMT 2003