summaryrefslogtreecommitdiffstats
path: root/doc/ru/useraction-xml.docbook
blob: 0191ca62e12214e8a5ea785816d8574eecd9849f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<appendix id= "useraction_xml">

<!-- **********************************************************************
                               installation.docbook
                            ++++++++++++++++++++++++++
  copyright            : (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006
                          Rafi Yanai, Shie Erlich, Frank Schoolmeesters
                          & the Krusader Krew
  e-mail               : [email protected]
  web site             : http://www.krusader.org
  description          : a Krusader Documentation File

***************************************************************************
* Permission is granted to copy, distribute and/or modify this            *
* document under the terms of the GNU Free Documentation License,         *
* Version 1.1 or any later version published by the Free Software         *
* Foundation; with no Invariant Sections, no Front-Cover Texts and        *
* no Back-Cover Texts.  A copy of the license is available on the         *
* GNU site http://www.gnu.org/licenses/fdl.html or by writing to:         *
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,    *
* MA 02110-1301, USA.                                                     *
*********************************************************************** -->

<title
>useraction.xml</title>
<para
>This appendix gives several examples of <filename
>useraction.xml</filename
> files. With this you can begin to discover the power of the &useractions_lnk; and start learning how to use them. Once you understand how to write UserActions you will find that &krusader; is an even more powerful, customizable tool. </para>

<para
>Please consider to upload your UserActions at &kde_files_url;. We are collecting UserActions, if your UserAction is selected by us it will be shipped with &krusader; at the next release. We provide also an &useractionsforum_url;. </para>

<itemizedlist>
    <listitem
><para
>Runs <command
>uptime</command
> <programlisting
>&lt;?xml version="1.0" encoding="UTF-8" ?>
&lt;!DOCTYPE KrusaderUserActions>
 &lt;KrusaderUserActions>
  &lt;action name="uptime" >
  &lt;title>Up-time&lt;/title>
  &lt;tooltip>tells how long since the computer has been booted&lt;/tooltip>
  &lt;icon>clock&lt;/icon>
  &lt;category>information&lt;/category>
  &lt;description>tells how long since the computer has been booted&lt;/description> 
  &lt;command executionmode="collect_output" >uptime&lt;/command>
  &lt;defaultshortcut>Alt+Ctrl+U&lt;/defaultshortcut>
 &lt;/action>
&lt;/KrusaderUserActions></programlisting>
    </para
></listitem>

    <listitem
><para
>Runs <command
>ls -l</command
> <programlisting
>&lt;?xml version="1.0" encoding="UTF-8" ?>    
&lt;!DOCTYPE KrusaderUserActions>
 &lt;KrusaderUserActions>
  &lt;action name="ls -l" >
  &lt;title>ls -l in current dir&lt;/title>
  &lt;description>Runs ls -l in current dir&lt;/description> 
  &lt;command executionmode="collect_output" >ls -l %aPath% %oPath%&lt;/command>
 &lt;/action>
&lt;/KrusaderUserActions></programlisting>
    </para
></listitem>

    <listitem
><para
>Echo Placeholder <programlisting
>&lt;?xml version="1.0" encoding="UTF-8" ?>    
&lt;!DOCTYPE KrusaderUserActions>
 &lt;KrusaderUserActions>
  &lt;action name="test_placeholder" >
  &lt;title>Echo Placeholder&lt;/title>
  &lt;tooltip>Echo's the placeholder values&lt;/tooltip>
  &lt;category>Testing&lt;/category>
  &lt;description>Echo's the placeholder values&lt;/description> 
  &lt;command executionmode="collect_output" onmultiplefiles="call_each" >echo -e &quot;aPath %aPath()%  \naCurrent: %aCurrent()%&quot;&lt;/command>
 &lt;/action>
&lt;/KrusaderUserActions></programlisting>
    </para
></listitem>

      <listitem
><para
>This useraction copies current path and filename to clipboard: <programlisting
>&lt;?xml version="1.0" encoding="UTF-8" ?>      
&lt;!DOCTYPE KrusaderUserActions>
&lt;KrusaderUserActions>
 &lt;action name="clipboard current" >
  &lt;title>Copy to Clipboard&lt;/title>
  &lt;tooltip>Copy to clipboard&lt;/tooltip>
  &lt;icon>klipper&lt;/icon>
  &lt;category>System&lt;/category>
  &lt;description>Copy current path and filename to clipboard&lt;/description>
  &lt;command>%_Clipboard(&quot;%aCurrent%&quot;)%&lt;/command>
  &lt;defaultshortcut>Win+C&lt;/defaultshortcut>
 &lt;/action>
&lt;/KrusaderUserActions></programlisting>
      </para
></listitem>

      <listitem
><para
>Selects <literal role="extension"
>.diff</literal
> and <literal role="extension"
>*.h</literal
> in the active panel: <programlisting
>&lt;?xml version="1.0" encoding="UTF-8" ?>      
&lt;!DOCTYPE KrusaderUserActions>
&lt;KrusaderUserActions>
 &lt;action name="test_select" >
  &lt;title>Add selection *.diff and *.h&lt;/title>
  &lt;category>Selection&lt;/category>
  &lt;command>%aSelect(&quot;*.diff&quot;, &quot;add&quot;)% %aSelect(&quot;*.h&quot;, &quot;add&quot;)%&lt;/command>
 &lt;/action>
&lt;/KrusaderUserActions></programlisting>
      </para
></listitem>

      <listitem
><para
>Active panel changes to <filename
>mnt/floppy</filename
> (bookmark): <programlisting
>&lt;?xml version="1.0" encoding="UTF-8" ?>      
&lt;!DOCTYPE KrusaderUserActions>
&lt;action name="mnt/floppy bookmark" >
  &lt;title>Jump to /mnt/floppy&lt;/title>
  &lt;category>Bookmarks&lt;/category>
  &lt;command>%aGoto(&quot;/mnt/floppy&quot;, &quot;yes&quot;)%&lt;/command>
 &lt;/action>
&lt;/KrusaderUserActions></programlisting>
      </para
></listitem>

      <listitem
><para
>Select in the non-active panel, all filenames that are highlighted in the active panel: <programlisting
>&lt;?xml version="1.0" encoding="UTF-8" ?>      
&lt;!DOCTYPE KrusaderUserActions>
 &lt;action name="asdfasdf" >
  &lt;title>Select in Other Panel&lt;/title>
  &lt;category>Selection&lt;/category>
  &lt;description>Select all filenames that are selected in the active panel, also in the non-active panel&lt;/description>
  &lt;command>%oSelect(&quot;%aList(&quot;selected&quot;, &quot; &quot;, &quot;Yes&quot;)%&quot;)%&lt;/command>
 &lt;/action>
&lt;/KrusaderUserActions</programlisting>
      </para
></listitem>

      <listitem
><para
>Make a backup of the current file/folder to <filename
>foo.bak</filename
> into the current directory: <programlisting
>&lt;?xml version="1.0" encoding="UTF-8" ?>      
&lt;!DOCTYPE KrusaderUserActions>
&lt;KrusaderUserActions>
 &lt;action name="backup current" >
  &lt;title>Backup in Current Directory&lt;/title>
  &lt;tooltip>Backup in current directory&lt;/tooltip>
  &lt;icon>filesaveas&lt;/icon>
  &lt;category>System&lt;/category>
  &lt;description>Backup in current directory&lt;/description>
  &lt;command>%_Copy(&quot;%aCurrent%&quot;, &quot;%_Ask(&quot;new name&quot;, &quot;%aCurrent%.bak&quot;)&quot;)%&lt;/command>
  &lt;defaultshortcut>Shift+F5&lt;/defaultshortcut>
 &lt;/action>
&lt;/KrusaderUserActions></programlisting>
      </para
></listitem>

      <listitem
><para
>Opens <link linkend="krusearcher"
>KruSearcher</link
>: <programlisting
>&lt;?xml version="1.0" encoding="UTF-8" ?>      
&lt;!DOCTYPE KrusaderUserActions>
&lt;KrusaderUserActions>
 &lt;action name="search" >
  &lt;title>Search Test&lt;/title>
  &lt;command>%_NewSearch(&quot;Search 2&quot;)%&lt;/command>
 &lt;/action>
&lt;/KrusaderUserActions></programlisting>
      </para
></listitem>

      <listitem
><para
>Sets the selected picture as wallpaper: <programlisting
>&lt;?xml version="1.0" encoding="UTF-8" ?>      
&lt;!DOCTYPE KrusaderUserActions>
&lt;KrusaderUserActions>
 &lt;action name="set wallpaper" >
  &lt;title>Set as Wallpaper&lt;/title>
  &lt;tooltip>Set as wallpaper&lt;/tooltip>
  &lt;icon>image&lt;/icon>
  &lt;category>Service Menu&lt;/category>
  &lt;description>Set as wallpaper (scaled)&lt;/description>
  &lt;command>dcop kdesktop KBackgroundIface setWallpaper &quot;%aCurrent%&quot; 6&lt;/command>
  &lt;defaultshortcut>Win+W&lt;/defaultshortcut>
 &lt;/action>
&lt;/KrusaderUserActions></programlisting>
      </para
></listitem>

      <listitem
><para
>This useraction edits a file with root permissions using <command
>tdesu</command
>: <programlisting
>&lt;?xml version="1.0" encoding="UTF-8" ?>      
&lt;!DOCTYPE KrusaderUserActions>
&lt;KrusaderUserActions>
 &lt;action name="edit as root" >
  &lt;title>Edit as Root&lt;/title>
  &lt;tooltip>Edit as root&lt;/tooltip>
  &lt;icon>kwrite&lt;/icon>
  &lt;category>System&lt;/category>
  &lt;description>Edit a file with root permissions using tdesu&lt;/description>
  &lt;command>tdesu kedit %aCurrent%&lt;/command>
  &lt;defaultshortcut>Win+F4&lt;/defaultshortcut>
 &lt;/action>
&lt;/KrusaderUserActions></programlisting>
      </para
></listitem>

      <listitem
><para
>This useraction Add item(s) to Amarok playlist: <programlisting
>&lt;?xml version="1.0" encoding="UTF-8" ?>      
&lt;!DOCTYPE KrusaderUserActions>
&lt;KrusaderUserActions>
 &lt;action name="amarok enqueue" >
  &lt;title>Enqueue in Amarok&lt;/title>
  &lt;tooltip>Append selected item(s) to Amarok playlist&lt;/tooltip>
  &lt;icon>amarok&lt;/icon>
  &lt;category>Multimedia&lt;/category>
  &lt;description>Append selected item(s) to Amarok playlist&lt;/description>
  &lt;command>amarok --append %aList(&quot;Selected&quot;)%&lt;/command>
  &lt;defaultshortcut>Win+A&lt;/defaultshortcut>
 &lt;/action>
&lt;/KrusaderUserActions></programlisting>
      </para
></listitem>

      <listitem
><para
>Opens &synchronizer_lnk;: <programlisting
>&lt;?xml version="1.0" encoding="UTF-8" ?>      
&lt;!DOCTYPE KrusaderUserActions>
&lt;KrusaderUserActions>
 &lt;action name="synchronizer" >
  &lt;title>Synchronizer&lt;/title>
  &lt;command>%_Sync(&quot;Sync 2&quot;)%&lt;/command>
 &lt;/action>
&lt;/KrusaderUserActions></programlisting>
      </para
></listitem>

      <listitem
><para
>Copy selected files &amp; directories with root privileges (also inside archives): <programlisting
>&lt;?xml version="1.0" encoding="UTF-8" ?>      
&lt;!DOCTYPE KrusaderUserActions>
&lt;KrusaderUserActions>
 &lt;action name="root_copy" >
  &lt;title>Copy as "root"&lt;/title>
  &lt;tooltip>Copy as "root"&lt;/tooltip>
  &lt;icon>editcopy&lt;/icon>
  &lt;category>Selection&lt;/category>
  &lt;description>Copy selected files &amp; directories with root privileges, also inside archives!&lt;/description>
  &lt;command run_as="root" accept="url">kfmclient copy %aList("Selected", " ", "No")% %oPath%&lt;/command>
 &lt;/action>
&lt;/KrusaderUserActions></programlisting>
      </para
></listitem>

      <listitem
><para
>Search and replace a strings and regular expressions in textfiles using <command
>sed</command
>: <programlisting
>&lt;?xml version="1.0" encoding="UTF-8" ?>      
&lt;!DOCTYPE KrusaderUserActions>
&lt;KrusaderUserActions>
 &lt;action name="search_replace" >
  &lt;title>Simple Search and Replace&lt;/title>
  &lt;tooltip>Search and replace a string/regex in textfiles&lt;/tooltip>
  &lt;icon>kcachegrind&lt;/icon>
  &lt;category>Samples&lt;/category>
  &lt;description>This UA uses the UNIX standard-tool sed (the stream-editor) so perform search and replace operations in all selected files It is possible to give a regular expression for both strings. Please note: The sed-command is "s/search/repleace/", so you have to escape the slash when you need it!&lt;/description>
  &lt;command>sed -i -e 's/%_Ask("Search for:")%/%_Ask("Replace with:")%/' %aList("Selected")%&lt;/command>
 &lt;/action>
&lt;/KrusaderUserActions></programlisting>
      </para
></listitem>


      <listitem
><para
>Converts content of selected text-files from ISO-8859-15 to UTF8 and vice versa using <command
>iconv</command
> (also inside archives): <programlisting
>&lt;?xml version="1.0" encoding="UTF-8" ?>      
&lt;!DOCTYPE KrusaderUserActions>
&lt;KrusaderUserActions> 
 &lt;action name="iso8859-15_to_utf8" > 
  &lt;title>ISO 8859-15 => UTF8&lt;/title> 
  &lt;tooltip>convert characterset&lt;/tooltip> 
  &lt;icon>editcopy&lt;/icon> 
  &lt;category>Selection&lt;/category> 
  &lt;description>Converts content of selected text-files from ISO-8859-15 to UTF8&lt;/description> 
  &lt;command>sh -c 'cd %aPath%; for i in %aList(&quot;Selected&quot;, &quot; &quot;, &quot;Yes&quot;)% ; do iconv -f iso8859-15 -t utf-8 &quot;$i&quot; -o %oPath%&quot;$i&quot;; done '&lt;/command> 
 &lt;/action> 
 &lt;action name="utf8_to_iso8859-15" > 
  &lt;title>UTF8 => ISO 8859-15&lt;/title> 
  &lt;tooltip>convert characterset&lt;/tooltip> 
  &lt;icon>editcopy&lt;/icon> 
  &lt;category>Selection&lt;/category> 
  &lt;description>Converts content of selected text-files from UTF8 to ISO-8859-15&lt;/description> 
  &lt;command>sh -c 'cd %aPath%; for i in %aList(&quot;Selected&quot;, &quot; &quot;, &quot;Yes&quot;)% ; do iconv -f utf-8 -t iso8859-15 &quot;$i&quot; -o %oPath%&quot;$i&quot;; done '&lt;/command> 
 &lt;/action> 
&lt;/KrusaderUserActions></programlisting>
      </para
></listitem>

</itemizedlist>

</appendix>