Editing Commands |
Top Previous Next |
To edit a command added by CopyFilenames Pro to the Windows Explorer right-click context menu, use the Configure command to bring up the Configure CopyFilenames Pro dialog. Select the command you want to edit, and it's editable attributes will be shown. If the selected command is a built-in command, the only editable attribute will be its name. If the selected command is a user defined command, then you can configure the text that the command will generate. All commands have the Type and Name fields, as described below. TypeThis is a non-editable field that gives the command type. This will either be one of the built in command types, or "User Defined Command". NameThis is the name of the command as it appears in the Windows Explorer context menu. If you include "(s)" in the name, then this will be replaced by "s" if more than one file or folder is selected when the command is display, or nothing if exactly one file or folder is selected. Editing User-defined CommandsThe following screenshot shows a user defined command selected in the Configure CopyFilenames Pro dialog: The command shown selected is the Copy Path(s) as Array command that is one of the default commands added when CopyFilenames Pro is installed. This is quite a specialized command that is only of use to programmers, but it is useful as an example since it shows the flexibility of a user defined command. See the end of this topic for a complete explanation of what text this user defined command generates. The following selections describe each attribute and how it can be edited. Note that in these fields, spaces are shown as a small centered dot (•). This is just so that you can see where spaces have been entered. When the command is used, any spaces will appear as normal. If you want to add a control character such as a newline or tab into any of these fields, you need to enter a backslash followed by a letter as shown in the following table.
You also need to enter two backslash characters if you want to enter a backslash character in any of these fields. Item FormatThis controls what text is generated for each selected file or folder. File attributes (size, date etc.) are added by including the text $name; where name is the name of one of the file attributes. Some file attributes can be further configured, in which case certain options can be added after the name and before the ;. However, you don't need to remember this syntax since you can just press the Insert button next to the Item Format field. This brings up this dialog that lets you add a new file attribute: Select the file attribute you want to add and press OK. The appropriate text will be added at the current insertion point in the Item Format field.
Any other text is included as entered. This is used in the Copy Path(s) as Array example above to start the text for each item with a tab, and to enclose the path to each item in double quotes. Note that in the Item Format field only, since $ is used to indicate the start of a file attribute, if you really do want to have a $ character in the text generated you need to add a backslash before it, i.e. \$. Item SeparatorThis controls what text separates the text generated for each file or folder. This is typically a newline, tab or space. To enter a newline or tab at the current text insertion point in this field, you can use the drop down list to the right of this field. Alternatively, you can simply enter \n for newline or \t for tab. The item separator is added between the text generated for each file or folder, but it is not added after the last item. This means that if you have only one item selected, then the item separator text will not appear in the text generated. If you want the item separator text after the last item as well, then enter the same text in the Item Separator and End Text fields. Start TextThis allows you to set some text that is added to the start of the text generated. End TextThis allows you to set some text that is added to the end of the text generated. Add Newline At End If More Than One Item SelectedIf you check this box, then a newline is added after the last item (but before any end text) if more than one file or folder is selected. This can be used to give the behavior that if a single item is selected, the text is generated on a single line (with no terminating newline), but if more than one item is selected then one line of text is generated for each item and the last line also ends with a newline. To achieve this, as well as checking this box, you need to set the Item Separator text to be a newline. Errors in the Item FormatIf you edit the text added when you use the Insert File/Folder Attribute dialog, you can cause errors (i.e. the text between the $ and ; of an item attribute). This can also happen if you enter a $ character without escaping it with a backslash (i.e. without entering it as \$). If this happens you will see this warning symbol next to the command in the list, and next to the Item Format field when that command is selected: Press the warning button and a message will pop up that describes the error. If you press OK when any of the commands have a warning symbol next to them, those commands will not appear in the Windows Explorer context menu. ExampleThe example command Copy Path(s) as Array that is shown in the screen shot above generates text like this:
array = { "C:\\Users\\Mark\\Documents\\Example1.txt", "C:\\Users\\Mark\\Documents\\Example2.txt" } ;
The following table explains how each field is used to get this result.
|