1<?xml version="1.0" encoding="UTF-8"?>
2<helpdocument version="1.0">
3
4<!--***********************************************************
5 *
6 * Licensed to the Apache Software Foundation (ASF) under one
7 * or more contributor license agreements.  See the NOTICE file
8 * distributed with this work for additional information
9 * regarding copyright ownership.  The ASF licenses this file
10 * to you under the Apache License, Version 2.0 (the
11 * "License"); you may not use this file except in compliance
12 * with the License.  You may obtain a copy of the License at
13 *
14 *   http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing,
17 * software distributed under the License is distributed on an
18 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19 * KIND, either express or implied.  See the License for the
20 * specific language governing permissions and limitations
21 * under the License.
22 *
23 ***********************************************************-->
24
25
26
27
28<meta>
29      <topic id="textsharedguidescriptingxml" indexer="include">
30         <title xml-lang="en-US" id="tit">Scripting %PRODUCTNAME</title>
31         <filename>/text/shared/guide/scripting.xhp</filename>
32      </topic>
33   </meta>
34   <body>
35<bookmark xml-lang="en-US" branch="index" id="bm_id5277565"><bookmark_value>assigning scripts</bookmark_value>
36      <bookmark_value>programming;scripting</bookmark_value>
37      <bookmark_value>form controls;assigning macros</bookmark_value>
38      <bookmark_value>pictures;assigning macros</bookmark_value>
39      <bookmark_value>hyperlinks;assigning macros</bookmark_value>
40      <bookmark_value>shortcut keys;assigning macros</bookmark_value>
41      <bookmark_value>controls;assigning macros (Basic)</bookmark_value>
42      <bookmark_value>menus;assigning macros</bookmark_value>
43      <bookmark_value>events;assigning scripts</bookmark_value>
44</bookmark><comment>MW deleted "programming;...",  "scripting in programming", "BeanShell scripting", "Basic;..."  and "java;..."</comment><comment>MW added "controls;..",  "menus;..." and "events;..."</comment>
45<paragraph xml-lang="en-US" id="par_idN1070A" role="heading" level="1" l10n="NEW"><variable id="scripting"><link href="text/shared/guide/scripting.xhp">Assigning Scripts in %PRODUCTNAME</link>
46</variable></paragraph>
47      <paragraph xml-lang="en-US" id="par_idN10728" role="paragraph" l10n="NEW">You can assign custom scripts (macros) to menu items, icons, dialog controls, and events in %PRODUCTNAME.</paragraph>
48      <paragraph xml-lang="en-US" id="par_idN1072B" role="paragraph" l10n="NEW">%PRODUCTNAME internally supports the following scripting languages:</paragraph>
49      <list type="ordered">
50         <listitem>
51            <paragraph xml-lang="en-US" id="par_idN10731" role="paragraph" l10n="NEW">%PRODUCTNAME Basic</paragraph>
52         </listitem>
53         <listitem>
54            <paragraph xml-lang="en-US" id="par_idN10739" role="paragraph" l10n="NEW">JavaScript</paragraph>
55         </listitem>
56         <listitem>
57            <paragraph xml-lang="en-US" id="par_idN1073D" role="paragraph" l10n="CHG">BeanShell</paragraph>
58         </listitem>
59         <listitem>
60            <paragraph xml-lang="en-US" id="par_id6797082" role="paragraph" l10n="CHG">Python</paragraph>
61         </listitem>
62      </list>
63      <paragraph xml-lang="en-US" id="par_idN1091F" role="paragraph" l10n="NEW">In addition, developers can use high-level languages, for example Java programming language, to control %PRODUCTNAME externally. See the API project at Apache OpenOffice.</paragraph>
64      <paragraph xml-lang="en-US" id="par_idN10751" role="heading" level="2" l10n="NEW">To assign a script to a new menu entry</paragraph>
65      <list type="ordered">
66         <listitem>
67            <paragraph xml-lang="en-US" id="par_idN10758" role="paragraph" l10n="NEW">Choose <emph>Tools - Customize</emph>, and click the <emph>Menus</emph> tab.</paragraph>
68         </listitem>
69         <listitem>
70            <paragraph xml-lang="en-US" id="par_idN1093D" role="paragraph" l10n="NEW">Click <emph>Add</emph>.</paragraph>
71         </listitem>
72         <listitem>
73            <paragraph xml-lang="en-US" id="par_idN10760" role="paragraph" l10n="NEW">In the <emph>Category</emph> list box, scroll down and open the "%PRODUCTNAME Macros" entry.</paragraph>
74         </listitem>
75         <listitem>
76            <paragraph xml-lang="en-US" id="par_idN10768" role="paragraph" 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>
77         </listitem>
78         <listitem>
79            <paragraph xml-lang="en-US" id="par_idN1076C" role="paragraph" l10n="NEW">Open any scripting language entry to see the available scripts. Select a script.</paragraph>
80         </listitem>
81         <listitem>
82            <paragraph xml-lang="en-US" id="par_idN10770" role="paragraph" l10n="NEW">A list of the script functions appears in the <emph>Commands</emph> list box. Select a function.</paragraph>
83         </listitem>
84         <listitem>
85            <paragraph xml-lang="en-US" id="par_idN10778" role="paragraph" 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>
86         </listitem>
87      </list>
88      <paragraph xml-lang="en-US" id="par_idN10783" role="heading" level="2" l10n="NEW">To assign a script to a key combination</paragraph>
89      <list type="ordered">
90         <listitem>
91            <paragraph xml-lang="en-US" id="par_idN10787" role="paragraph" l10n="NEW">Choose <emph>Tools - Customize - Keyboard</emph>.</paragraph>
92         </listitem>
93         <listitem>
94            <paragraph xml-lang="en-US" id="par_idN10A59" role="paragraph" l10n="NEW">In the <emph>Category</emph> list box, scroll down and open the "%PRODUCTNAME Macros" entry.</paragraph>
95         </listitem>
96         <listitem>
97            <paragraph xml-lang="en-US" id="par_idN10A61" role="paragraph" 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>
98         </listitem>
99         <listitem>
100            <paragraph xml-lang="en-US" id="par_idN10A65" role="paragraph" l10n="NEW">Open any scripting language entry to see the available scripts. Select any script.</paragraph>
101         </listitem>
102         <listitem>
103            <paragraph xml-lang="en-US" id="par_idN10A69" role="paragraph" l10n="NEW">A list of the script functions will appear in the <emph>Commands</emph> list box. Select any function.</paragraph>
104         </listitem>
105         <listitem>
106            <paragraph xml-lang="en-US" id="par_idN10A71" role="paragraph" l10n="NEW">Click the option button for %PRODUCTNAME or Writer (or whichever application is currently open). </paragraph>
107            <paragraph xml-lang="en-US" id="par_idN10A74" role="paragraph" 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>
108         </listitem>
109         <listitem>
110            <paragraph xml-lang="en-US" id="par_idN10A78" role="paragraph" l10n="NEW">Select a key combination from the <emph>Shortcut keys</emph> list box and click <emph>Modify</emph>.</paragraph>
111         </listitem>
112      </list>
113      <paragraph xml-lang="en-US" id="par_idN1078A" role="heading" level="2" l10n="NEW">To assign a script to an event</paragraph>
114      <list type="ordered">
115         <listitem>
116            <paragraph xml-lang="en-US" id="par_idN1078E" role="paragraph" l10n="NEW">Choose <emph>Tools - Customize - Events</emph>.</paragraph>
117         </listitem>
118         <listitem>
119            <paragraph xml-lang="en-US" id="par_idN10A16" role="paragraph" l10n="NEW">Click <emph>Macro</emph> button.</paragraph>
120         </listitem>
121         <listitem>
122            <paragraph xml-lang="en-US" id="par_idN10A9E" role="paragraph" l10n="NEW">In the <emph>Library</emph> list box, scroll down and open the "%PRODUCTNAME Macros" entry.</paragraph>
123         </listitem>
124         <listitem>
125            <paragraph xml-lang="en-US" id="par_idN10AA6" role="paragraph" 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>
126         </listitem>
127         <listitem>
128            <paragraph xml-lang="en-US" id="par_idN10AAA" role="paragraph" l10n="NEW">Open any scripting language entry to see the available scripts. Select any script.</paragraph>
129         </listitem>
130         <listitem>
131            <paragraph xml-lang="en-US" id="par_idN10AAE" role="paragraph" l10n="NEW">A list of the script functions will appear in the <emph>Assigned Action</emph> list box. Select any function.</paragraph>
132         </listitem>
133         <listitem>
134            <paragraph xml-lang="en-US" id="par_idN10AB6" role="paragraph" l10n="NEW">Select to save in %PRODUCTNAME or current document.</paragraph>
135            <paragraph xml-lang="en-US" id="par_idN10AB9" role="paragraph" 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>
136         </listitem>
137         <listitem>
138            <paragraph xml-lang="en-US" id="par_idN10ABD" role="paragraph" l10n="NEW">Select an event from the list and click <emph>OK</emph>.</paragraph>
139         </listitem>
140      </list>
141      <paragraph xml-lang="en-US" id="par_idN10791" role="heading" level="2" l10n="NEW">To assign a script to an event for an embedded object</paragraph>
142      <list type="ordered">
143         <listitem>
144            <paragraph xml-lang="en-US" id="par_idN10795" role="paragraph" l10n="NEW">Select the embedded object, for example a chart, in your document.</paragraph>
145         </listitem>
146         <listitem>
147            <paragraph xml-lang="en-US" id="par_idN10ADB" role="paragraph" l10n="NEW">Choose <emph>Format - Frame/Object - Macro</emph>.</paragraph>
148         </listitem>
149         <listitem>
150            <paragraph xml-lang="en-US" id="par_idN10ADF" role="paragraph" l10n="NEW">In the <emph>Macros</emph> list box, open the %PRODUCTNAME Scripts entry.</paragraph>
151         </listitem>
152         <listitem>
153            <paragraph xml-lang="en-US" id="par_idN10AE7" role="paragraph" 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>
154         </listitem>
155         <listitem>
156            <paragraph xml-lang="en-US" id="par_idN10AEB" role="paragraph" l10n="NEW">Open any scripting language entry to see the available scripts. Select any script.</paragraph>
157         </listitem>
158         <listitem>
159            <paragraph xml-lang="en-US" id="par_idN10AEF" role="paragraph" l10n="NEW">A list of the script functions will appear in the <emph>Existing macros in</emph> list box. Select any function.</paragraph>
160         </listitem>
161         <listitem>
162            <paragraph xml-lang="en-US" id="par_idN10AF7" role="paragraph" l10n="NEW">Select an event from the list and click <emph>OK</emph>.</paragraph>
163         </listitem>
164      </list>
165      <paragraph xml-lang="en-US" id="par_idN10798" role="heading" level="2" l10n="NEW">To assign a script to a hyperlink</paragraph>
166      <list type="ordered">
167         <listitem>
168            <paragraph xml-lang="en-US" id="par_idN1079C" role="paragraph" l10n="NEW">Position the cursor inside the hyperlink. </paragraph>
169         </listitem>
170         <listitem>
171            <paragraph xml-lang="en-US" id="par_idN10B15" role="paragraph" l10n="NEW">Choose <emph>Insert - Hyperlink</emph>.</paragraph>
172         </listitem>
173         <listitem>
174            <paragraph xml-lang="en-US" id="par_idN10B19" role="paragraph" l10n="NEW">Click the <emph>Events</emph> button.</paragraph>
175         </listitem>
176         <listitem>
177            <paragraph xml-lang="en-US" id="par_idN10B21" role="paragraph" l10n="NEW">Select and assign as stated above.</paragraph>
178         </listitem>
179      </list>
180      <paragraph xml-lang="en-US" id="par_idN1079F" role="heading" level="2" l10n="NEW">To assign a script to a graphic</paragraph>
181      <list type="ordered">
182         <listitem>
183            <paragraph xml-lang="en-US" id="par_idN107A3" role="paragraph" l10n="NEW">Select the graphic in your document. </paragraph>
184         </listitem>
185         <listitem>
186            <paragraph xml-lang="en-US" id="par_idN10B3B" role="paragraph" l10n="CHG">Choose <emph>Format - Picture - Macro</emph>.</paragraph>
187         </listitem>
188         <listitem>
189            <paragraph xml-lang="en-US" id="par_idN10B3F" role="paragraph" l10n="NEW">Select and assign as stated above.</paragraph>
190         </listitem>
191      </list>
192      <paragraph xml-lang="en-US" id="par_idN107A6" role="heading" level="2" l10n="NEW">To assign a script to a form control</paragraph>
193      <list type="ordered">
194         <listitem>
195            <paragraph xml-lang="en-US" id="par_idN107AA" role="paragraph" 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>
196         </listitem>
197         <listitem>
198            <paragraph xml-lang="en-US" id="par_idN10B59" role="paragraph" l10n="CHG">With the form control selected, click <emph>Control</emph> on the Form Controls toolbar.</paragraph>
199         </listitem>
200         <listitem>
201            <paragraph xml-lang="en-US" id="par_idN10B5D" role="paragraph" l10n="NEW">Click the <emph>Events</emph> tab of the Properties dialog.</paragraph>
202         </listitem>
203         <listitem>
204            <paragraph xml-lang="en-US" id="par_idN10B61" role="paragraph" l10n="NEW">Click one of the <emph>...</emph> buttons to open a dialog where you can assign a script to the selected event.</paragraph>
205         </listitem>
206      </list>
207      <paragraph xml-lang="en-US" id="par_idN107AD" role="heading" level="2" l10n="NEW">To assign a script to a control in the %PRODUCTNAME Basic dialog</paragraph>
208      <list type="ordered">
209         <listitem>
210            <paragraph xml-lang="en-US" id="par_idN107B1" role="paragraph" l10n="NEW">Open the %PRODUCTNAME Basic dialog editor, then create a dialog with a control on it.</paragraph>
211         </listitem>
212         <listitem>
213            <paragraph xml-lang="en-US" id="par_idN10B7F" role="paragraph" l10n="NEW">Right-click the control, then choose <emph>Properties</emph>.</paragraph>
214         </listitem>
215         <listitem>
216            <paragraph xml-lang="en-US" id="par_idN10B87" role="paragraph" l10n="NEW">Click the <emph>Events</emph> tab of the Properties dialog.</paragraph>
217         </listitem>
218         <listitem>
219            <paragraph xml-lang="en-US" id="par_idN10B8B" role="paragraph" l10n="NEW">Click one of the <emph>...</emph> buttons to open a dialog where you can assign a script to the selected event.</paragraph>
220         </listitem>
221      </list>
222   </body>
223</helpdocument>