@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)
@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.
[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]
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.
@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.
[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.
[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 ....
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
@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".
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.
@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.
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.
[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]
Empty your %Temp% folder.
Edit the button and change it to an MS-DOS Command function type.
Execute the command, such that it does not work.
Go to the %Temp% folder and find the most recent dop0x.bat file (numbers are hexadecimal).
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.
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
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.
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