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 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>DC - Variables in parameters</title>
<link rel="stylesheet" type="text/css" href="doublecmd.css">
<link rel="shortcut icon" href="../../pixmaps/common/favicon.ico">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<a name="topofpage"></a>
<div class="header"><a href="index.html"><img src="../../pixmaps/common/dclogo2017.png" alt="Double Commander" height="48" width="374"></a>
<div id="global-nav" class="nav"><a title="Double Commander Home Page" href="https://doublecmd.sourceforge.io/" target="_blank">Homepage</a> | <a title="Double Commander Wiki" href="https://github.com/doublecmd/doublecmd/wiki" target="_blank">Wiki</a></div>
</div>
<div class="footer"><div class="nav"><a title="Index" href="index.html">Index</a> | <a title="Previous page" href="toolbar.html">Previous</a> | <a title="Next page" href="cmds.html">Next</a></div></div>
<div class="dchelpage">
<div>
<h1>2.12. Variables in parameters</h1>
</div>
<div>
<h2>Content</h2>
<dl>
<dt>1. <a href="#quickpres">Quick presentation</a></dt>
<dt>2. <a href="#basicvar">Basic parameter variables</a></dt>
<dt>3. <a href="#basicsuffix">Basic suffix variable</a></dt>
<dt>4. <a href="#numsuffix">Numbered suffix</a></dt>
<dt>5. <a href="#prefixpostfix">Specifying prefix and postfix for each file</a></dt>
<dt>6. <a href="#pathpanel">Path of panels</a></dt>
<dt>7. <a href="#quotation">Quotation in result or not</a></dt>
<dt>8. <a href="#trailingdelim">Trailing path delimited or not</a></dt>
<dt>9. <a href="#listoffiles">List of files</a></dt>
<dt>10. <a href="#suffixforlist">Suffix for list of files</a></dt>
<dt>11. <a href="#combsuffixlist">Combination s of suffix for list of files</a></dt>
<dt>12. <a href="#executeterm">Execute in terminal</a></dt>
<dt>13. <a href="#interaction">Interaction</a></dt>
<dt>14. <a href="#miscellaneous">Miscellaneous variables</a></dt>
<dt>15. <a href="#summaryall">Summary table of all variables</a></dt>
<dt>16. <a href="#envvariables">Environment variables</a></dt>
</dl>
</div>
<div>
<h2><a name="quickpres">1. Quick presentation</a></h2>
<p>Variable will help us to when configurating <a href="toolbar.html">toolbar buttons</a> or setting <a href="configuration.html#ConfigAssociations">file association</a> actions and <a href="configuration.html#ConfigHotKeys">hotkey</a> actions.</p>
<p>We will basically use them when it's time to provide a parameter to command based on the current selected file(s), directory where we are and other things like that related with the context of what we're displaying in the panels.</p>
<p>Here is an easy example. The person configured a button to launch IrfanView with the variable <code>%p</code> has the parameter.</p>
<p class="image"><img title="Example of variable" alt="Example of variable" src="images/imgDC/variablesample.png" width="610" height="229"></p>
<p>When the person will click that button, it will launch IrfanView with the variable <code>%p</code> be substituted by the current selected file in the active panel.</p>
<p>That's what <b>variables</b> described in this page are all about.</p>
<p>As you will see, most of them are beginning with the percent sign <code>%</code>.</p>
<p>Note: Variables and suffixes are case sensitive!</p>
<p class="navback"><a href="#topofpage">(back to top)</a></p>
</div>
<div>
<h2><a name="basicvar">2. Basic parameter variables</a></h2>
<p>These are the basic variables that may be used and that are related with the current selection.</p>
<p>By default, variable values containing spaces and/or special characters are automatically escaped: value will be enclosed in double quotes (in Windows) or such characters will be preceded by "\" (in Unix-like systems). If you need them unquoted, see the section <a href="#quotation">Quotation in result or not</a>.</p>
<p><i>For each one, the example is given assuming we're pointing the file C:\Users\UserName\Desktop\comment.png.</i></p>
<table>
<tr class="rowcategorytitle"><th colspan="2">Basic variables</th></tr>
<tr class="rowsubtitle"><th class="namecolumn">Variables</th><th class="categorydesccolumn">What it stands for</th></tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%p</div></td>
<td class="hintcell">Complete filename, path + file name<br><code>Example: %p = "C:\Users\UserName\Desktop\comment.png"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%f</div></td>
<td class="hintcell">Just filename, including extension<br><code>Example: %f = "comment.png"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%d</div></td>
<td class="hintcell">Only path, excluding trailing directory separator<br><code>Example: %d = "C:\Users\UserName\Desktop"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%z</div></td>
<td class="hintcell">Name of last directory in path<br><code>Example: %z = "Desktop"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%o</div></td>
<td class="hintcell">Just filename without extension<br><code>Example: %o = "comment"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%e</div></td>
<td class="hintcell">Just the extension, without the period<br><code>Example: %e = "png"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%v</div></td>
<td class="hintcell">Relative filename referenced to the current active directory<br>This is pertinent for example if you've invoke the internal command <a href="cmds.html#cm_flatview">cm_FlatView</a>.<br><code>If we've done a flat view from directory "C:\Users\UserName", the %v will result in "Desktop\comment.png"</code></td>
</tr>
</table>
<p>The <code>%a</code> variable is available for the virtual file system (an open archive or a file system plugin): the string includes the path to the virtual file system (the full name of the archive or the name of the WFX plugin with "wfx://") and the full file name relative to the root of the virtual file system.</p>
<p>If several files are selected, these variables will return the values for all selected files in one line. To get the value only for the file under the cursor in any case, we can use the <a href="#numsuffix">numbered suffix 0</a>.</p>
<p class="navback"><a href="#topofpage">(back to top)</a></p>
</div>
<div>
<h2><a name="basicsuffix">3. Basic suffix variable</a></h2>
<p>Following the variable letter mentioned above, we may add another letter to the previous one to add precision to what we want to use.</p>
<p><i>For each one, the example is given assuming:<br>In left panel we're pointing the file "C:\LeftFolder\File.lft"<br>In right panel we're pointing "C:\RightFolder\File.rgh"<br>The current active panel is the right one.</i></p>
<table>
<tr class="rowcategorytitle"><th colspan="2">Basic suffix</th></tr>
<tr class="rowsubtitle"><th class="namecolumn">Suffix</th><th class="categorydesccolumn">What it stands for</th></tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">s</div></td>
<td class="hintcell">The source or active panel (no matter if it's left or right)<br><code>Example: %ps = "C:\RightFolder\File.rgh"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">t</div></td>
<td class="hintcell">The target or inactive panel (no matter if it's left or right)<br><code>Example: %pt = "C:\LeftFolder\File.lft"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">l</div></td>
<td class="hintcell">Left panel<br><code>Example: %pl = "C:\LeftFolder\File.lft"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">r</div></td>
<td class="hintcell">Right panel<br><code>Example: %pr = "C:\RightFolder\File.rgh"</code></td>
</tr>
<tr>
<td class="varcell">
<div class="firstcolumnaleft">p</div></td>
<td class="hintcell">Both panel, active first, then a space, then the inactive second<br><code>Example: %pp = "C:\RightFolder\File.rgh" "C:\LeftFolder\File.lft"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">b</div></td>
<td class="hintcell">Both panel, left one first, then a space, then the right one<br><code>Example: %pb = "C:\LeftFolder\File.lft" "C:\RightFolder\File.rgh"</code></td>
</tr>
</table>
<p class="navback"><a href="#topofpage">(back to top)</a></p>
</div>
<div>
<h2><a name="numsuffix">4. Numbered suffix</a></h2>
<p>If we currently have many file selected, we may add a suffix to the previous mentioned one to precise which one we want to use.</p>
<p><i>For each element of table, we're assuming in the source panel is pointing "C:\temp\" and we've selected twenty six files named like "FileA.txt", "FileB.txt", etc. up to "FileZ.txt".</i></p>
<table>
<tr class="rowcategorytitle"><th colspan="2">Numbered suffix</th></tr>
<tr class="rowsubtitle"><th class="namecolumn">Suffix</th><th class="categorydesccolumn">What it stands for</th></tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">0</div></td>
<td class="hintcell">The file under cursor<br><code>Example: %ps0 = "C:\temp\FileY.txt"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">1</div></td>
<td class="hintcell">The first selected file<br><code>Example: %ps1 = "C:\temp\FileA.txt"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">2</div></td>
<td class="hintcell">The second selected file<br><code>Example: %ps2 = "C:\temp\FileB.txt"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">3</div></td>
<td class="hintcell">The third selected file<br><code>Example: %ps3 = "C:\temp\FileC.txt"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">21</div></td>
<td class="hintcell">The twenty-first selected file<br><code>Example: %ps21 = "C:\temp\FileU.txt"</code></td>
</tr>
</table>
<p class="navback"><a href="#topofpage">(back to top)</a></p>
</div>
<div>
<h2><a name="prefixpostfix">5. Specifying prefix and postfix for each file</a></h2>
<p>Sometimes when we pass parameters to an executable we need to include something before the filenames.</p>
<p>Some other times we want to include something just before and just after the filenames.</p>
<p>Please note that the following will apply to each and individual selected item.</p>
<p><i>For each element of table, we're assuming we're currently in "C:\Windows\Fonts" with three file selected named "courrier.ttf", "fixedsys.ttf" and "terminal.ttf".</i></p>
<table>
<tr class="rowcategorytitle"><th colspan="2">Prefix and postfix</th></tr>
<tr class="rowsubtitle"><th class="namecolumn">Prefix and postfix</th><th class="categorydesccolumn">What it stands for</th></tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">{}</div></td>
<td class="hintcell">One set of braces will result in adding the text between the braces before each and every selected items<br><code>Example: %fs{+} = "+courrier.ttf" "+fixedsys.ttf" "+terminal.ttf"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">{}{}</div></td>
<td class="hintcell">Two sets of braces will result in placing text between the braces before and after respectively in each and every selected items.<br><code>Example: %fs{[}{]} = "[courrier.ttf]" "[fixedsys.ttf]" "[terminal.ttf]"</code></td>
</tr>
</table>
<p class="navback"><a href="#topofpage">(back to top)</a></p>
</div>
<div>
<h2><a name="pathpanel">6. Path of panels</a></h2>
<p>Previously we've indicated variables related with the current selected items inside the panel.</p>
<p>But we may also use the variable <code>%D</code> to indicate we want to refer to the directory name of a panel.</p>
<p>To that variable we may add the same <a href="#basicsuffix">suffix letter</a> as mentioned above to precise which panel we want to refer to.</p>
<p><i>For each one, the example is given assuming:<br>In left panel we're in "C:\Reference"<br>In right panel we're pointing "E:\Work"<br>The current active panel is the right one.</i></p>
<table>
<tr class="rowcategorytitle"><th colspan="2">Path of panels</th></tr>
<tr class="rowsubtitle"><th class="namecolumn">Variable</th><th class="categorydesccolumn">What it stands for</th></tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%D</div></td>
<td class="hintcell">Alone, with no suffix, will return the path of the current active panel<br><code>Example: "E:\Work"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%Ds</div></td>
<td class="hintcell">Directory of the current active or source panel (no matter if it's on left or right)<br><code>Example: "E:\Work"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%Dt</div></td>
<td class="hintcell">Directory of inactive or target panel (no matter if it's on left or right)<br><code>Example: "C:\Reference"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%Dl</div></td>
<td class="hintcell">Directory of left panel<br><code>Example: "C:\Reference"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%Dr</div></td>
<td class="hintcell">Directory of right panel<br><code>Example: "E:\Work"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%Z</div></td>
<td class="hintcell">Alone, with no suffix, will return the last directory name of path of the current active panel<br><code>Example: "Work"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%Zs</div></td>
<td class="hintcell">Last directory name of path of the current active panel (no matter if it's on left or right)<br><code>Example: "Work"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%Zt</div></td>
<td class="hintcell">Last directory name of path of inactive panel (no matter if it's on left or right)<br><code>Example: "Reference"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%Zl</div></td>
<td class="hintcell">Last directory name of path of left panel<br><code>Example: "Reference"</code></td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%Zr</div></td>
<td class="hintcell">Last directory name of path of right panel<br><code>Example: "Work"</code></td>
</tr>
</table>
<p>The <code>%A</code> variable is available for the virtual file system (an open archive or a file system plugin): the full name of the archive or the name of the WFX plugin with "wfx://".</p>
<p class="navback"><a href="#topofpage">(back to top)</a></p>
</div>
<div>
<h2><a name="quotation">7. Quotation in result or not</a></h2>
<p>As you've seen previously, for historic and legacy reason, DC will return the result quoted.</p>
<p>This was useful initially when there were spaces in filename and we wanted to pass filename as parameters and we wanted the whole thing to work.</p>
<p>But as new variables were added, it was obvious that we needed a way to have unquoted result. Basic example is commonly when we want to concatenate a source filename, but just the filename with no extension, with a new specific extension we'll specify ourself on the line.</p>
<p>So instead of adding new variables that would return the same thing but unquoted, we may still use the same variables for the same meaning but just have to set prior on the line of parameter something like <code>%"0</code> to indicate to DC that from now on, to the end of the line we're evaluating, do not quote the result.</p>
<p>Basically we'll have:</p>
<dl>
<dt><code>%"0</code> : from this position, resulting filename will be unquoted</dt>
<dt><code>%"1</code> : from this position, resulting filename will be quoted</dt>
<dt><code>%" </code> : also accepted to restore the default which is to have result quoted</dt>
</dl>
<p>The following table gives us an example in situation we're we've selected a file named "Client List.mdb" and the result of the various combination of quoted/unquoted string.</p>
<table>
<tr class="rowcategorytitle"><th colspan="2">Examples of quotation or not</th></tr>
<tr class="rowsubtitle"><th class="namecolumn">Expression</th><th class="categorydesccolumn">Result</th></tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%o.zip</div></td>
<td class="hintcell">"Client List".zip</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%"0%o.zip</div></td>
<td class="hintcell">Client List.zip</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%"0"%o.zip"</div></td>
<td class="hintcell">"Client List.zip"</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%"0"%o.zip" %"1%f</div></td>
<td class="hintcell">"Client List.zip" "Client List.mdb"</td>
</tr>
</table>
<p class="navback"><a href="#topofpage">(back to top)</a></p>
</div>
<div>
<h2><a name="trailingdelim">8. Trailing path delimited or not</a></h2>
<p>As you've seen previously, for historic and legacy reason, when DC returns a path, it will be without trailing path delimiter.</p>
<p>This could be change by using a variable that will determine if the path variable that follows on the line will be with trailing path delimiter or not.</p>
<p>Basically we have:</p>
<dl>
<dt><code>%/0</code> : the returned path will be without trailing delimiter</dt>
<dt><code>%/1</code> : the returned path will be with trailing delimiter</dt>
<dt><code>%/ </code> : also accepted, default, the returned path will be without trailing delimiter</dt>
</dl>
<p>The following table gives us an example in situation we're we've selected the directory "C:\Users\UserName\Desktop" and the result of the various combination of trailing path variable:</p>
<table>
<tr class="rowcategorytitle"><th colspan="2">Examples of trailing path variable</th></tr>
<tr class="rowsubtitle"><th class="namecolumn">Expression</th><th class="categorydesccolumn">Result</th></tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%D</div></td>
<td class="hintcell">"C:\Users\UserName\Desktop"</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%/0%D</div></td>
<td class="hintcell">"C:\Users\UserName\Desktop"</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%/1%D</div></td>
<td class="hintcell">"C:\Users\UserName\Desktop\"</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%/%D</div></td>
<td class="hintcell">"C:\Users\UserName\Desktop"</td>
</tr>
</table>
<p>This variable can be useful when composing a name from several variables. For example, in Windows, <code>%Dt\%f0</code> (with a manually added directory separator) instead of <code>%/1%Dt%f0</code> will work correctly inside directories, but if the root of a drive is open in the inactive panel, Double Commander will return the incorrect path with two directory separators after the drive letter.</p>
<p class="navback"><a href="#topofpage">(back to top)</a></p>
</div>
<div>
<h2><a name="listoffiles">9. List of files</a></h2>
<p>Some application will accept a single file name as a parameter and assumed this file is a text file containing a list of file names.</p>
<p>Double Commander proposes us variables that will create a temporary text file (in the system directory for the temporary files) with the list of all specified selected items and the file name of the temporary created file will we substituted to the variable.</p>
<table>
<tr class="rowcategorytitle"><th colspan="2">List of files variable</th></tr>
<tr class="rowsubtitle"><th class="namecolumn">Expression</th><th class="categorydesccolumn">Description</th></tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%L</div></td>
<td class="hintcell">File name of file list of selected items with the complete file name (path + file name)</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%F</div></td>
<td class="hintcell">File name of file list of selected items with just the file name</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%R</div></td>
<td class="hintcell">File name of file list of selected items with just their relative path name</td>
</tr>
</table>
<p>Double Commander will use the ANSI system encoding in Windows or the default system encoding in Unix-like systems (in GNU/Linux distributions it is usually UTF-8).</p>
<p>When closing, Double Commander deletes all such temporary files.</p>
<p class="navback"><a href="#topofpage">(back to top)</a></p>
</div>
<div>
<h2><a name="suffixforlist">10. Suffix for list of files</a></h2>
<p>By default, the above mentioned file names inside the file list are unquoted. But there is a suffix you may add to change that if required.</p>
<p>Also, there are suffixes to specify if you want this file list to be coded in UT8 or UTF16.</p>
<table>
<tr class="rowcategorytitle"><th colspan="2">Suffix to list of files variable</th></tr>
<tr class="rowsubtitle"><th class="namecolumn">Expression</th><th class="categorydesccolumn">Description</th></tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">Q</div></td>
<td class="hintcell">File names in the list will be quoted</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">U</div></td>
<td class="hintcell">List will be coded in UTF8 format</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">W</div></td>
<td class="hintcell">List will be coded in UTF16 format</td>
</tr>
</table>
<p class="navback"><a href="#topofpage">(back to top)</a></p>
</div>
<div>
<h2><a name="combsuffixlist">11. Combination s of suffix for list of files</a></h2>
<p>You may also add another suffix to specify from which panel the file list is required using the same suffix letter mentioned earlier.</p>
<p>Here are example of what is possible:</p>
<table>
<tr class="rowcategorytitle"><th colspan="2">Combination of suffix to list of files variable</th></tr>
<tr class="rowsubtitle"><th class="namecolumn">Expression</th><th class="categorydesccolumn">Description</th></tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%LQt</div></td>
<td class="hintcell">Complete filenames, quoted with selected files from target panel</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%FUs</div></td>
<td class="hintcell">Just filenames, int UTF8 format, with selected files from source panel</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%RQW</div></td>
<td class="hintcell">Filenames with relative path, quoted, in UTF16 format, files for source (default)</td>
</tr>
</table>
<p class="navback"><a href="#topofpage">(back to top)</a></p>
</div>
<div>
<h2><a name="executeterm">12. Execute in terminal</a></h2>
<p>You may specify in a parameter if you want the command-line you're configuring has to be executed in terminal.</p>
<p>To do so you'll use the <code>%t</code> variable.</p>
<table>
<tr class="rowcategorytitle"><th colspan="2">Execute in terminal</th></tr>
<tr class="rowsubtitle"><th class="namecolumn">Expression</th><th class="categorydesccolumn">Description</th></tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%t0</div></td>
<td class="hintcell">Run in terminal and request to close it at the end</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%t1</div></td>
<td class="hintcell">Run in terminal and stay open at the end</td>
</tr>
</table>
<p class="navback"><a href="#topofpage">(back to top)</a></p>
</div>
<div>
<h2><a name="interaction">13. Interaction</a></h2>
<p>Here are two variables useful to show message and request to provide parameter on-the-fly with a suggested default value:</p>
<table>
<tr class="rowcategorytitle"><th colspan="2">Interaction</th></tr>
<tr class="rowsubtitle"><th class="namecolumn">Expression</th><th class="categorydesccolumn">Description</th></tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%[message to show]</div></td>
<td class="hintcell">Will show a message box with the text specified between brackets</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%[message;default_val]</div></td>
<td class="hintcell">Will prompt user to enter a value with the default value for it</td>
</tr>
</table>
<p>Example of interaction:</p>
<table>
<tr class="rowcategorytitle"><th colspan="2">Example of interactions</th></tr>
<tr class="rowsubtitle"><th class="namecolumn">Expression</th><th class="categorydesccolumn">Description</th></tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%[Make sure ThisFile.ext is closed!]</div></td>
<td class="hintcell">Will show the message "Make sure ThisFile.ext is closed!" prior to execute action.</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%[Enter WIDTH value for image conversion;1024]</div></td>
<td class="hintcell">Will prompt user to enter a value by showing the text "Enter WIDTH value for image conversion" and by default, suggested value is 1024 but user may type something else. The result of what the user has typed will substitute in the command line at the position where the "%[query;default]" expression was written.</td>
</tr>
</table>
<p class="navback"><a href="#topofpage">(back to top)</a></p>
</div>
<div>
<h2><a name="miscellaneous">14. Miscellaneous variables</a></h2>
<p>In this final section we shows the variables that haven't been presented yet.</p>
<table>
<tr class="rowcategorytitle"><th colspan="2">Miscellaneous variables</th></tr>
<tr class="rowsubtitle"><th class="namecolumn">Expression</th><th class="categorydesccolumn">Description</th></tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%%</div></td>
<td class="hintcell">Will be replaced simply by a single % sign</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%#</div></td>
<td class="hintcell">From this position, the # sign will be treated as the %</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">#%</div></td>
<td class="hintcell">From previous mentioned state, will make % to be treated as the variable prefix</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%?</div></td>
<td class="hintcell">Will show command line about to be executed.</td>
</tr>
</table>
<p>The utility of the <code>%%</code> is when you need to have a % sign in your parameters but that you don't want to have it substituted by something else because it would be followed by a letter for example and result in an actual valid variable.</p>
<p>The <code>%?</code> variable is particularly helpful when you're configuring a new tool button for example and you want to make sure about what will be used as the substituted parameter.</p>
<p>With the <code>%?</code> DC let you see the actual command and parameter that will be used to launched something.</p>
<p>More than that, you may even change something at the last minute when launching something.</p>
<p>This is particularly helpful when you're unsure of the parameters to be passed to the application you're targeting an action with.</p>
<p>Sometimes the combination of the percent sign and a letter of the variable might interfere with system variable.</p>
<p>For example, if you type <code>%os%ot</code> thinking it will be substituted with just the concatenation of file extensions of the active and inactive panels, you might be surprised to discover that it might not work under Windows.</p>
<p>The sequence <code>%os%</code> will often be substituted by the operating system name as <code>%os%</code> is a system variable representing the operating system name.</p>
<p>So this is where the <code>%#</code> is helpful.</p>
<p>In such example, you will type <code>%##os#ot</code>.</p>
<p>The <code>%#</code> instructs DC that from now on, the <code>#</code> is now the percent sign equivalent so this way, it won't interfere with possible system variables.</p>
<p>This is rarely needed but you'll be happy to know it exists if required!</p>
<p>Then, if required, <code>#%</code> will restore back the <code>%</code> to be the actual percent sign for variable.</p>
<p class="navback"><a href="#topofpage">(back to top)</a></p>
</div>
<div>
<h2><a name="summaryall">15. Summary table of all variables</a></h2>
<p>Nothing new in this section, but let's put together into just ONE table a summary of all the supported variables and their meaning.</p>
<table>
<tr class="rowcategorytitle"><th colspan="2">Miscellaneous variables</th></tr>
<tr class="rowsubtitle"><th class="namecolumn">Expression</th><th class="categorydesccolumn">Description</th></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%p</div></td><td class="hintcell">the complete file name, including path</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%f</div></td><td class="hintcell">just the file name, with its extension</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%d</div></td><td class="hintcell">just the path</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%z</div></td><td class="hintcell">last directory in path</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%o</div></td><td class="hintcell">just the file name without its extension</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%e</div></td><td class="hintcell">just the file extension without the dot</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%v</div></td><td class="hintcell">the relative file name referenced to current active directory</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">s</div></td><td class="hintcell">suffix for source or active panel (example: %ps)</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">t</div></td><td class="hintcell">suffix for target or inactive panel (example: %pt)</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">l</div></td><td class="hintcell">suffix for left panel (example: %pl)</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">r</div></td><td class="hintcell">suffix for right panel (example: %pr)</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">p</div></td><td class="hintcell">suffix for both panels, active first, inactive second (example: %pp)</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">b</div></td><td class="hintcell">suffix for both panels, left first, right second (example: %pb)</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">0</div></td><td class="hintcell">file under cursor (example: %ps0</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">1</div></td><td class="hintcell">first selected file (example: %ps1)</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">2</div></td><td class="hintcell">second selected file if any (example: %ps2)</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">3</div></td><td class="hintcell">third selected file if any (example: %ps3)</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">21</div></td><td class="hintcell">twenty-first selected file if any (example: %ps21)</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">{prefix}</div></td><td class="hintcell">{} mentioned once, will set the prefix to add prior file name (ex: %f{+})</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">{prefix}{suffix}</div></td><td class="hintcell">{} mentioned twice, will set prefix and suffix, prior and after file name (ex: %f{[}{]})</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%D</div></td><td class="hintcell">default, the path of the active (source) panel</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%Ds</div></td><td class="hintcell">specifically, the path of the active (source) panel</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%Dt</div></td><td class="hintcell">the path of the inactive (target) panel</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%Dl</div></td><td class="hintcell">the path of the left panel, no matter which one is active</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%Dr</div></td><td class="hintcell">the path of the right panel, no matter which one is active</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%Z</div></td><td class="hintcell">default, the last directory name of path of the active (source) panel</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%Zs</div></td><td class="hintcell">specifically, the last directory name of path of the active (source) panel</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%Zt</div></td><td class="hintcell">the last directory name of path of the inactive (target) panel</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%Zl</div></td><td class="hintcell">the last directory name of path of the left panel, no matter which one is active</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%Zr</div></td><td class="hintcell">the last directory name of path of the right panel, no matter which one is active</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%"0</div></td><td class="hintcell">from this place, resulting file name will be unquoted</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%"1</div></td><td class="hintcell">from this place, resulting file name will be quoted</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%"</div></td><td class="hintcell">also accepted from resulting file name to be back quoted</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%/0</div></td><td class="hintcell">default, the returned path will be without trailing delimiter</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%/1</div></td><td class="hintcell">the returned path will be with trailing delimiter</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%/</div></td><td class="hintcell">also accepted, default, the returned path will be without trailing delimiter</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%L</div></td><td class="hintcell">file name of file list of selected items with just the complete file name (path + file name)</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%F</div></td><td class="hintcell">file name of file list of selected items with just the file name</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%R</div></td><td class="hintcell">file name of file list of selected items with just their relative path name</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">Q</div></td><td class="hintcell">suffix for %L, %F or %R to request quoted filenames</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">U</div></td><td class="hintcell">suffix for %L, %F or %R to request UTF8 file format for list</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">W</div></td><td class="hintcell">suffix for %L, %F or %R to request UTF16 file format for list</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%t0</div></td><td class="hintcell">run in terminal and request to close it at the end</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%t1</div></td><td class="hintcell">run in terminal and stay open at the end</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%[message to show]</div></td><td class="hintcell">will show a message box with the text specified between brackets</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%[message;default_val]</div></td><td class="hintcell">will prompt user to enter a value with he suggested value for it</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%%</div></td><td class="hintcell">will be replaced simply by a single % sign</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%#</div></td><td class="hintcell">from this position, the # sign will be treated as the %</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">#%</div></td><td class="hintcell">from previous mentioned state, will make % to be treated as the variable prefix</td></tr>
<tr><td class="varcell"><div class="firstcolumnaleft">%?</div></td><td class="hintcell">will show command line about to be executed</td></tr>
</table>
<p class="navback"><a href="#topofpage">(back to top)</a></p>
</div>
<div>
<h2><a name="envvariables">16. Environment variables</a></h2>
<p>We can use environment variables in the Double Commander settings: in the names of executable files and icons on the toolbar, in the names of plugins, favorite directories, and so on. This is a convenient way to specify a path if we don't want to use absolute paths.</p>
<p>Double Commander supports system environment variables and provides several of its own environment variables:</p>
<table>
<tr class="rowcategorytitle"><th colspan="2">Environment variables</th></tr>
<tr class="rowsubtitle"><th class="namecolumn">Variable</th><th class="categorydesccolumn">Description</th></tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%COMMANDER_EXE%</div></td>
<td class="hintcell">The full name (path + file name) of the Double Commander executable file (symbolic link will be replaced with a real file)</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%COMMANDER_PATH%</div></td>
<td class="hintcell">The directory where the Double Commander executable file is located</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%COMMANDER_DRIVE%</div></td>
<td class="hintcell">The disk where the Double Commander folder is located:<br>- Windows: drive letter (with colon);<br>- Unix-like systems: mount point.</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%COMMANDER_INI%</div></td>
<td class="hintcell">The full name (path + file name) of the main configuration file (<tt>doublecmd.xml</tt>)</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%COMMANDER_INI_PATH%</div></td>
<td class="hintcell">The directory where the Double Commander configuration files are located</td>
</tr>
<tr>
<td class="varcell"><div class="firstcolumnaleft">%DC_CONFIG_PATH%</div></td>
<td class="hintcell">The directory where the Double Commander configuration files are located</td>
</tr>
</table>
<p>The variable names <code>%COMMANDER_PATH%</code> and <code>%DC_CONFIG_PATH%</code> are not case sensitive and we can use the percent symbol <code>%</code> regardless of the operating system family (for backward compatibility, this is convenient for a cross-platform application). However, in Unix-like systems, environment variable names are case-sensitive and are traditionally written in upper case, so using the traditional spelling can be a good habit.</p>
<p>In Windows, we can additionally use pseudo environment variables in the format <code>%$Name%</code>, which correspond to standard Windows system folders (to get the values, Double Commander uses the <tt>SHGetSpecialFolderPath</tt> and <tt>SHGetKnownFolderPath</tt> functions from the Windows API). These are not normal environment variables and are not available for child processes (applications launched from Double Commander), but otherwise we can use them in a similar way to environment variables. All these variables are collected in the path selection assistant menu: to the right of the file or directory choose buttons is the button <span class="italic">Some functions to select appropriate path</span> <img title="Some functions to select appropriate path" alt="Some functions to select appropriate path" src="images/imgDC/bhelper.png" width="16" height="16">, see description <a href="directoryhotlist.html#helperpath">here</a>.</p>
<p>All these variables have been added to the <a href="directoryhotlist.html">Directory Hotlist</a> menu (the <span class="italic">Special Dirs</span> submenu).</p>
<p class="navback"><a href="#topofpage">(back to top)</a></p>
</div>
<div>
<br>
<p><small>Originally created by Rustem (dok_rust@bk.ru)</small></p>
</div>
</div>
<div class="footer"><div class="nav"><a title="Index" href="index.html">Index</a> | <a title="Previous page" href="toolbar.html">Previous</a> | <a title="Next page" href="cmds.html">Next</a></div></div>
<div class="checker">
<a href="https://validator.w3.org/check?uri=referer" target="_blank"><img src="https://www.w3.org/Icons/valid-html40" alt="Valid HTML 4.0 Transitional" height="31" width="88"></a>
<a href="https://jigsaw.w3.org/css-validator/check/referer" target="_blank"><img style="border:0;width:88px;height:31px" src="https://jigsaw.w3.org/css-validator/images/vcss" alt="CSS Valid!"></a>
</div>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>
|