Is it possible? Below I am using the modifier - do I need to split it into 2 functions? Please see the comments in the code...
Thanks a lot
Alan.
//get first file name to use for folder- remove extension
@firstfileonly
@set theFolder {file|noext}
//Now I want to move all the selected files/folders
//into the new folder, not just the first file...
Copy MOVE HERE CREATEFOLDER "{$theFolder}{date|dd_MM_yyyy}"
Well it makes the folder fine from the first selected file but I want all the selected files to be dropped into the new folder. @firstfileonly seems to affect every command after so only the first selected file is dropped in the new folder...
I'm sure there is an easy way...
I converted the 2 buttons I use to match what you already had to maybe help you study it.
This first button does what you want (but I added a space between the selected file name and the date).
[code]//get first file name to use for folder- remove extension @nofilenamequoting @runonce:@set theFolder={file$|noext}
//Now I want to move all the selected files/folders
//into the new folder, not just the first file...
Copy MOVE HERE FILE="{file$}" CREATEFOLDER="{$theFolder} {date|dd_MM_yyyy}" @nodeselect[/code]
This second button does the same thing but opens a dialog first. It's pre-filled with the name of the first selected file and the text in the dialog is auto selected (remove the S from dlgstringS if you don't want it auto selected). This gives you a chance to modify the folder before it's created. The date does not show up in the dialog but it does get added. And again, a space was added between the selected file name and date.
[code]//get first file name to use for folder- remove extension @nofilenamequoting @set theFolder={dlgstringS|Enter name of folder to move selection into (Date gets auto added)|{file|noterm|noext}}
//Now I want to move all the selected files/folders
//into the new folder, not just the first file...
@ktb
Interesting approach to fetch something from the first selected item and reuse that throughout the rest of the button-code which again affects all items.
Never seen this before I think?! o)
You got me. I have no idea how that code works I originally thought I requested the button, but it looks like someone else did ([url=https://resource.dopus.com/t/creating-folders-from-filename/5931/8]) and of course, Leo came to the rescue
I really need to start adding comments and forum links to my button code so I know where it originally came from. I'll start with this one
I guess I know why that code works as it does, any @set directive is called only once if I'm not wrong, so that's probably where the magic is in?
Though I see in the thread you linked (and here), Leo prefixed @set with @runonce:, I did not know you could stack directives this way, but maybe it isn't necessary for @set at all? I will never get my head around these button codes, too many exceptions from what you expect to work, while also providing many things you'd never think of being possible. o)