Page 1 of 1

Using Automator

PostPosted: Thu Jun 02, 2016 3:39 pm
by Karl.Browning
Question: If I execute a "Run Automator Workflow" that has an AppleScript step, is there a way to return a token (result) to Hazel? If so, is it the same method as when "Run AppleScript"?

Thanks
Karl

Re: Using Automator

PostPosted: Thu Jun 02, 2016 5:16 pm
by Mr_Noodle
I don't think so though I'm not as familiar with using variables in Automator so maybe there's a way doing that. Is there a reason why you need to run the AppleScript from Automator instead of from Hazel directly?

Re: Using Automator

PostPosted: Thu Jun 02, 2016 5:39 pm
by Karl.Browning
Mr_Noodle wrote:I don't think so though I'm not as familiar with using variables in Automator so maybe there's a way doing that. Is there a reason why you need to run the AppleScript from Automator instead of from Hazel directly?



Mr. Noodle:
The only reason I am attempting to use Automator is because it has a function to "Extract PDF Text", which I am parsing with an AppleScript.

It is the AppleScript that has the code to develop the result to return to Hazel for use in naming a file. I had hoped to not have to write out the extracted file then read it again. I've looked at some other possibilities for text conversion but cannot find one as easy and cheap (free) as the one built into Automator.

You may well have some better techniques for what I am trying to accomplish: I want to extract the statement date from the PDF. I couldn't figure out how to find specific dates - they are in different places and in different formats in every document. The script I wrote (works nicely), sadly is not very generalized. It is likely to be higher maintenance than I would like. I must specify the line number in which the date resides and in some cases select which date in the line is the one I am looking for. This is all likely more than you wanted to know. I included it in the event you have seen some really brilliant way of solving the problem that I haven't yet seen.

So, in the interim, I am just trying to convert the PDF to text so that I can parse it. I planned to put the AppleScript in a subsequent Automator action prior to returning to Hazel. Perhaps I will just bite the bullet and write out the file so I can embed the AS in Hazel.

Thanks for your interest and thoughts.
Karl

Re: Using Automator

PostPosted: Thu Jun 02, 2016 5:50 pm
by Mr_Noodle
Take a look at the variable stuff in Automator as maybe there's a way to do it there. Alternatively, you can try putting stuff in the comments. Not the whole text, as there is a size limit, but other small pieces of data can be stored there then Hazel can parse stuff out of there.