Using Project code in renamer

Started by blinkystar, September 20, 2014, 01:36:41 AM

Previous topic - Next topic

blinkystar

Hi,

I tried to use the Project code of the renamer to create a new Folder for my Images, but the Dialog box doesn't come up and there is no subfolder created accordingly (as no Project Name could be given). The step is just ignored by the renamer.
What do I do wrong?

In the help file it is stated:
Project Codes
The project code is a special step because it causes IMatch to display a text input dialog at the time the Renamer preset is executed.
You can add a step of this type if you want to include a specific project code, model name, client id or similar in your file names. Using a project code creates dynamic presets which you can customize at runtime. The Renamer allows any number of project codes. IMatch will show the input dialog for each project code in the same order in which they appear in the processing instructions.

Project Code Variable
The special {Renamer.ProjectCode} variable can be used everywhere you can use variables, including Text, Replace, Move and Copy steps. This allows you to move files into new folders based on a project code. Very neat if you keep your files organized in "per-project" folders.


That is exactly what I need, but I can't make it work. ???

The code is the following:
C:\Users\Public\Pictures\Camera\{Renamer.ProjectCode}\{File.DateTime|format:YYYY}\{File.DateTime|format:MM}

Assuming the file was created in July 2014 and the Project code (to be entered via upcoming Dialog) shall be Summer
this should copy the file to
C:\Users\Public\Pictures\Camera\Summer\2014\07\img123.jpg
instead it copies the file to
C:\Users\Public\Pictures\Camera\2014\07\img123.jpg

Also in the preview the same behavior.

All steps see Attachement.

Thanks for help.

PS: just recognized, that I put the question into the wrong forum part. but I can't change this anymore.


[attachment deleted by admin]

Mario

I don't see a project code step in the screen shot?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

blinkystar

thanks for your quick response!

The Project code is used in the blue part, when copying the file:
C:\Users\Public\Pictures\Camera\{Renamer.ProjectCode}\{File.DateTime|format:YYYY}\{File.DateTime|format:MM}

As I read in the help: The special {Renamer.ProjectCode} variable can be used everywhere you can use variables....

But it seams to be, it is not possible in combination (only), instead I would have to define it before ?

I've inserted a separate Project step into the list like attached, but then it attaches the name of the Project ot the picture's Name too, instead to the folder's Name only.
the result is:
C:\Users\Public\Pictures\Camera\Einstellungen & Tests\2010\07\IMGA0353Einstellungen & Tests.jpg
but I'ld intent to get:
C:\Users\Public\Pictures\Camera\Einstellungen & Tests\2010\07\IMGA0353.jpg

How should the step list look like?

Thanks a lot for your help!


[attachment deleted by admin]

sinus

I think, you must first use at least ONCE use the project code (with the dialogbox to enter text, this gives you the first code to work with).

See my attachement, this would work, but not, if I delete the first step.

So, if you project codes does change often, this is the correct way.

If you always the same name, use a fix name for it.

I guess, this is the step, what Mario has searched for in your renamer-attachement.



[attachment deleted by admin]
Best wishes from Switzerland! :-)
Markus

Mario

If you don't use a project code step in your Renamer preset, the variable is not usable. It needs the project code step to initialize it, and to bring up the dialog box where you can select the project code. The project code is designed to become part of the file name, not to be just used to create a folder name or something. You need to come up with another solution if you need to do something like this.

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Erik

A solution I used at one point when I renamed all my files:

Test this out before using on your real files.

I inserted the project code either at the end or beginning of the file name.  I don't remember exactly where nor do I think it matters as long as you know you've done it.
I made certain that the project code in the file name was bracketed by some arbitrary but unique characters/symbol combination.  I think I just used two dashes (--) to bracket the code (or start or end it).

The ultimate purpose was that I followed the series of bracketing and project code insertions with a remove action using regular expressions.

I used a regular expression such that it matched the bracket symbols and whatever was in between.

For instance, the regex if I was bracketing the code with two -- as I stated above would be something like --.+-- (although I think I may have had to escape the dashes). 

It is a bit of a workaround, but once you have done that, the Project Code is accessible to anything else after it is found, for instance as you tried to use it.

