Toolbar button that can NAME a created zip file on the fly?

This command function will take the selected file/s and append the newly created zip file with whatever file happened to be first from the list. My question is what is the argument to combine with the command above, to name the new zip INLINE, or to display a dialog box for a name? (preferably with a default text string that you would like to start with).

I'm pounded my head and trial and errored out, and now ask for a tip from the more DOpus savvy...Thks ahead if any.

There are a few ways to do it but this is probably the best:

Copy ADDTOZIP HERE

Thanks leo, you know actually I had got as far as your suggestion myself already (Copy ADDTOZIP HERE) but I wrote that off, let me explain why. With that command there you get the highlighted input area ready for a name...but the whole path including the zip ext. is all highlighted, and you then would have to single out the name part of that path of info, highlight and insert the correct name you want.
That would be more steps than just going with the default creat a zip button, after zip creation, just select the file then jump up to the toolbar and tap your "Rename" button or hit F2, etc..(then you are left with the results I was trying to figure out..just the name part of the new file name highlighted). Do you or somebody know what the argument to add for THAT would be? I know it exist and that is what nawed at me the most because I couldnt throw it together, myself, (more so than the the maximized little less input it would resolve). I realize that somebody might be saying Oh, this person is being abit anal rententive or going overboard, lol...but Im all game for the answer. :laughing:

I noticed that as well, but I don't think it matters: If you type over the name, including the path, and just type a new name (without any path) then it's still created below the current directory.

You can have buttons which prompt you for a string and feed that string into the command, e.g. using {dlgstring ...}, but in this case I think using ADDTOZIP is better.

Try this one out.

Copy ZIP HERE CREATEFOLDER="{dlgstring|Enter an archive name|MyDefaultName}"

If you are interested in a command that defaults the archive name to the name of the folder containing the selected files, use this:

Recommended:

@set ArchiveName={dlgstring|Enter an archive name|{sourcepath$|nopath}} Copy ZIP HERE CREATEFOLDER="{$ArchiveName}"

Not Recommended:

Copy ZIP HERE CREATEFOLDER="{dlgstring|Enter an archive name|{sourcepath$|nopath}}"

By default, Opus executes a zip function, once per each selected file. In the command from my earlier post, Opus only prompts once for the whole command, using {dlgstring} to get the default archive name. However, because the command above uses both {sourcepath$} and {dlgstring}, Opus ends up prompting you for the archive name, once for each selected file. It has to do with how Opus parses its attributes.

So in the recommended command I set the ArchiveName variable first, where Opus is sure to only prompt for the archive name once (because the @set directive will only execute one time regardless of how many files are selected). Afterward, Opus reuses the {$ArchiveName} expanded value in each iteration of Copy ZIP, once for each selected file.

FANTASTIC! Yes, you are right leo, the ADDTOZIP was basically good enough after all. Just ignore whats there highlighted and put the name in and thats all I was looking for, that it would still just go ahead and plain name it, nothing else! (thanks for pointing that out to me, otherwise I found it, and it still would have got past me, because I didnt think it would handle it like that, I pasted in what you needed in the right place and thought if u do otherwise you end up with a mess).

And hats off to Kenalcocks post which put the last final polishing touch too what it would take to conform that command to add just some default fault text string to the new name. It increased my learning curve giving me a broader view of the more comprehensive level of knowledge of the mechanics of control codes soforth, that a person will need, to put together these buttons made with custom functions, it was not missed Kenneth, me and other folks thank you (espescially when you see that multiple confirmation dialogs for new name popping up for each seperate file if it was more than one being zipped lol).
P.s. Kenneth the code to try and have it default start with the original archive name didnt seem to work at all (didnt do anything) but nothing lost...Thanks much again
Kind Regards

Read this post for how to add the button code below to one of your toolbars. The button works fine for me, when I select several files, even with spaces in the names. This is the button that defaults the archive name to that of the Source folder.

<?xml version="1.0"?> <button backcol="none" display="both" textcol="none"> <label>Zip</label> <tip>Copy selected files to .zip archive in source folder.</tip> <icon1>#addtozip</icon1> <function type="normal"> <instruction>@set ArchiveName={dlgstring|Enter an archive name to zip selected files to:|{sourcepath$|nopath}}</instruction> <instruction>Copy ZIP HERE CREATEFOLDER=&quot;{$ArchiveName}&quot;</instruction> </function> </button>

Also, watch out for line wrapping.