content keyword as a token for file name

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

Moderator: Mr_Noodle

content keyword as a token for file name Sun Oct 20, 2013 9:16 pm • by clayc
Hi

im using a demo version of hazel to see if it will be suitable for my filing. so far its seeming really good.

one question: im scanning and filing a lot of shares information. Rather than making rules for each share company, can i create a 'shares' rule that looks for each potential company name in the document and then if it finds one, it uses that name in the file name?

im successfully using date matching to put dates in file names so i have a rudimentary idea of using matched tokens in file names. i thought maybe a word token? some company names are more than one word though.

cant quite work out how to do this one, or would it just be easier to have a separate rule for each company name?

any words of advice appreciated. thanks
clayc
 
Posts: 6
Joined: Sun Oct 20, 2013 9:09 pm

Is there some context around the company name you can use? Like "Company: " followed by the actual company name?
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: content keyword as a token for file name Mon Oct 21, 2013 4:25 pm • by n8bocks
I am having a similar issue.

I would like to extract part of a string of characters contained within a PDF to use as the file name and file date. For example, the string of text contained in the file might be:

%%Smith, John and Mary - RVLTX 03-03-1997

I want to extract "Smith, John and Mary" to use as the file name and "03-03-1997" as the file date.

I have had great success with using contains match for dates, but no luck extracting text for the file name.

Here is what I have done so far:

If all of the following conditions are met

Contents contain match [a custom token named "account" with the following pattern]: %(anything)RVLTX
Contents contain match (date: 12-12-1999)

Do the following to the matched file or folder

Rename with pattern (account) [replace text "%" with "", replace text " - RVLTX" with '']
Move to folder....

I have not been able to get the rule to fire. Can anyone see what I am missing?
n8bocks
 
Posts: 1
Joined: Mon Oct 21, 2013 4:13 pm

Re: content keyword as a token for file name Mon Oct 21, 2013 8:23 pm • by clayc
hi mr noodle

no there isnt always something before the company name. i did look at trying to use the anything token which i read about on the forum.

im also having another similar issue with dates. Sometimes they are in long form eg 1 July 2013 and sometimes they are short eg 1/7/13. Ive been trying to get hazel to do a nested search for "any" by trying to match either long or short date and then use the date in the file but when i go to rename the file i have to use either short date or long date. is there a way to take either?

im thinking at this point it may be easier just to have multiple rules for each company or each date
clayc
 
Posts: 6
Joined: Sun Oct 20, 2013 9:09 pm

Re: content keyword as a token for file name Mon Oct 21, 2013 8:35 pm • by clayc
im just wondering, is there a way that hazel can understand the year, month and day if it matches either a long form date or short form date, and then have the ability to put that date in a file name?

eg

match 31 December 2013
or
match 31/12/13

then

rename file
year-month-day XXXXXX.pdf

i think the issue is that you have to select one pattern, either long form date or short form date. if you could just select the fields separately eg year, month or day when naming the file, those fields would be part of the larger patterns, which ever got matched.
clayc
 
Posts: 6
Joined: Sun Oct 20, 2013 9:09 pm

n8bocks: I think you should post your own topic as it's not quite the same. First thing you should do is use the rule preview to check things there.

clayc: You can try having a date token which only matches a month. For the parts of the date that aren't matched, it will fill in with the current date (i.e. it will use the year 2013). I think the better way to go is two conditions (with separate date tokens) to cover each case.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: content keyword as a token for file name Tue Oct 22, 2013 5:45 pm • by clayc
Hi mr noodle. I have tried that, having two separate contitions which works fine. Hazel will find either date format. What i cant work out is how to use either in the file name. At the moment i have to select between the date tokens used and only use one.
clayc
 
Posts: 6
Joined: Sun Oct 20, 2013 9:09 pm

Re: content keyword as a token for file name Wed Oct 23, 2013 10:58 am • by Mr_Noodle
You can add both. If it's an "any" condition for those two, only one will have its value filled and the other will be blank.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: content keyword as a token for file name Wed Oct 23, 2013 6:03 pm • by clayc
aahhh that's an interesting way of doing it! thanks for the advice, i will try that
clayc
 
Posts: 6
Joined: Sun Oct 20, 2013 9:09 pm


Return to Support

cron