Advance function

@aussieboykie
There is an issue. But, don't worry about reporting it. I've been typing issues up all day and this is one of my top three that I have been working on.

Instead, let's work together and focus on finding all the things that do not work that should work (that is, they are supported by documented conventions in the User Guide, the Help File, or in a FAQ here on the Centre). We should also try to find which methods do work for workaround purposes. (Jon already posted one to this thread, which Nudel and I also discussed offline earlier today.)

I've attached a toolbar with the following:[ol][li] Initialize Test Cases: Creates the test folder below and populates it with several test folders and files. Use the same button to re-initialize the folder between tests.
%SystemDrive%\Opus 8 Testing\KA00068 -- Quotes in Commands\Test Cases[/li]
[li] CreateFolder Menu - Contains 6 buttons, each with a different syntax variation of this command.[/li]
[li] Copy CREATEFOLDER Menu - Contains 6 buttons, each with a different syntax variation of this command.[/li]
[li] Add Selected to Favorites Menu - Contains 6 buttons, each with a different syntax variation of this command.[/li][/ol]Each button menu contains 6 buttons each with a different syntax variation of the command the menu is named after. The first three buttons are labeled as issues, since that syntax produces errors for at least one of the three different commands. The last three buttons are labeled as workarounds, since these syntaxes seem to work for all three commands.

These are the 6 different syntaxes used:[ol][li] dopusrt /CMD Command ARGUMENT={code value containing spaces}[/li]
[li] dopusrt /CMD Command ARGUMENT="{code value containing spaces}"[/li]
[li] @nofilenamequoting
dopusrt /CMD Command ARGUMENT="{code value containing spaces}"[/li]
[li] @nofilenamequoting
dopusrt /CMD Command ARGUMENT=""{code value containing spaces}""[/li]
[li] dopusrt /CMD Command ARGUMENT "{code value containing spaces}"[/li]
[li] dopusrt /CMD Command ARGUMENT {code value containing spaces}[/li][/ol]In my tests:[ul][li] Syntaxes 1 and 2 error for the first two commands, but not the third command.[/li]
[li] Syntax 3 errors for all three commands.[/li]
[li] Syntaxes 4, 5, and 6 work for all three commands.[/li][/ul]NOTE: Some errors generate error messages, some erroneous results (or no results).

I have Opus v8.2.2.4 U installed. I would like others who have been participating in this thread to download the toolbar and test each of the 18 commands and let me know if your results vary from mine.

Issue: KA#00068 - Commands: Opus incorrectly repositions quotations around external command codes
Status: Analysis
Date:
KA00068--Quotes In Commands.dop (21.8 KB)

Hello,

@Nudel and Aussieboykie
This works:

@nofilenamequoting dopusrt /cmd CreateFolder Name ""{destpath}{file$|noext}""

@Ken,
I've downloaded your toolbar.
I'm working on it.
I can't run your Initialize Test Cases as I'm not on WinXP.
However, it's not much of a problem.
I understand your DOS well enough to proceed.

I use 4NT secondary to the DOpus batch file mode.
I use MS DOS in DOpus, but can easily Call or Execute a 4NT *.btm batch file from DOpus.
I have this line in my autoexec.bat:

set comspec=C:\4PROMPT\4NT\4NT.exe

Easy to turn on or off in MSconfig.

I'll just rewrite it to 4NT.
I'm not certain why you need the ping sleep commands.
4NT can easily do that kind of thing, but why bother?
Your batch file should execute just fine in 4NT without that.

In any case, I already see your point with this first toolbar.
I'll get a little more organized and report back.
I already know what the outcome will be though.

Regards,
Porcupine

[quote="porcupine"]
I've downloaded your toolbar.
I'm working on it.
I can't run your Initialize Test Cases as I'm not on WinXP.
However, it's not much of a problem.
I understand your DOS well enough to proceed.[/quote]
You could also just manually make some test files in any old folder, just make sure you have 6 files and 6 folders for each Command. Just make sure they all have spaces in their names.

I use the :Sleep function (which uses the Ping command) to slow down the script a little, without actually stopping it for the following:[ol][li] So the user (usually me) can read some of the messages that otherwise zip by too quickly.
[/li]
[li] In some my other Opus toolbars still under testing, I use thousands of test cases (you have seen some of my test cases and used some yourself in other threads). During Test Case Re-Initialization, the whole test case folder gets deleted. It can take quite some time for Windows to get the word that the folder is successfully deleted. (The same timing issue that plagues us in a multi-step RegExp rename also plagues this command script). Thus I need the script to keep checking until the folder is actually removed, before continuing to recreate it and repopulate it with untouched test case files and folders. I use :Sleep to force the script to wait a consistent number of seconds between delete attempts and verification checks. After a certain number of unsuccessful verification checks, the script will inevitably prompt the user to take action.[/li][/ol]

Hi Ken,

Thanks !
I'll be looking into that with my rewrite.
Again thanks for the lucid explanation.
I'll let you know what I find in the short term,
and assuming I don't get marooned on North Manitou Island for the winter, long term.

:slight_smile: Porc

[quote="porcupine"]Hello,

@Nudel and Aussieboykie
This works:

@nofilenamequoting dopusrt /cmd CreateFolder Name ""{destpath}{file$|noext}"" [/quote]
Yes. Playing around with Ken's testbed alerted me to the fact that the use of "=" after NAME affects the outcome. The documentation for CreateFolder refers to NAME, not NAME=, and the double quoting thing is normal enough DOS command resolution behaviour, so I'm OK that this is not really a bug. However, the documentation would benefit from being a bit more specific. For example, it states that "The NAME parameter can also be used to specify multiple folders to create simultaneously." but does not say how. I did some tests..

[code]@nofilenamequoting
dopusrt /cmd CreateFolder Name a,s,d,f creates a single folder called a,s,d,f

@nofilenamequoting
dopusrt /cmd CreateFolder Name a s d f creates four folders[/code]
If you use the CreateFolder dialog, then whatever you type in the box is taken to be a folder name - e.g. a s d f is one folder and a,s,d,f is also one folder, unless of course you tick the "Create multiple foders (comma separated)" box in which case it treats a,s,d,f as a request to create four folders and a s,d f as a request to create two folders, all of which is consistent.

Regards, AB

Hello Aussieboykie,

[quote]@nofilenamequoting
dopusrt /cmd CreateFolder Name a,s,d,f creates a single folder called a,s,d,f

@nofilenamequoting
dopusrt /cmd CreateFolder Name a s d f creates four folders[/quote]

Thankyou Aussieboykie.
I wasn't aware of that, but it does make some sense.
In the CreateFolder Dialog one does not need quotes for filenames that include space characters.

Regards,
Porcupine

[quote="porcupine"]
In the CreateFolder Dialog one does not need quotes for filenames that include space characters.[/quote]
In fact the dialog is clever enough to refuse to accept " or indeed any other character that is not valid in a file name, such as : or | or ....

Regards, AB

NAME is a /M argument, listed as NAME/M in the manual. /M and similar are described at the start of the Opus Raw Commands chapter in the manual:

So it makes sense that if you give it 4 separate names it'll create 4 folders.

That said, the /O and /K type of arguments appear to take multiple arguments separated by commas and the manual doesn't mention that at all, so I can understand a bit of confusion. I think that, technically, /O and /K only take one argument (the full string after them, including commas) which is split up later at a different level. A subtle difference... Anyway, the important thing to remember is that /M arguments swallow up what comes after them if it isn't recognised as another argument.

As for the = after argument names, this is usually optional but sometimes required. For example, if you run

CreateFolder NAME FROMCLIPBOARD

then you'll get a folder named after the string in the clipboard. If you wanted to create a folder that is literally called "FROMCLIPBOARD" then you'd have to use

CreateFolder NAME=FROMCLIPBOARD

@Nudel I'm relieved to hear you say that section of the manual is a bit confusing. every time I read that section (which is every time I create a new button), I'm left scratching my head trying to comprehend how each type of qualifier differs from the others.

But confusion aside, wouldn't you agree that it is an issue when Opus rearranges the quotes the user types?

There is a big difference between typing this: ARGUMENT="value" and executing this: "ARGUMENT=value".

Duhhhh !!

Here is an answer to the original question of the post.

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

This results in a folder in the dest named the root of the first selected file or folder.
The content of this folder is a zipfile named the same.
The contents of the zipfile are all selected files and folders.

Wasn't that ' kind of ' the original problem ?

Regards,
Porcupine

And that simplifies to just this:

@firstfileonly @nodeselect dopusrt /cmd copy createfolder {destpath}{file$|noext} zip

Porcupine

@Ken
I've rewritten your Initialize Test Cases batch file as a 4NT batch file.
I saved it as a *.btm 4NT batchfile and ran it from the DOpus button.
In case you're curious, you can download it at the bottom of this post.

OK, my results on Win9x were almost the same as yours.
I had a small problem with Add Selected to Favories Menu.
Both Issue B and Workaround 2 sometimes worked and sometimes didn't.
I haven't been able to find a sequence of events that reproduces the problem every time though.
In any case, a second attempt always cleared the problem and it then worked.

Note that these are syntaxes:
2. dopusrt /CMD Command ARGUMENT="{code value containing spaces}"
5. dopusrt /CMD Command ARGUMENT "{code value containing spaces}"

It should be interesting to try this again with arguments that contain two code values.

Regards,
Porcupine
4NT Initialize Test Cases.zip (1.54 KB)

Thanks for the download, but I don't use 4NT. I don't really have a need, since I can script pretty much anything I need to in a NT Command script. (If I would crack open that Windows Scripting Host book I bought, I could do even more.)

Okay so you are on Windows 98. I'll keep this in mind in the future. I have a whole toolbar that you will not be able to use, unless somehow the scripts can be modified for Win 98. (I don't believe you can use the syntaxes like "Call :label").

Q: So am I clear in understanding that Workaround 1. (syntax 4)and Workaround 3. (syntax 6). both worked correctly on Windows 98 for all three commands?

If so, those are the syntaxes that we should be telling people to use. The more I think about it, it should really be Workaround 6. (which is also what Jon suggested to use).

Q: In the case of Workaround 2. (syntax 5) , can you do the following for me?[ol][li] Empty your %Temp% folder.[/li]
[li] Edit the button and change it to an MS-DOS Command function type.[/li]
[li] Execute the command, such that it does not work.[/li]
[li] Go to the %Temp% folder and find the most recent dop0x.bat file (numbers are hexadecimal).[/li]
[li] open up this file in a text editor and copy-and-paste the batch Opus wrote into a code box here.[/li][/ol]I'd like to see what happened why it didn't work for you.

Hi Ken,

[quote]Q: So am I clear in understanding that Workaround 1. (syntax 4)and Workaround 3. (syntax 6). both worked correctly on Windows 98 for all three commands?
[/quote]
Yes, quite correct.
It was only the Add Selected to Favorites button that I had any trouble at all with any of the workaround solutions.

[quote]If so, those are the syntaxes that we should be telling people to use. The more I think about it, it should really be Workaround 6. (which is also what Jon suggested to use).
[/quote]
Yes, I agree that syntax 6 is the best answer with this set of problems.
As you know, we have only considered arguments that contain one code value.
When Auusieboykie pointed out the problem with path names that contain space characters we were discussing what is now:

@nofilenamequoting dopusrt /cmd CreateFolder Name ""{destpath}{file$|noext}""
This is a two code value problem.
We have yet to discuss these objects.

[quote]Q: In the case of Workaround 2. (syntax 5) , can you do the following for me?

[ul]

  1. Empty your %Temp% folder.
  2. Edit the button and change it to an MS-DOS Command function type.
  3. Execute the command, such that it does not work.
  4. Go to the %Temp% folder and find the most recent dop0x.bat file (numbers are hexadecimal).
  5. Open up this file in a text editor and copy-and-paste the batch Opus wrote into a code box here.
    [/ul][/quote]

I've been trying to do just that.
I've been cranking out example after example that works with little luck now getting it to NOT work.
I did have one instance that didn't work, but it failed to generate a DOS window as well.
I think I did see a brief flash of an animated hourglass, but it did not generate a DOpus bat file for that operation.
Unless I can provide you with a concrete example, I think you're going to have to dismiss it as probable user error.

Regards,
Porcupine

Well,
We have here four buttons.
[ul]

  1. Creates a Folder in the Source named the root of the first selected file or folder.

@firstfileonly dopusrt /cmd CreateFolder {file$|noext}

  1. Creates a Folder in the Dest named the root of the first selected file or folder.

@firstfileonly @nofilenamequoting dopusrt /cmd CreateFolder ""{destpath}{file$|noext}""

  1. Creates a Folder or Zipfile in the Source named the root of the first selected file or folder.
    All selected source files and folders are then copied to the new folder or zipfile.

@firstfileonly @nodeselect dopusrt /cmd copy createfolder {file$|noext} zip here

  1. Creates a Folder or Zipfile in the Dest named the root of the first selected file or folder.
    All selected source files and folders are then copied to the new folder or zipfile.

@firstfileonly @nodeselect dopusrt /cmd copy createfolder {destpath}{file$|noext} zip
[/ul]

Earlier in this thread I used a homemade program called Autofolder .

runmode hide @firstfileonly @nodeselect sync:C:\yourpath\AutoFolder.exe {destpath|noterm} {file$|noext} dopusrt /cmd copy to {destpath}{file$|noext} zip
This worked because Autofolder was an external program.
Sync: delayed the DOpus Copy until Autofolder had created the new folder.
I see no point in attempting to rewrite 3 and 4 as a combination of a DOpus Create Folder and a DOpus Copy command.
A search of this forum will turn up long, long discussions that eventually led to the introduction of the Copy CreateFolder command.

It would be nice to be able to add a readauto to buttons 3 and 4, but it doesn't seem to work.
One could have a second button that does something like this:

dopusrt /cmd Go newtab openindest {destpath}{file$|noext}.zip

... but it's just as easy to double-click the new Folder/Zipfile.

Regards,
Porcupine

Is Copy Createfolder, as distinct from the raw Copy and Createfolder commands, fully documented somewhere?

Regards. AB

Hello Aussieboykie,

[quote]Is Copy Createfolder, as distinct from the raw Copy and Createfolder commands, fully documented somewhere?
[/quote]

Yes and No.
It is noted in the Opus 82 Changes.pdf
It is at page 7/34 or page 7 of 34.
It doesn't say very much though.

It was introduced in DOpus 8.2.0.0
It was a big Woo-Hoo cheer for Jon when it was introduced.
See Steje's post at [url]'Rename' command question]

Thanks much Aussieboykie !
I do think you found a bug.
We shouldn't need @nofilenamequoting for this.

Regards,
Porcupine

If it's in the 8.2 Changes PDF then it should also be in the full manual PDF, since the manual was brought up to date last week:

[Directory Opus 8 manual updated)

If it's missing from the manual then drop GPSoft an email. Greg seems keen to fix manual errors/omissions at the moment.

Thanks Nudel,

I hadn't seen the updated manual yet.
At first glance, I don't see any mention of Copy CreateFolder.

Good idea !
Perhaps Aussieboykie could do the same.
Together, perhaps GPSoft will improve Copy CreateFolder and its documentation.

Regards,
Porcupine

Porc

I experimented with your Copy Createfolder examples (3) and (4). @nodeselect appears to be redundant as no files are left selected whether it is included or excluded. I then added a select reselect statement. It breaks the Copy Createfolder command unless it is expressed in the dopusrt /cmd select reselect format.

In summary, this does not break copy createfolder.

@firstfileonly dopusrt /cmd copy createfolder {file$|noext} zip here dopusrt /cmd select reselect
whereas both of the following prevent copy createfolder from doing its thing.

[code]@firstfileonly
dopusrt /cmd copy createfolder {file$|noext} zip here
select reselect

@firstfileonly
sync:dopusrt /cmd copy createfolder {file$|noext} zip here
select reselect[/code]
Regards, AB