1
votes

I've set up this script:

#!/bin/bash
/Applications/NameChanger.app/Contents/MacOS/NameChanger "$@"
osascript -e "delay 1" -e "tell application \"NameChanger\" to activate"

I'm using it to pass file names to NameChanager. Without the second line it loads NameChanger unfocused. I thought I should use a delay and then activate with applescript to get it focused.

Unfortunately the script is "waiting" for NameChanger to run and then to exit before executing the applescript bit. How can I change that?

2

2 Answers

3
votes

Alternatively you can use the open command to launch NameChanger. This should also automatically bring NameChanger to the foreground:

#!/bin/bash
open /Applications/NameChanger.app --args "$@"
2
votes

Append a & at the end of commands in a shell script that you want to run in the background.

/Applications/NameChanger.app/Contents/MacOS/NameChanger "$@" &