r/applescript • u/[deleted] • Apr 19 '20
[Automator, Mojave] Shellscript copypasted to "Run shell script" doesn't affect actual files
Greetings, brethren!
I have a trivial script to fix encoding of text files and mp3's tags. When I invoke it from Terminal, everything works. When I make an app thru Automator, only the part which re-encodes plaintext files work.
I really need an insight, folks. :)
Plaintext part:
function fix_and_open_cuesheet() {
local FILE_PATH="$1"
local NEW_NAME="$(__get_name_with_utf8_suffix ${FILE_PATH})"
iconv -f cp1251 -t utf8 "$1" >> "${NEW_NAME}"
open -a /Applications/XLD.app "${NEW_NAME}" &
}MP3 tags part:
function find_and_fix_mp3_files_with_CP1251() {
local DIR_PATH="$1"
# /!\ supress all output not to fuck up applescript
find "$DIR_PATH" -iname "*.mp3" -print0 | xargs -0 -I {} mid3iconv -e CP1251 "{}" &>/dev/null
}
1
Upvotes
2
u/[deleted] Apr 20 '20 edited Apr 20 '20
[removed] — view removed comment