Rename script with dynamic query

hi folks,

I couldnt figure it out myself and couldnt find a similar topic so heres my idea i cant get running.

My workflow with files is often like searching in a database.
i trigger "Everything Search" by Hotkey and start typing.
in the best case my files look like this:
23-03-2012_GPSoftware_Wireframes_Detailpage_V1_KB

the advantage is that u can search even partial for date of a project or title or type of file or version or or or
its like tagging.

so its in the rename script something like:

{modifieddate}CUSTOMER_TOPIC{name}_V1_AUTHOR

love it or hate it :smiley:

what i cant figure out now is how to get a dialog from opus where i can dynamicly type in the orange fields above
and the Version number i would like to type in a dialog by myself too.

is it possible to get all the formfields in one dialog for this?
and how does it come up in dialog anyway?

i hope someone can help here :slight_smile:

greets!

See if the general idea here:

https://resource.dopus.com/t/a-very-different-need-for-a-filename/15725/1

works. The idea is to place the code in a button, which when executed, present dialogs to you to ask for the fields you want.

thank you MrC

got me almost to the goal i intended...

at the moment i got this code:

@filesonly
@nodeselect
dopusrt /cmd SetAttr FILE {file} META comment:{file}
@set datum={modifieddate}
@set kunde={dlgstring|Kunde}
@set thema={dlgstring|Titel}
@set name={name}
@set version={dlgstring|Version}
@set autor={dlgstring|Autor}
Rename PATTERN ..([^.])$ TO "{$datum}{$kunde}{$thema}_&V{$version}{$autor}.\1" REGEXP

the "datum / date" doesnt work... (i thought i can pass the metadata here but maybe its not possible?)
the "& - sign" leaves me the original filename (which is absolutely fine and intended) but it also passes the suffix :confused: (it worked by accident... maybe the "& - sign" doenst make any sense but i kept it at first, correct me if its wrong)

the renaming looks like this now for example:

123.txt

converts to:

{modifieddate}_KUNDE_TITEL_123.txt_VX_KB.txt

the red ones dont work at all.

is there a way to get the metadata (in fact i need the modify date) in here?
and how do i get rid of the suffix when i want to keep the original name?

the rest works fine after understanding the mechanic described in your posted link MrC, thanks again for this!

You need to include the FILEINFO argument to your RENAME, so that file information fields are enabled.

The way the command above works looks potentially risky to me, since the file descriptions may be set in parallel with the rename. Calling a command via dopusrt runs it in parallel and the rest of the commands will not wait for it to finish. So some files may get renamed before their descriptions are set.

A less important thing to note is that you probably don't need to set all those variables; you can use things like {dlgstring} in the rename command directly and avoid all the @set lines and variables. (Variables are usually only needed if you want to use the same thing in multiple places while only asking for it once.)

So @sync should be appended to the dopusrt line?

That wouldn't help since dopusrt.exe itself launches the command async (and adding @sync would only mean waiting for dopusrt.exe to launch the command, not for the command to finish).

If the description line doesn't work without using dopusrt.exe, I'm not sure if there is currently a good way to do everything in a single button.

Oh, that's a bummer. I'll forward a reference to this thread in the original thread.

I used the dopusrt.exe workaround, because DOpus apparently can't directly set the comment metadata to {file} without it (it incorrectly uses the first item for all selected files. The workaround came from this other thread you posted, so I thought this was the solution). Maybe the real problem can be resolved, so the workaround isn't necessary?

In this case here, I don't know if the OP needs to be setting the comment anyway.

I thank you very much for your help and tips!
Its finally working exactly like I intended and described.

@filesonly @nodeselect dopusrt /cmd SetAttr FILE {file} META comment:{file} @set kunde={dlgstring|Kunde} @set thema={dlgstring|Dokumententyp} @set version={dlgstring|Version} @set autor={dlgstring|Autor} Rename FILEINFO PATTERN .*\.([^.]*)$ TO "{modifieddate}_{$kunde}_{$thema}_{file|noext}_V{$version}_{$autor}.\1" REGEXP

For a stress test I renamed 220 Files at once with the code above and no erros or wrong renamings occured.
It was little time of file catching though but its working very well.

thanks again for the help! :thumbsup: