Advance function

hi, yes....it's hard to begin the advance functions, a lot of parameters, lot of symbols, hard to begin....and quicly the headache but very intresting...hum, so i want to know where are the limit by this "challenge":

i would like to create a button who do a lot of things in the same lister, but first i need select manualy somes files and folders and after this famous button will do:

1-take to clipboard the name without extension of the first selected files(or folders)
2-Create A folder* with this name in the clipboard
3-move files and folders in this Folder*
--a second button with previous function and:
4-zip this folder*
5-Delete this folder*

so of course i tried to do myself but i have no good result especially in the name of the folders(1) and to move files into this folder(3), i try to use like "Copy to=sub" but of course it doesn't work and i understand it....So for me it's hard, the only thing that i know it's you can tell me if i possible or not or to find an another way to do that.....

Very thanks to yours if you can help me.....=)

Hello y0y0gigi,

I considered this problem some time ago and have a partial solution to it.
My answer isn't the best answer, but it ' kind of ' works.

I begin by opening a dual pane lister.
In the source pane select manually some files and folders.

I create the New Folder in the dest pane using a command line program I wrote.
The program can be downloaded at the bottom of this post.
The button is:

runmode hide @nodeselect @firstfileonly C:\yourpath\AutoFolder.exe {destpath|noterm} {file$|noext}
Autofolder is a command line program I wrote for my personal use some time ago.
The result is a folder in the dest pane named the root of the first file or folder selected in the source pane.

Open the newly created folder and copy/move your selected files and folders into it.
Select the dest pane.
Go up to the parent folder and select the new folder.

This button will zip it all.

Copy Move ADDTOZIP Here

A dialog pops up and prompts for a name, but the default is just the name you want.
Press OK and the zip file is created.
The folder and its' contents are internal to the zip file now.
There is no need to delete the original folder.
It is already gone.

Other solutions are possible.
Other people have done parts of this in different and perhaps better ways.

However, I recognized your problem and am simply passing on what I have on the topic.

Regards,
Porcupine
AutoFolder.zip (28.2 KB)

Ooops,

You might prefer just to use the second button.

Copy Move ADDTOZIP Here

All you need to do is eliminate the extension part of the default filename in the pop up dialog.
Press OK .

The problem I had was quite similar, but just a little different.

Regards,
Porcupine

Well, I've made a little more progress.
I really don't remember exactly why I wrote my little Autofolder program.
The good news is that I still have it.

The bad news is that I could have just used :

dopusrt /cmd CreateFolder NAME={destpath}{file$|noext}

Well, for whatever reasons at the time,
I have my little autofolder program.

Here's the good news.

runmode hide @firstfileonly @nodeselect sync:C:\yourpath\AutoFolder.exe {destpath|noterm} {file$|noext} dopusrt /cmd copy {allfile$} to {destpath}{file$|noext}

Now all the selected files are copied into the new folder that was named as the root of the first filename.

:wink: :wink:
Porcupine

Just tried this and discovered that..dopusrt /cmd CreateFolder NAME={destpath}{file$|noext} does not work when the destination path name contains spaces. The solution is to use..dopusrt /cmd CreateFolder NAME={ds}{file$|noext}
The same problem occurs if the filename contains spaces. You can use fileshort$ to get around this but the outcome is probably not what you want.

Regards, AB

Further experimentation serves to confuse (my addled brain).

SomeFile.zip is selected in the source pane and E:\2006 Sep is the active directory in the destination pane.
I expected that the following would create a subdirectory called SomeFile in the destination pane:

@nofilenamequoting dopusrt /cmd CreateFolder NAME="'{destpath}{file$|noext}'"
But it produces a CreateFolderError as follows..

An error occurred creating folder "E:\2006 Sep\SomeFile": The filename, directory name, or volume label syntax, is incorrect. (123)
The syntax of the folder name string looks OK to me. I must be missing something.

Regards, AB

[quote="aussieboykie"]Just tried this and discovered that..dopusrt /cmd CreateFolder NAME={destpath}{file$|noext} does not work when the destination path name contains spaces. The solution is to use..dopusrt /cmd CreateFolder NAME={ds}{file$|noext}
The same problem occurs if the filename contains spaces. You can use fileshort$ to get around this but the outcome is probably not what you want.

Regards, AB[/quote]

This is a bug, and I am reporting it to GP Software.

I haven't reported the bug yet because I am still testing, and it's very closely related to another bug that I have already reported to GP Software. What I do know so far, is that while you are typing a command like this:

dopusrt /CMD Copy FILE={file$} CREATEFOLDER={file$|noext}HERE

or like this

dopusrt /CMD Copy FILE="{file$}" CREATEFOLDER="{file$|noext}" HERE

Opus actually attempts to execute this:

dopusrt /CMD Copy "FILE={file$}" "CREATEFOLDER={file$|noext}" HERE

Which means that if your first file was named "File Name.ext", then Opus would look for a file named "FILE=File Name.ext" and try to copy it. And of course you do not have such a file, so you see an error.

As a workaround you can use @nofilenamequoting to disable automatic quoting and manually put the quotes in where they should be.

See my 06:02 append above. That doesn't seem to work, at least in the case I described.

Regards, AB

Oops, I missed that before.

I think the reason it doesn't work is that you're using " and '. You should only use " as I don't think ' works as a quote character in commands; either way you shouldn't use both at once.

If you take the internal (single quotes) out you end up creating subdirectories 2006 and Sep in the root of [b]E:[/b]. This looks like a bug.

Regards, AB

Ah, it's not a bug, it's because the command is being parsed twice after it's generated: First by MS-DOS and then by Opus.

Try using two " instead of "' and '". If that doesn't work try using three, and so on. MS-DOS does strange things to quotes sometimes but it usually starts to work if you add enough of them (but not too many :slight_smile:). Usually you only need two.

Something like this should work, although I haven't tried it:

@nofilenamequoting dopusrt /cmd CreateFolder NAME=""{destpath}{file$|noext}""
The doptest tool by Tanis is good here for checking the command that you're generating after it's been processed by MS-DOS.

[quote="kenalcock"]I haven't reported the bug yet because I am still testing, and it's very closely related to another bug that I have already reported to GP Software. What I do know so far, is that while you are typing a command like this:

dopusrt /CMD Copy FILE={file$} CREATEFOLDER={file$|noext}HERE

or like this

dopusrt /CMD Copy FILE="{file$}" CREATEFOLDER="{file$|noext}" HERE

Opus actually attempts to execute this:

dopusrt /CMD Copy "FILE={file$}" "CREATEFOLDER={file$|noext}" HERE

Which means that if your first file was named "File Name.ext", then Opus would look for a file named "FILE=File Name.ext" and try to copy it. And of course you do not have such a file, so you see an error.[/quote]

Try leaving out the = signs - change to a space. Eg,

dopusrt /CMD Copy FILE {file$} CREATEFOLDER {file$|noext} HERE

That above does work.

OK, Great !

Sorry I missed the late night discussion !
Nudel, do you ever sleep ?

@nudel and all
After using Doptest to debug, I find that this works.

@nofilenamequoting dopusrt /cmd CreateFolder NAME=""{destpath}{file$|noext}"
Yes, that is two quotes after 'Name' and one quote at the end.
This must have been part of why I wrote a short command line program to do this.

@Ken
I also have considered using the Copy CreateFolder command.
It may be better in the end.
Nudel's Setclip program could be used.
However, it results in either:
a) another button to set the clipboard to the first file$|noext .
b) the use of @firstfileonly and then the use of allfile$ as my solution does.
This has the inherent flaw of being limited to the DOS command line character limit.

@Jon
Is it possible to cancel the @firstfileonly directive ?
I'm thinking something similar to this button that uses a fictional @allfiles directive:

runmode hide @firstfileonly @nodeselect sync:C:\yourpath\AutoFolder.exe {destpath|noterm} {file$|noext} @allfiles dopusrt /cmd copy {file$} to {destpath}{file$|noext}

Regards,
Porcupine

[quote="porcupine"]@Jon
Is it possible to cancel the @firstfileonly directive ?
I'm thinking something similar to this button that uses a fictional @allfiles directive:

runmode hide @firstfileonly @nodeselect sync:C:\yourpath\AutoFolder.exe {destpath|noterm} {file$|noext} @allfiles dopusrt /cmd copy {file$} to {destpath}{file$|noext}

Regards,
Porcupine[/quote]

@Porc
I just submitted a feature request earlier today for a different external command code that would only process the first selected file or folder, which would enable you to accomplish what you are trying to do. It would also have other useful applications as well.

Hi Ken,

Yes, I hope something similar to that can be done !

I'll be backpacking North Manitou Island last week of September and part of the first week of October.
The last boat of the season leaves Oct 8 weather permitting.

Thanks Ken !

Regards,
Porcupine

[quote="nudel"]Ah, it's not a bug, it's because the command is being parsed twice after it's generated: First by MS-DOS and then by Opus.

Try using two " instead of "' and '". If that doesn't work try using three, and so on. MS-DOS does strange things to quotes sometimes but it usually starts to work if you add enough of them (but not too many :slight_smile:). Usually you only need two.

Something like this should work, although I haven't tried it:

@nofilenamequoting dopusrt /cmd CreateFolder NAME=""{destpath}{file$|noext}""
The doptest tool by Tanis is good here for checking the command that you're generating after it's been processed by MS-DOS.[/quote]
Thanks for the pointer to doptest. It has allowed me to establish that this is a bug (IMO) but before I report it I thought it would be prudent to let the experts have a look. This works....

@nofilenamequoting dopusrt /cmd CreateFolder NAME=""{destpath}{file$|noext}"
Note the mismatched number of opening (2) and closing (1) double quotes. If I add a second closing double quote, it fails.

Regards, AB

Seems to work for me, although I'm running a version that's slightly different to the release version (but not very different in this regard as far as I know).

You can see exactly what's being generated by setting the type to MS-DOS, adding a Pause command to the end (so the temp file isn't deleted) and then going to %TEMP% and viewing the most recent dop*.bat file which will contain the command Opus generated.

It's worth remembering that MS-DOS may move quotes around when it parses things. Removing the = signs might solve the problem.