Hi all,
Many thanks in advance for any help you can provide. I've built an automator app which takes a screenshot (screencapture), crops out 3 seperate images (imagemagick), runs gocr over those images to capture text, then sends that text via OSC to another device.
This is working fine. I want this program to loop every 3-5 seconds.. it takes around 1.5-2 seconds max to finish.
So, I looked around and found the below shell script online which allows me to
repeatedly run the program every 4 seconds (dt=4). This is working ok, but after I trigger that in a terminal shell - even if I shutdown terminal, the process is still executing and my 'crop_screen_caps.app' keeps running every 4 seconds.
This isn't a huge issue - but I'd rather a nicer way for me to start and stop the loop... or perhaps there is an easier way for me to trigger 'crop_screen_caps.app' every few seconds? In my pipedream, I'd be able to start and stop it from an icon on my menu bar... any hints?
Thanks for any suggestions you can provide in terms of a cleaner way to trigger my .app file every few seconds, and be able to stop it if I want to.
Best regards,
Hakon.
Many thanks in advance for any help you can provide. I've built an automator app which takes a screenshot (screencapture), crops out 3 seperate images (imagemagick), runs gocr over those images to capture text, then sends that text via OSC to another device.
This is working fine. I want this program to loop every 3-5 seconds.. it takes around 1.5-2 seconds max to finish.
So, I looked around and found the below shell script online which allows me to
repeatedly run the program every 4 seconds (dt=4). This is working ok, but after I trigger that in a terminal shell - even if I shutdown terminal, the process is still executing and my 'crop_screen_caps.app' keeps running every 4 seconds.
This isn't a huge issue - but I'd rather a nicer way for me to start and stop the loop... or perhaps there is an easier way for me to trigger 'crop_screen_caps.app' every few seconds? In my pipedream, I'd be able to start and stop it from an icon on my menu bar... any hints?
Code:
#! /usr/bin/env bash
dt=4
for (( i = 0 ; i < 10000 ; i++))
do
now=`date +%s`
left=`expr ${dt} - \( ${now} % ${dt} \)`
sleep $left
open "/Users/hakonandersson/Documents/Traktor automated screencaps/crop_screen_caps.app"
done
Thanks for any suggestions you can provide in terms of a cleaner way to trigger my .app file every few seconds, and be able to stop it if I want to.
Best regards,
Hakon.