Tokens, renaming - I do not get it

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Tokens, renaming - I do not get it Wed Jun 26, 2019 6:24 pm • by Saratxe
Problem:

I get my banking statements via online banking as a PDF.
Inside the PDF there is a number, increased each time I download the newest statement.
I use content matches "Nr. [123]" and become a green match.

Now I want to rename it to:

Banking 2019-[123].pdf

So, I've to use a token to take over the found number for renaming, right?
But if I use a token, name it "Nr." search for "Nr. [123]" my PDF file will renamed to:

Banking 2019-Nr..pdf

I tried different things but it seems I do not understand how tokens work. :-(

Can someone please tell me step-by-step how I've to configure Hazel so that I can insert a matched Text, in my case a two digit number later on renaming.
Thanks.
Saratxe
 
Posts: 4
Joined: Wed Jun 26, 2019 6:06 pm

Re: Tokens, renaming - I do not get it Thu Jun 27, 2019 10:26 am • by Mr_Noodle
Can you post screenshots of your rule? You can't upload files here directly so I suggest using a third party image hosting service, like Dropbox or imgur.com.
Mr_Noodle
Site Admin
 
Posts: 8425
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Tokens, renaming - I do not get it Thu Jun 27, 2019 2:51 pm • by Saratxe
This is the part of the PDF. Number is increasing, only the part (XX) is important for me "Nr. XX/1"
Image

Here I use a Token so far as I understand it... I tried different placeholders.

Image

But the result is wrong:

Image

I want that number from my Pdfs pasted into the renamed name of the PDF file.
Saratxe
 
Posts: 4
Joined: Wed Jun 26, 2019 6:06 pm

Re: Tokens, renaming - I do not get it Fri Jun 28, 2019 11:07 am • by Mr_Noodle
Try using Hazel's preview function and see what Hazel captures in the custom attribute. Also, I'm not sure if you want the Nr in the renamed file or not. If you don't, you want it outside of the custom attribute.
Mr_Noodle
Site Admin
 
Posts: 8425
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Tokens, renaming - I do not get it Fri Jun 28, 2019 12:18 pm • by Saratxe
Hazel capture it correctly. My question is, how can I use the recognized number to the renamed name?

E.g.: Inside the PDF is "NR. 23/1" so the renamed file should be renamed to "Kontoauszug 2019-23"; "Nr. 24/1" is recognized, the the name should be "Kontoauszug 2019-24" and so on.
Saratxe
 
Posts: 4
Joined: Wed Jun 26, 2019 6:06 pm

Re: Tokens, renaming - I do not get it Mon Jul 01, 2019 9:16 am • by Mr_Noodle
In that case, check the logs. Search for a specific file that isn't being named correctly and post the relevant excerpts.
Mr_Noodle
Site Admin
 
Posts: 8425
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Tokens, renaming - I do not get it Fri Jul 05, 2019 6:10 pm • by carpii
The Hazel tokens are useful for really basic operations, but for anything more complex I always end up resorting to a bash script

(easier to debug, run manually etc).

Have you considered doing that?
carpii
 
Posts: 7
Joined: Sun Sep 04, 2016 5:26 pm

Re: Tokens, renaming - I do not get it Sun Jul 07, 2019 4:14 pm • by Saratxe
I don't know how complex it would be to do my renaming wish with a bash script. I've used Automator before, but find Hazel more powerful and hoped that with its Tokens I could rename my PDFs with parts I found inside them. But I've really problems to understand how this is working. I didn't find examples/tutorials I could re-enact. Watched some YT-Videos, there it works perfect, but without explaining it. So I need a step-by-step instruction. :|
The dime has not fallen to me yet. :roll:
Saratxe
 
Posts: 4
Joined: Wed Jun 26, 2019 6:06 pm

Re: Tokens, renaming - I do not get it Mon Jul 08, 2019 11:17 am • by Mr_Noodle
Again, can you post the logs showing the rename operation?
Mr_Noodle
Site Admin
 
Posts: 8425
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support