The key to this working as flexibly as possible is using a bracket that you know won't come up anywhere else in your naming scheme.  For instance, using one - wouldn't work in mine because I use dashes to separate versions from their masters.  You don't want to inadvertently remove more than you expect.  Of course if you put the Project code at the very beginning, you can use the ^ to match the start the file name and then be confident that whatever character you use to follow your project code never shows up in the project code itself.  You can also use better formed regex.  Using .+ is not the best form as it can get carried away and match too much.

Test this out before using on your real files.


P.Jones

Quote from: blinkystar on September 22, 2014, 12:41:28 AM
thanks for your quick response!

The Project code is used in the blue part, when copying the file:
C:\Users\Public\Pictures\Camera\{Renamer.ProjectCode}\{File.DateTime|format:YYYY}\{File.DateTime|format:MM}

As I read in the help: The special {Renamer.ProjectCode} variable can be used everywhere you can use variables....

But it seams to be, it is not possible in combination (only), instead I would have to define it before ?

I've inserted a separate Project step into the list like attached, but then it attaches the name of the Project ot the picture's Name too, instead to the folder's Name only.
the result is:
C:\Users\Public\Pictures\Camera\Einstellungen & Tests\2010\07\IMGA0353Einstellungen & Tests.jpg
but I'ld intent to get:
C:\Users\Public\Pictures\Camera\Einstellungen & Tests\2010\07\IMGA0353.jpg

How should the step list look like?

Thanks a lot for your help!

Hi Blinkystar

You need to add a Remove Text option to remove the Project Code, see attached file


[attachment deleted by admin]

blinkystar

Yep, that works perfectly. Thanks to Erik and P.Jones!

I think also the trick with the extra arbitrary symbols is a useful one to prevent unwanted deletions of parts of the name in case you shift or copy from named pictures (not from camera sorces).
It also works with multiple project codes by use of the index:
To insert more 'variables', use again the Project code step for the Project code as often as you need. Then access the first set project code with {Renamer.ProjectCode|index:1}, the second with {Renamer.ProjectCode|index:2} a.s.o. - Don't forget to delete it again to avoid the inclusion into the file name.....

If you won't need any part of the orignial file name, the easiest way is to insert the number of Project code/s you need at the beginning of the workflow with Project code steps, and then just delete the complete filename. After that you can re-build the filename based on Project code, date, time... etc.


stefanjan2

The attachment examples have been deleted in the above thread. Any chance that someone could repost them.

I would like to use Renamer to create project folder names e.g. in the format 2023-10-02 - {Renamer.ProjectCode}

The help topic https://www.photools.com/help/imatch/ren_basics.htm#a_pcode?dl=hid-52 gave the impression that Project Code could be used to create folder names. Maybe the help text should clarify that Project Codes can only be used with file names not folder names.

Also I'm wondering whether it would be feasible to allow the project code to be used in folder names.

Mario

#9
You are replying to a topic that is almost 10 years old (from 2014!). Please don't.
If a thread is cold for a couple of months, just start a new thread, Maybe link to the old thread if needed.

If you think you have found an issue with the help system, use the feedback link available at the bottom of each help page.
If you think you have found a bug, create a post in the bug report board.

Renamer variables should work everywhere, including Copy & Move steps.
Maybe there is a regression or a plain bug.
Just tried it. Works fine.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

thrinn

Quote from: stefanjan2 on October 02, 2023, 11:18:18 AMThe help topic https://www.photools.com/help/imatch/ren_basics.htm#a_pcode?dl=hid-52 gave the impression that Project Code could be used to create folder names. Maybe the help text should clarify that Project Codes can only be used with file names not folder names.

Also I'm wondering whether it would be feasible to allow the project code to be used in folder names.
No need for a feature request - Project Code indeed can be used as part of folder names. Just use this expression as "Destination Folder" in a Copy or Move step:
{File.DateTime|format:YYYY-MM-DD} - {Renamer.ProjectCode}
However, it gets a bit tricky with respect to the following details:
  • You must include a "Project Code" step in your Renamer preset. Otherwise you can't access it by a variable.
  • By default, this Project Code will be also added to the filename, not only used for the folder name. I assume you don't want that.
  • Therefore, I use a "Remove Text" step to "clear" the filename. Activate "Regular Expression" and enter ".*" as Text to remove. From the Renamer's point of view, the filename will now be empty (which is not allowed).
  • Then, add a "Original File Name" step to "insert" the original filename. Or use a "Text and Variables" step instead to change/generate/create the filename according to your needs.
  • Add the Copy or Move step as the last step, using the expression shown above.

