r/applescript • u/Coyote_Android • Jul 03 '24
Script gets stuck frequently
Hi!
I have created a seemingly simple script in script editor and saved it as an app. I need it as an app since I want it to show up in launchpad. Unfortunately, it gets stuck quite often for such a simple script. I can tell because when it is stuck the app symbol remains in dock with the small black dot below.
Any ideas how I could prevent the script from getting stuck?
The script just runs a shell script:
do shell script "'/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge' --profile-directory='Profile 7' 'www.example.com'"
View all comments
Show parent comment
1
u/airdrummer-0 Jul 03 '24
what happens when u run ur cmd in terminal? does it simply open edge & return, or does it wait for u to close edge?
i suspect the latter, so ur a/s is simply waiting for it to terminate; what u need to do is invoke edge in the background, terminating ur s/s with an ampersand:
"If a command is terminated by the control operator &, the shell executes the command in the background in a subshell. The shell does not wait for the command to finish, and the return status is 0. Commands separated by a ; are executed sequentially; the shell waits for each command to terminate in turn. The return status is the exit status of the last command executed."