I have a button that, when a Folder/File is selected it copies the path. The Stand code it uses is Clipboard COPYNAMES = path. If I don't have any Folder/File selected it does nothing. I want this button to have what it already has but ALSO be able to copy the path if no Folder/File is selected. I mean I want the path to the current directory. I am also interested to see how I would combine both codes.
Create a button, call it Copy Source Path:
@nofilenamequoting
Clipboard SET {sourcepath|noterm}
You can combine buttons so that a modifier key can switch between two commands. See @keydown here:
Maybe the developers would consider adding an @ifselected command modifier? Along the lines of...
@ifselected:file
Some command that needs a single file
@ifselected:files
Some command that needs multiple files
@ifselected:folder
Some command that needs a single folder
@ifselected:folders
Some command that needs multiple folders
@ifselected:any
What to do if anything is selected
@ifselected:none
What to do if nothing is selected
Regards, AB
I'm stuck on this one too.
I tried something like this.
[code]
@firstfileonly
@ifpathr:.*
Clipboard COPYNAMES
@ifpath:else
Clipboard COPYNAMES=path.
or similarly,
@ifpathr:.*
@firstfileonly
Clipboard COPYNAMES
@ifpath:else
Clipboard COPYNAMES=path.[/code]
- The button will not highlight and be active at all unless a file is selected.
- No matter where @firstfileonly is placed all selected files are copied to the clipboard.
- I agree that
@nofilenamequoting Clipboard SET {sourcepath|noterm}
may be the better code for the path.
A root Dir will return a trailing \ with copynames=path.
Regards,
David
-
Add
Set HIDE
as the first command in the button to ensure the button is always active.
- COPYNAMES seems to copy all names here, overriding @firstfileonly.
It doesn't seem that the else clause can execute via a non-selection. In other words, the @ifpath aborts entirely if there is no selection.
@ifpath doesn't check the selection, it checks the current path.