2023-10-02 13_16_13-IM Test 01.imd5.jpg
Thorsten
Win 10 / 64, IMatch 2018, IMA

Mario

Simpler: Add a RemoveText step with {Renamer.ProjectCode} variable after the project code step to remove it from the file name.
This keeps it available in the variable.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

thrinn

Quote from: Mario on October 02, 2023, 01:25:36 PMSimpler: Add a RemoveText step with {Renamer.ProjectCode} variable after the project code step to remove it from the file name.
This keeps it available in the variable.
Why is this simpler? The only difference is to use {Renamer.ProjectCode} instead of a "catch-all" regular expression in the RemoveText step, isn't it? (Maybe this is indeed simpler to understand).
 
We still need a "Original File Name" step somewhere after the RemoveText step. One could think of using "Original File Name" as the first step, followed by a "RemoveText" with {Renamer.ProjectCode}. But this step order might have unwanted side effects: If the string entered as project code is part of the filename, it will also be deleted there.
Thorsten
Win 10 / 64, IMatch 2018, IMA

stefanjan2

Quote from: thrinn on October 02, 2023, 01:21:20 PMThorsten, thanks for your answer. I can see that in your screenshot the file uses the original file name. But when I try it the Project Code gets added as a prefix to the file name. See screen shot attached.

Can you tell what I'm doing wrong?

Mario

When you add a project code step it will be added to the file name. That is it's purpose, after all.
If you only want to use the project code as a variable e.g. in the Move or Copy step, you must remove it from the file name again while keeping the step.

See the solutions thrinn and I have provided above while answering your question.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

thrinn

Quote from: stefanjan2 on October 02, 2023, 04:40:08 PM
Quote from: thrinn on October 02, 2023, 01:21:20 PMThorsten, thanks for your answer. I can see that in your screenshot the file uses the original file name. But when I try it the Project Code gets added as a prefix to the file name. See screen shot attached.

Can you tell what I'm doing wrong?
Hm, the steps look identical to my solution.
Did you set the "Regular Expression" checkmark in the "Remove Text" step?
2023-10-02 17_47_15-IM Test 01.imd5.jpg
Thorsten
Win 10 / 64, IMatch 2018, IMA

stefanjan2

Quote from: thrinn on October 02, 2023, 05:48:52 PMDid you set the "Regular Expression" checkmark in the "Remove Text" step?
No I didn't. But I have now and it works! Looking at the help text, I would never have worked that out without your help. You're star! Many thanks![/quote]

Mario

QuoteLooking at the help text, I would never have worked that out without your help.
Which help text do you mean? The Renamer help for the RemoveText step?
It has an explicit link to the Regular Expressions topic.

As always, if you find a typo or wrong/missing information on a help page, use the feedback link at the bottom of that page to let me know.

If you have some free time at your hand, I recommend reading Regular Expressions in the IMatch help system.
You can try out regular expressions with the IMatch RegExp Tester app available in the App Manager.

Regular expressions are very powerful and supported by many features in IMatch. They often make things possible that could not be done otherwise. From searching to file relations.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

stefanjan2

Quote from: Mario on October 02, 2023, 07:28:06 PMIf you have some free time at your hand, I recommend reading Regular Expressions in the IMatch help system.
You can try out regular expressions with the IMatch RegExp Tester app available in the App Manager.

Regular expressions are very powerful and supported by many features in IMatch. They often make things possible that could not be done otherwise. From searching to file relations.
Thanks Mario, I have read these sections in the past but found my brain hurt. Also I think my requirements from iMatch are quite simple, it's probably overkill for me but I do find that imatch supports my workflow far better than any software I've used in the past.[/quote]

Mario

#19
IMatch supports many different workflows - that's why it has so many options.

Regular expressions can become very complex. But luckily you usually only need the most simple variants.

.*  => "All" text

\.jpg$ =>ending with .jpg

^beach => starting with beach

The last two patterns can be very helpful if you need to find specific files.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

stefanjan2

Just wanted to thank you again. Your solution is such a time saver for me.

Mario

Quote from: stefanjan2 on November 02, 2023, 05:40:24 PMJust wanted to thank you again. Your solution is such a time saver for me.
Awesome!
Please spread the word. Let others know about IMatch. That's the best "marketing" I can get.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook