Understanding @perfile command modifier

I am trying to learn how to apply @perfile to run a multiple selected files (Apple.cbz, Banana.cbz as example).
From the info I found in
Command modifier reference [Directory Opus Manual]
I am going to explain my problems

  1. First example
echo 1 {file}
echo 2 {file}

When I run it, "Windows can't find "echo". Check this name is correct"
then for the rest of this article, I will change echo to @output
hope this is correct. New test:

@output 1 {file}
@output 2 {file}

The output I have is

1 Apple.cbz
1 Banana.cbz
2 Apple.cbz
2 Banana.cbz

That means each command is run with all the selected files before going to next one.
What I want is the full script applied to each file before begining with the next one.
The result I am looking is:

1 Apple.txt
2 Apple.txt
1 Banana.txt
2 Banana.txt

Then I modify the script including @perfile:begin and @perfile:end

@perfile:begin
@output 1 {file}
@output 2 {file}
@perfile:end

I run the script selecting the two files and.... nothing happen.. :sob:
Is it related with @output usage instead of echo?
Then what do I am doing wrong? :scream:

Yes. Either use echo in a DOS button or

=Output("1 " + file)
=Output("2 " + file)

in a standard button.

Sorry. I don't understand
I configured your recomendation. Nothing happen when I run it.

The evaluator will only output to the script log. Have a look there.

As always, thanks for the fast answer @lxp :+1:

I'm a bit confused with log usage.

I was using "area 2" as log for the execution (with shift + F5)
after your observation, I found "area 1" which is also called "script log" but show different messages than the previous one (as you can see in the image)

On the execution I find that all the lines begining with @ between @perfile:begin and @perfile:end are not executed. This is why I had to change @output command to =Output
Is this correct? How do I assign variables or use the @sync command?

I don't think we can see the code that you're running now, so it's hard to say what's wrong. The code we can see doesn't look like it uses @perfile or matches the output in the screenshots, unless I'm confused.

If you need all of variables, @perfile and @sync, I would change approach and use JScript here instead of basic commands/modifiers. It will make things easier.

(I'm not sure you'll actually need @sync when running 7z.exe, as I think it'll be synchronous by default.)