Last active
April 3, 2018 17:48
-
-
Save sergiolopes/382e89c548bf6da47f5795760e17fd49 to your computer and use it in GitHub Desktop.
Retorna o tempo total em segundos de um arquivo do ScreenFlow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Retorna o tempo total em segundos de um arquivo do ScreenFlow | |
# | |
# Requisito: Dar permissão de acessibilidade pro Terminal ou outra App que vai executar | |
# (System Preferences > Security & Privacy > Privacy > Accessibility > Add Application) | |
file=$1 | |
if [ "$file" = "" ] || [ ! -d "$file" ]; then | |
echo Passe o nome do arquivo pra detectar a duração | |
exit 1 | |
fi | |
duration=$(osascript <<END | |
tell application "ScreenFlow" to open "$1" | |
tell application "System Events" to tell process "ScreenFlow" | |
repeat with el in UI elements of scroll area 1 of window 1 | |
if (value of el as text) starts with "Duration" then set temp to value of el | |
end repeat | |
end tell | |
get temp | |
END | |
) | |
mins=$(echo $duration | grep -o "[0-9]\+ mins" | sed -e 's/ mins//') | |
secs=$(echo $duration | grep -o "[0-9]\+ secs" | sed -e 's/ secs//') | |
echo $(( mins * 60 + secs )) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "ScreenFlow" to open "/tmp/Untitled.screenflow" | |
tell application "System Events" to tell process "ScreenFlow" | |
repeat with el in UI elements of scroll area 1 of window 1 | |
if (value of el as text) starts with "Duration" then set temp to value of el | |
end repeat | |
end tell | |
get temp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment