Bug in internal command?

Hi,

Incompatibility with Select and rename command ?

I created a button that changes extension of selected files. This command does the job:

Rename TYPE=files REGEXP PATTERN="^(.*)(\.[^.]+)$" TO="\1{dlgstring|Enter wanted extension|.}" autorename
but if I add (cause I consider it's a better way):

select NONE select SIMPLE Rename TYPE=files REGEXP PATTERN="^(.*)(\.[^.]+)$" TO="\1{dlgstring|Enter wanted extension|.}" autorename
It simply fails. DOpus jumps to "rename" command and forget "select" command.

Yet if "select" command are used alone,

select NONE select SIMPLE
it works.

Do I do something wrong ?

Spaces in variable

I created a button that add trailing number to files or folders so that for example: "test.mp3" files or "test" folders results "test - 01.mp3" and "test - 01" and so on.

I had to use variables so that it works for files as well as folders. Plus variables allows to choose options order:

@nodeselect @runonce:@set num={dlgstring|Enter leading number|01} @runonce:@set sep={dlgstringS|Enter a separator, a space or nothing|" - "} Rename TYPE=files NUMBER {$num} REGEXP PATTERN="(.*)(\.[^.]+)$" TO="\1{$sep}[#]\2" autorename Rename TYPE=dirs NUMBER {$num} REGEXP PATTERN="(.*)" TO="\1{$sep}[#]" autorename

But spaces filled in alone or around a separator such as [ - ] aren't taken into account in the new name, I get "test-01.mp3" instead of "test - 01.mp3". Tough, {$sep} = [ - ] and no [-].

So I have to change ... TO="\1{$sep}[#]\2" ...
with

... TO="\1 {$sep} [#]\2" ...
It's not logical because this code works:

@nodeselect Rename TYPE=files NUMBER {dlgstring|Enter leading number||01} REGEXP PATTERN="(.*)(\.[^.]+)$" TO="\1{dlgstringS|Enter a separator, a space or nothing|"-"}[#]\2" autorename

Conclusion of my various tests: variables don't take in account leading and trailing spaces.

Do I do something wrong here too ?

Ban folder or files to execute commands

I made a button that rename 2 or more files, if their extensions are different, with the same name. It's useful for rename a movie and its subtitle :wink: :

@nodeselect @filesonly Rename PRESET="Nettoyage" Rename TYPE=files REGEXP PATTERN="^(.*)(\.[^.]+)$" TO="{dlgstrings|Entrer un nom}\2" autorename

It works great on files but although it doesn't rename selected folders it opens dialog box for them anyway as if it were ready to do the job.

Is there a way to prevent this behaviour on folder, none dialbox opens ? Or is there a way to customize an error dialbox that warns that folders are not allowed ?

Please, help me to solve these 3 points :slight_smile:

Point 1: {dlgstring} is parsed before the actual commands are run, so you will be asked for the extension first. However after that, the Select command IS run and you can specify the pattern you want. So the order might be unintuitive but at the end of the day the command does actually work.

Point 3: Put @filesonly at the top of the command and it should ignore directories.

I was confused enough that "select NONE" didn't run first, before dialbox, so I didn't see that the code did the job anyway. I rearranged the code so that it's more intuitive :wink: :

@filesonly Select NONE Select *{dlgstring|Enter extension to change|.} Rename TYPE=files REGEXP PATTERN="^(.*)(\.[^.]+)$" TO="\1{dlgstring|Replace with...|.}" autorename

Yes, it was already in my code (see 1st post point 3). I tried to put it in before "@nodeselect" with no more success. Try the code on files then folders and you'll what I mean.

So point 2 and 3 aren't still solved. Who will take up the challenge ?
Unless they're bugs. In this case advanced users need to confirm them.
You can do it !
:wink:

Keeping tracks of three parallel issues in one thread is a pain in the behind:

[Ask one question per thread)

:slight_smile:

Also, what is the Nettoyage rename preset? Have you tried TYPE=Files on the line which runs that?

Do you mean that I should create a topic for each point?

The "nettoyage" preset is a "cleanup and format" preset that I made. It doesn't open dialbox by itself and its presence doesn't change anything in the command behaviour, it's not needed and can be removed from the code. So the code can be simplified to:

@filesonly @nodeselect Rename TYPE=files REGEXP PATTERN="^(.*)(\.[^.]+)$" TO="{dlgstrings|Enter new name}\2" autorename

I created individual topics for point 2 and point 3 (click on them)

Please, could an admin delete or at least rename this topic as:
Incompatibility with Select and rename command ?
and remove point 2 and 3 from the first post :question: