Page 1 of 1

Pattern Matching: First line of text file, unknown # words

PostPosted: Tue Mar 15, 2016 9:32 pm
by dorich
I want to use the first line of a text file as the new name of the file.
I have this working with one error.
At the moment I create a Custom Token and use Anywhere as the contents of the token to match the pattern. As I understand from an earlier discussion since this is specified as the first occurrence it will capture the first line up to the end, which it seems to do.
Then in the actions I have simply
"Rename" with pattern "Custom Token"
Note that in the renaming I'm not adding an extension to the file.

Results:
If the first line of the text file is Link Test
then the renaming process creates "Link Text/"

Don't know why that slash is being added but is there a way to remove it?

Re: Pattern Matching: First line of text file, unknown # wor

PostPosted: Wed Mar 16, 2016 10:53 am
by Mr_Noodle
Is there any punctuation at the end of that line (like ':')?

Re: Pattern Matching: First line of text file, unknown # wor

PostPosted: Wed Mar 16, 2016 11:51 am
by dorich
No punctuation.
It appears that the slash is the only addition.

Re: Pattern Matching: First line of text file, unknown # wor

PostPosted: Wed Mar 16, 2016 1:54 pm
by Mr_Noodle
Open the preview (the "eye" button). Select the file and click on its "i" button. At the bottom, it should show you the value of the custom attribute. Does the slash appear there?

Re: Pattern Matching: First line of text file, unknown # wor

PostPosted: Fri Mar 18, 2016 1:23 am
by dorich
Mr_Noodle wrote:Open the preview (the "eye" button). Select the file and click on its "i" button. At the bottom, it should show you the value of the custom attribute. Does the slash appear there?


Yes

Re: Pattern Matching: First line of text file, unknown # wor

PostPosted: Fri Mar 18, 2016 10:47 am
by Mr_Noodle
Maybe there is some invisible character at the end that is getting translated into a slash? If the file doesn't have any sensitive info in it, if you email it in, I can take a look to see if that's the case.

Re: Pattern Matching: First line of text file, unknown # wor

PostPosted: Mon Mar 21, 2016 12:34 pm
by dorich
Just to close off this thread for any readers:

We found that the export from OmniFocus was adding a colon. Since the colon is not an allowed character it was being changed to the "/".
I changed the rule to avoid the ":" and everything worked.