Help for automator action

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

Help for automator action Thu Nov 30, 2017 4:46 pm • by elpachato
Hello

I am using hazel to trigger an automator action each time pictures arrives into a folder

Until now i was using several folders and several hazel rules triggering several automator actions, each of them having the same purpose :

the automator action takes each image one by one, moves it to another folder, and from this folder opens it with a photoshop dropplet, and then looping until there are no pictures left with some delay between each to avoid that one picture would not be processed

this process also helps keeping track on the number of pictures processed because they are automatically printed at the end of the photoshop action and saved in a second folder

To be able to use the same process with several folders at the same time, i have added applescripts in hazel rules checking that no automator action is running and looping until the right time, this as prooved to be effecient with very low and acceptable rate of errors, but it implies giving a position of priority to the folders, each folder is related to one camera or memory card.

But now i want to modify the workflow for some reasons, rather than using folders to choose what dropplet will be used, i want to do it by filtering the pictures names, that way i will be able to let the pictures arrive in the same folder triggering only one automator action, and with in this action be able to tell which dropplet to open according the the camera picture name, this will allow me to choose on the go from the camera which size of print i want to do for exemple

I have thought to do it with hazel, but that ends to some problems i need to avoid : prevent simultaneous triggering of photoshop actions and priority to one camera are the main reasons

That is why i want to add the filtering into automator looping action that is taking items incrementally, this way the filtering would be just before opening the file in the dropplet without making any priority on the camera and will keep the arrival time

i tried to do "filter finder items -> open finder items -> filter finder items -> open finder items", but the problem is that the second filter is acting under the first filter (i suppose), but i need it to work as a "if or if" not a if->if, this way i could choose what dropplet will each picture be opened according to camera picture naming, but i don't know how to do that in automator and if it is possible because of the incremential part

I hope i have explained this well, sorry for my english if this is not clear, just ask me again, thanks in advance for your help

Also if anyone has a hazel rule to make hashtag sniffing from instagram, i am looking for that, thanks again
elpachato
 
Posts: 11
Joined: Tue Feb 16, 2016 12:47 pm

Re: Help for automator action Fri Dec 01, 2017 11:41 am • by Mr_Noodle
Can you provide more specific details and possibly screenshots? Note that you can't upload screenshots here so use a third party hosting service (or Dropbox if you have that).
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Help for automator action Mon Dec 04, 2017 10:49 am • by elpachato
Thanks for your answer

Taking screenshots is complicated because most of the actions i use are in french
but i will try do detail and translate as well as possible the automator action triggered by hazel :

1 - Get indicated finder items => folder(s) specified
2 - Get folder content
3 - Filter folder content => None of following conditions true : file extention is not jpg
4 - Dispense items incrementally
5 - Add date and time => actual time hr min sec before name
6 - Move finder items => folder specified

7 - Open finder items => photoshop dropplet specified
==> this is the step where i need to place condition if or if according to name content :
if file name contains CODE1 than open in photoshop dropplet CODE1
if file name contains CODE2 than open in photoshop dropplet CODE2
as simple as that because at most there will be third or fourth options but one of the ifs will always be true


8 - Pause => time specified according to photoshop dropplet execution
==> without this there would be lots of images not processed, because any dropplet launched while another is still in process won't be executed, this is also why i have trouble with hazel triggering these automator actions at the same time, because there is no way to make automator wait for dropplet to end, but i can specify to hazel rules to wait for automator not to be running, except that the way to do that is like someone knocking on the door from time to time, so the more the rules are numerous the more there is a risk some manage to get in at the same time

9 - Loop => number of loops specified - results as entry

That's it
Waiting for your ideas
Thanks

The alternative idea i have is that i could dispatch files to folders according to name content by hazel itself, but that would still require to make multiple folders trigger multiple actions and therefore that won't solve the risk of photoshop dropplets triggered at the same time, too bad that photoshop doesn't features some kind of queue for dropplets, that would be so more simple..

There is one possible complication with this solution though, because i have no idea how hazel does to move files from folders to folders, but if it uses automator runner in that process that would be an issue with my hazel rules that triggers my automator actions because they are made to always check that no automator action is already running, that would make a serious mess.
elpachato
 
Posts: 11
Joined: Tue Feb 16, 2016 12:47 pm

Re: Help for automator action Mon Dec 04, 2017 11:46 am • by Mr_Noodle
I'm a bit confused by this but is there a reason why you have Automator looping through the files instead of Hazel? Hazel should do that already which may simplify things.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Help for automator action Mon Dec 04, 2017 1:43 pm • by elpachato
Because I have multiple folders, each one with a rule able to trigger Automator action which will trigger photoshop dropplet processing images one by one allowing each to finish.

I am not sure to understand exactly what you mean, keeping all my automator actions but only removing the looping part ?
If I do the way you suggest, I get two issues :

First one is that I will have many more risks of errors, because hazel can launch multiple actions at the same time leading to droplet failing, the pause I put in automator is a more precise than the one in automator, because it is related to droplet launch, this is not true for hazel

Second one is also a consequence of that too, which means more dead times and be able to print less prints per hour, because randomly the rule doesn't match or doesn't respond immediatly for some reason, i don't know why, I can provide the rules if you want. But there won't be an answer to multiple launch anyway I guess.

Anyway, I am not an expert in all of this, but all my setup has proven to work great, I could not have succeed without hazel, but for me simplying is putting more into automator.

Hazel has been also very resourceful because i can limit the prints, i can switch on and off, have multiple and different setups ready to use at any time, watch automator process to avoid action launching simultaneously ( at least the more possible)

If I could use only hazel with it being able to monitor photoshop status that would be perfect, but is it possible ? At this moment, the looping with automator and hazel watch have been my best options..
elpachato
 
Posts: 11
Joined: Tue Feb 16, 2016 12:47 pm

Re: Help for automator action Tue Dec 05, 2017 11:57 am • by Mr_Noodle
There's a lot here to digest so can you just in one sentence tell me what exactly you are having problems with?
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Help for automator action Tue Dec 05, 2017 1:21 pm • by elpachato
What I need exactly :

In step 7 of my automator action

instead of

Open finder items => photoshop dropplet

I need to have this :
if file name contains CODE1 => open file in photoshop dropplet CODE1
If not, then
if file name contains CODE2 => open file in photoshop dropplet CODE2
elpachato
 
Posts: 11
Joined: Tue Feb 16, 2016 12:47 pm

Re: Help for automator action Tue Dec 05, 2017 8:51 pm • by elpachato
This is the applescript i tried to run in step 7 instead of "open finder items"

Code: Select all
tell application "Finder"
   get "filename"
   if "filename" contains "AAA" then
      tell application "Finder"
         open file using ":Users:ADMIN:Desktop:FOLDER:dropplet AAA.app"
      end tell
   else
      if "filename" contains "BBB" then
         tell application "Finder"
            open file using ":Users:ADMIN:Desktop:FOLDER:dropplet BBB.app"
         end tell
      else
         
      end if
   end if
end tell


not working, what is wrong ?
elpachato
 
Posts: 11
Joined: Tue Feb 16, 2016 12:47 pm

Re: Help for automator action Wed Dec 06, 2017 11:57 am • by Mr_Noodle
You script needs to use "theFile" as that is the file being processed and passed in to your script. Do not ask Finder for the file as that will just be whatever file you happen to have selected in Finder, I believe.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Help for automator action Wed Dec 06, 2017 12:38 pm • by elpachato
Ok so
Get "filename" of "thefile" on second line that's it ?
elpachato
 
Posts: 11
Joined: Tue Feb 16, 2016 12:47 pm

Re: Help for automator action Thu Dec 07, 2017 11:52 am • by Mr_Noodle
theFile is an alias. Search around on AppleScript sites as there should be code there to show you how to grab the filename out of it. The process should be something like converting the alias into a string and then getting its name.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Help for automator action Thu Dec 07, 2017 1:58 pm • by elpachato
Thanks for your help, I got the answer on another forum
elpachato
 
Posts: 11
Joined: Tue Feb 16, 2016 12:47 pm


Return to Open Discussion