Update ooo320-m1
[ooovba.git] / helpcontent2 / source / text / shared / guide / scripting.xhp
blob1fc3d0f77a2b1bfe3f71d1b0ba8cc7d5752336f5
1 <?xml version="1.0" encoding="UTF-8"?>
2 <helpdocument version="1.0">
4 <!--
5 ***********************************************************************
7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 *
9 * Copyright 2008 by Sun Microsystems, Inc.
11 * OpenOffice.org - a multi-platform office productivity suite
13 * $RCSfile: scripting.xhp,v $
14 * $Revision: 1.17.4.1 $
16 * This file is part of OpenOffice.org.
18 * OpenOffice.org is free software: you can redistribute it and/or modify
19 * it under the terms of the GNU Lesser General Public License version 3
20 * only, as published by the Free Software Foundation.
22 * OpenOffice.org is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU Lesser General Public License version 3 for more details
26 * (a copy is included in the LICENSE file that accompanied this code).
28 * You should have received a copy of the GNU Lesser General Public License
29 * version 3 along with OpenOffice.org. If not, see
30 * <http://www.openoffice.org/license.html>
31 * for a copy of the LGPLv3 License.
33 ************************************************************************
34 -->
37 <meta>
38 <topic id="textsharedguidescriptingxml" indexer="include">
39 <title id="tit" xml-lang="en-US">Scripting %PRODUCTNAME</title>
40 <filename>/text/shared/guide/scripting.xhp</filename>
41 </topic>
42 </meta>
43 <body>
44 <bookmark xml-lang="en-US" branch="index" id="bm_id5277565"><bookmark_value>assigning scripts</bookmark_value>
45 <bookmark_value>programming;scripting</bookmark_value>
46 <bookmark_value>form controls;assigning macros</bookmark_value>
47 <bookmark_value>pictures;assigning macros</bookmark_value>
48 <bookmark_value>hyperlinks;assigning macros</bookmark_value>
49 <bookmark_value>shortcut keys;assigning macros</bookmark_value>
50 <bookmark_value>controls;assigning macros (Basic)</bookmark_value>
51 <bookmark_value>menus;assigning macros</bookmark_value>
52 <bookmark_value>events;assigning scripts</bookmark_value>
53 </bookmark><comment>MW deleted "programming;...", "scripting in programming", "BeanShell scripting", "Basic;..." and "java;..."</comment><comment>MW added "controls;..", "menus;..." and "events;..."</comment>
54 <paragraph role="heading" id="par_idN1070A" xml-lang="en-US" level="1" l10n="NEW"><variable id="scripting"><link href="text/shared/guide/scripting.xhp">Assigning Scripts in %PRODUCTNAME</link>
55 </variable></paragraph>
56 <paragraph role="paragraph" id="par_idN10728" xml-lang="en-US" l10n="NEW">You can assign custom scripts (macros) to menu items, icons, dialog controls, and events in %PRODUCTNAME.</paragraph>
57 <paragraph role="paragraph" id="par_idN1072B" xml-lang="en-US" l10n="NEW">%PRODUCTNAME internally supports the following scripting languages:</paragraph>
58 <list type="ordered">
59 <listitem>
60 <paragraph role="paragraph" id="par_idN10731" xml-lang="en-US" l10n="NEW">%PRODUCTNAME Basic</paragraph>
61 </listitem>
62 <listitem>
63 <paragraph role="paragraph" id="par_idN10739" xml-lang="en-US" l10n="NEW">JavaScript</paragraph>
64 </listitem>
65 <listitem>
66 <paragraph role="paragraph" id="par_idN1073D" xml-lang="en-US" l10n="CHG">BeanShell</paragraph>
67 </listitem>
68 </list>
69 <list type="ordered">
70 <listitem>
71 <paragraph role="paragraph" id="par_id6797082" xml-lang="en-US" l10n="CHG">Python (not included with all distributions)<comment>i50641</comment><comment>removed switch, added text</comment></paragraph>
72 </listitem>
73 </list>
74 <paragraph role="paragraph" id="par_idN1091F" xml-lang="en-US" l10n="NEW">In addition, developers can use high-level languages, for example Java programming language, to control %PRODUCTNAME externally. See the API project at OpenOffice.org.</paragraph>
75 <paragraph role="heading" id="par_idN10751" xml-lang="en-US" level="2" l10n="NEW">To assign a script to a new menu entry</paragraph>
76 <list type="ordered">
77 <listitem>
78 <paragraph role="paragraph" id="par_idN10758" xml-lang="en-US" l10n="NEW">Choose <emph>Tools - Customize</emph>, and click the <emph>Menus</emph> tab.</paragraph>
79 </listitem>
80 <listitem>
81 <paragraph role="paragraph" id="par_idN1093D" xml-lang="en-US" l10n="NEW">Click <emph>Add</emph>.</paragraph>
82 </listitem>
83 <listitem>
84 <paragraph role="paragraph" id="par_idN10760" xml-lang="en-US" l10n="NEW">In the <emph>Category</emph> list box, scroll down and open the "%PRODUCTNAME Macros" entry.</paragraph>
85 </listitem>
86 <listitem>
87 <paragraph role="paragraph" id="par_idN10768" xml-lang="en-US" l10n="NEW">You see entries for "%PRODUCTNAME Macros" (scripts in the share directory of your %PRODUCTNAME installation), "My Macros" (scripts in the user directory), and the current document. Open any one of them to see the supported scripting languages.</paragraph>
88 </listitem>
89 <listitem>
90 <paragraph role="paragraph" id="par_idN1076C" xml-lang="en-US" l10n="NEW">Open any scripting language entry to see the available scripts. Select a script.</paragraph>
91 </listitem>
92 <listitem>
93 <paragraph role="paragraph" id="par_idN10770" xml-lang="en-US" l10n="NEW">A list of the script functions appears in the <emph>Commands</emph> list box. Select a function.</paragraph>
94 </listitem>
95 <listitem>
96 <paragraph role="paragraph" id="par_idN10778" xml-lang="en-US" l10n="NEW">Click <emph>Add</emph> to create a new menu assignment. The new menu entry appears in the <emph>Entries</emph> list box.</paragraph>
97 </listitem>
98 </list>
99 <paragraph role="heading" id="par_idN10783" xml-lang="en-US" level="2" l10n="NEW">To assign a script to a key combination</paragraph>
100 <list type="ordered">
101 <listitem>
102 <paragraph role="paragraph" id="par_idN10787" xml-lang="en-US" l10n="NEW">Choose <emph>Tools - Customize - Keyboard</emph>.</paragraph>
103 </listitem>
104 <listitem>
105 <paragraph role="paragraph" id="par_idN10A59" xml-lang="en-US" l10n="NEW">In the <emph>Category</emph> list box, scroll down and open the "%PRODUCTNAME Macros" entry.</paragraph>
106 </listitem>
107 <listitem>
108 <paragraph role="paragraph" id="par_idN10A61" xml-lang="en-US" l10n="NEW">You see entries for "%PRODUCTNAME Macros" (scripts in the share directory of your %PRODUCTNAME installation), "My Macros" (scripts in the user directory), and the current document. Open any one of them to see the supported scripting languages.</paragraph>
109 </listitem>
110 <listitem>
111 <paragraph role="paragraph" id="par_idN10A65" xml-lang="en-US" l10n="NEW">Open any scripting language entry to see the available scripts. Select any script.</paragraph>
112 </listitem>
113 <listitem>
114 <paragraph role="paragraph" id="par_idN10A69" xml-lang="en-US" l10n="NEW">A list of the script functions will appear in the <emph>Commands</emph> list box. Select any function.</paragraph>
115 </listitem>
116 <listitem>
117 <paragraph role="paragraph" id="par_idN10A71" xml-lang="en-US" l10n="NEW">Click the option button for %PRODUCTNAME or Writer (or whichever application is currently open). </paragraph>
118 <paragraph role="paragraph" id="par_idN10A74" xml-lang="en-US" l10n="NEW">Selecting the option button sets the scope of the new key combination to be applicable in all of %PRODUCTNAME or only in documents of the current module.</paragraph>
119 </listitem>
120 <listitem>
121 <paragraph role="paragraph" id="par_idN10A78" xml-lang="en-US" l10n="NEW">Select a key combination from the <emph>Shortcut keys</emph> list box and click <emph>Modify</emph>.</paragraph>
122 </listitem>
123 </list>
124 <paragraph role="heading" id="par_idN1078A" xml-lang="en-US" level="2" l10n="NEW">To assign a script to an event</paragraph>
125 <list type="ordered">
126 <listitem>
127 <paragraph role="paragraph" id="par_idN1078E" xml-lang="en-US" l10n="NEW">Choose <emph>Tools - Customize - Events</emph>.</paragraph>
128 </listitem>
129 <listitem>
130 <paragraph role="paragraph" id="par_idN10A16" xml-lang="en-US" l10n="NEW">Click <emph>Macro</emph> button.</paragraph>
131 </listitem>
132 <listitem>
133 <paragraph role="paragraph" id="par_idN10A9E" xml-lang="en-US" l10n="NEW">In the <emph>Library</emph> list box, scroll down and open the "%PRODUCTNAME Macros" entry.</paragraph>
134 </listitem>
135 <listitem>
136 <paragraph role="paragraph" id="par_idN10AA6" xml-lang="en-US" l10n="NEW">You see entries for "%PRODUCTNAME Macros" (scripts in the share directory of your %PRODUCTNAME installation), "My Macros" (scripts in the user directory), and the current document. Open any one of them to see the supported scripting languages.</paragraph>
137 </listitem>
138 <listitem>
139 <paragraph role="paragraph" id="par_idN10AAA" xml-lang="en-US" l10n="NEW">Open any scripting language entry to see the available scripts. Select any script.</paragraph>
140 </listitem>
141 <listitem>
142 <paragraph role="paragraph" id="par_idN10AAE" xml-lang="en-US" l10n="NEW">A list of the script functions will appear in the <emph>Assigned Action</emph> list box. Select any function.</paragraph>
143 </listitem>
144 <listitem>
145 <paragraph role="paragraph" id="par_idN10AB6" xml-lang="en-US" l10n="NEW">Select to save in %PRODUCTNAME or current document.</paragraph>
146 <paragraph role="paragraph" id="par_idN10AB9" xml-lang="en-US" l10n="CHG">This sets the scope of the new event assignment to be applicable in all of %PRODUCTNAME or only in documents of the current module.</paragraph>
147 </listitem>
148 <listitem>
149 <paragraph role="paragraph" id="par_idN10ABD" xml-lang="en-US" l10n="NEW">Select an event from the list and click <emph>OK</emph>.</paragraph>
150 </listitem>
151 </list>
152 <paragraph role="heading" id="par_idN10791" xml-lang="en-US" level="2" l10n="NEW">To assign a script to an event for an embedded object</paragraph>
153 <list type="ordered">
154 <listitem>
155 <paragraph role="paragraph" id="par_idN10795" xml-lang="en-US" l10n="NEW">Select the embedded object, for example a chart, in your document.</paragraph>
156 </listitem>
157 <listitem>
158 <paragraph role="paragraph" id="par_idN10ADB" xml-lang="en-US" l10n="NEW">Choose <emph>Format - Frame/Object - Macro</emph>.</paragraph>
159 </listitem>
160 <listitem>
161 <paragraph role="paragraph" id="par_idN10ADF" xml-lang="en-US" l10n="NEW">In the <emph>Macros</emph> list box, open the %PRODUCTNAME Scripts entry.</paragraph>
162 </listitem>
163 <listitem>
164 <paragraph role="paragraph" id="par_idN10AE7" xml-lang="en-US" l10n="NEW">You see entries for share (scripts in the share directory of your %PRODUCTNAME installation), user (scripts in the user directory), and the current document. Open any one of them to see the supported scripting languages.</paragraph>
165 </listitem>
166 <listitem>
167 <paragraph role="paragraph" id="par_idN10AEB" xml-lang="en-US" l10n="NEW">Open any scripting language entry to see the available scripts. Select any script.</paragraph>
168 </listitem>
169 <listitem>
170 <paragraph role="paragraph" id="par_idN10AEF" xml-lang="en-US" l10n="NEW">A list of the script functions will appear in the <emph>Existing macros in</emph> list box. Select any function.</paragraph>
171 </listitem>
172 <listitem>
173 <paragraph role="paragraph" id="par_idN10AF7" xml-lang="en-US" l10n="NEW">Select an event from the list and click <emph>OK</emph>.</paragraph>
174 </listitem>
175 </list>
176 <paragraph role="heading" id="par_idN10798" xml-lang="en-US" level="2" l10n="NEW">To assign a script to a hyperlink</paragraph>
177 <list type="ordered">
178 <listitem>
179 <paragraph role="paragraph" id="par_idN1079C" xml-lang="en-US" l10n="NEW">Position the cursor inside the hyperlink. </paragraph>
180 </listitem>
181 <listitem>
182 <paragraph role="paragraph" id="par_idN10B15" xml-lang="en-US" l10n="NEW">Choose <emph>Insert - Hyperlink</emph>.</paragraph>
183 </listitem>
184 <listitem>
185 <paragraph role="paragraph" id="par_idN10B19" xml-lang="en-US" l10n="NEW">Click the <emph>Events</emph> button.</paragraph>
186 </listitem>
187 <listitem>
188 <paragraph role="paragraph" id="par_idN10B21" xml-lang="en-US" l10n="NEW">Select and assign as stated above.</paragraph>
189 </listitem>
190 </list>
191 <paragraph role="heading" id="par_idN1079F" xml-lang="en-US" level="2" l10n="NEW">To assign a script to a graphic</paragraph>
192 <list type="ordered">
193 <listitem>
194 <paragraph role="paragraph" id="par_idN107A3" xml-lang="en-US" l10n="NEW">Select the graphic in your document. </paragraph>
195 </listitem>
196 <listitem>
197 <paragraph role="paragraph" id="par_idN10B3B" xml-lang="en-US" l10n="CHG">Choose <emph>Format - Picture - Macro</emph>.</paragraph>
198 </listitem>
199 <listitem>
200 <paragraph role="paragraph" id="par_idN10B3F" xml-lang="en-US" l10n="NEW">Select and assign as stated above.</paragraph>
201 </listitem>
202 </list>
203 <paragraph role="heading" id="par_idN107A6" xml-lang="en-US" level="2" l10n="NEW">To assign a script to a form control</paragraph>
204 <list type="ordered">
205 <listitem>
206 <paragraph role="paragraph" id="par_idN107AA" xml-lang="en-US" l10n="CHG">Insert a form control, for example a button: Open the Form Controls toolbar, click the <emph>Push Button</emph> icon, drag open a button on your document.</paragraph>
207 </listitem>
208 <listitem>
209 <paragraph role="paragraph" id="par_idN10B59" xml-lang="en-US" l10n="CHG">With the form control selected, click <emph>Control</emph> on the Form Controls toolbar.</paragraph>
210 </listitem>
211 <listitem>
212 <paragraph role="paragraph" id="par_idN10B5D" xml-lang="en-US" l10n="NEW">Click the <emph>Events</emph> tab of the Properties dialog.</paragraph>
213 </listitem>
214 <listitem>
215 <paragraph role="paragraph" id="par_idN10B61" xml-lang="en-US" l10n="NEW">Click one of the <emph>...</emph> buttons to open a dialog where you can assign a script to the selected event.</paragraph>
216 </listitem>
217 </list>
218 <paragraph role="heading" id="par_idN107AD" xml-lang="en-US" level="2" l10n="NEW">To assign a script to a control in the %PRODUCTNAME Basic dialog</paragraph>
219 <list type="ordered">
220 <listitem>
221 <paragraph role="paragraph" id="par_idN107B1" xml-lang="en-US" l10n="NEW">Open the %PRODUCTNAME Basic dialog editor, then create a dialog with a control on it.</paragraph>
222 </listitem>
223 <listitem>
224 <paragraph role="paragraph" id="par_idN10B7F" xml-lang="en-US" l10n="NEW">Right-click the control, then choose <emph>Properties</emph>.</paragraph>
225 </listitem>
226 <listitem>
227 <paragraph role="paragraph" id="par_idN10B87" xml-lang="en-US" l10n="NEW">Click the <emph>Events</emph> tab of the Properties dialog.</paragraph>
228 </listitem>
229 <listitem>
230 <paragraph role="paragraph" id="par_idN10B8B" xml-lang="en-US" l10n="NEW">Click one of the <emph>...</emph> buttons to open a dialog where you can assign a script to the selected event.</paragraph>
231 </listitem>
232 </list>
233 </body>
234 </helpdocument>