Page 1 of 1
Replace text by a list

Posted:
Sun Jan 21, 2018 8:22 pm
by speedy_99
Hi,
is there a feature in Hazel to replace text by a list.
For example:
The customer id, that is found in the content of the file, will be replaced by the full name of the customer.
I found this feature at filejuggler 2 (windows software), called „Word Dictionary“.
I would be a great feature for Hazel, because is very easy to manage such a list with a lot of customers.
thx
speed
Re: Replace text by a list

Posted:
Mon Jan 22, 2018 10:01 am
by Mr_Noodle
It's something under consideration. You can use the "Replace text" function if you don't mind listing everything out there, as opposed to an external file.
Re: Replace text by a list

Posted:
Mon Jan 22, 2018 1:30 pm
by speedy_99
Thx for your response.
I am still using the "Replace text" function to do so.
But if I understand it correct, I have to create a new rule for every replacement couple ("customer id" / "full name of the customer")
customer id 10000 is Peter
customer id 10001 is Paul etc.
IF
token "customer id" is 10000
DO rename
token "customer id"--> "Replace text" is Peter
customer id 10001 is Paul etc.
Or is there a more intelligent way I could use?
To create a lot of rules takes more time, than editing a replacement list
10000 --> Peter
10001 --> Paul etc.
Sorry, my english is not the best.
Re: Replace text by a list

Posted:
Tue Jan 23, 2018 11:04 am
by Mr_Noodle
Where is customer id coming from? Can you just compare it to a range of numbers (greater than, less than)?
Re: Replace text by a list

Posted:
Tue Jan 23, 2018 1:25 pm
by speedy_99
the "customer id", in my case "patient id" could be part of e.g. an invoice or prescription etc..
So there are various types of documents, which differ only by the "customer id".
The "customer id" could be unique alphanumeric characters, it is not for calculations "(greater than, less than)"
first step:
Hazel checks the content of the pdf file and finds the "customer id". Compares it with the list. "10000" is found
--> 10000 is Peter Miller
--> 10001 is Paul Smith
second step:
Hazel checks the content of the pdf file and finds "invoice or prescription etc."
Hazel checks the content for "Date" etc.
Result:
2017-12-31+++Miller, Peter+++invoice+++2017-Dezember
2017-12-31+++Miller, Peter+++prescription
etc.
2017-12-31+++Smith, Paul+++invoice+++2017-Dezember
2017-12-31+++Smith, Paul+++prescription
etc.
The replacement list makes it easy to have one rule for many "customer ids"
Two or more lists would cover many combinations.
E .g. a second list with unique codes for products, medical codes for drugs etc.
code "abc" --> Aspirin
code "xyz" --> Xylit
Re: Replace text by a list

Posted:
Wed Jan 24, 2018 12:06 pm
by Mr_Noodle
If you have a custom attribute for the id, then you can do replace text on it and it should work. The only caveat is if the customer id is not in the list. Maybe in that case, if you can differentiate it from the ones that worked, you can have another rule set a color label on them for manual processing.
Re: Replace text by a list

Posted:
Wed Jan 24, 2018 5:53 pm
by speedy_99
Sorry,
it seems, there is a misunderstanding.
I am still using the "Replace text" function to do so.
But if I understand it correct, I have to create a new rule for every replacement couple
DO rename
token "customer id"--> "Replace text" is Peter
customer id 10001 is Paul etc.
and I use it by your way
If you have a custom attribute for the id, then you can do replace text on it and it should work. The only caveat is if the customer id is not in the list. Maybe in that case, if you can differentiate it from the ones that worked, you can have another rule set a color label on them for manual processing.
and it works well.
Instead of "set a color label", I use "date added --> is not in the last --> 5 minutes"
I only imagine that is much easier to edit one "replacement list", than to create one rule for every replacement couple.
thx
Re: Replace text by a list

Posted:
Thu Jan 25, 2018 11:50 am
by Mr_Noodle
You can create multiple replacements in the same rule. The text replacement UI allows you to create as many entries as you need.
Re: Replace text by a list

Posted:
Thu Jan 25, 2018 5:47 pm
by speedy_99
Aaaah,
now I understand.
thx
Re: Replace text by a list

Posted:
Tue Dec 08, 2020 4:17 pm
by speedy_99
speedy_99 wrote:Hi,
is there a feature in Hazel to replace text by a list.
Thx to realize my wish in hazel v5.
