frankjonen

macOS App Instancer

Dec 6th, 2021
1,179
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # A little macOS shell script for when you need
  2. # to have multiple instances of an app open.
  3.  
  4. # CAVEATS: Instancing on macOS will break
  5. #            - autosave behaviour if the app is built around .plists
  6. #            - cloud sync (if the app does that)
  7. #            - window status doesn't get saved (only for the last instance you quit)
  8.  
  9. # Usage
  10. #       Run the script and follow the on-screen instructions.
  11. #       Basically you type in the name of the app, hit enter
  12. #       and type in the number of instances you want.
  13.  
  14.  
  15.  
  16. #! /bin/bash
  17.  
  18. echo
  19. echo "$(tput setaf 7;tput bold)          Instance Application $(tput setaf 1)"
  20. echo
  21. read -p "     Enter App Name: $(tput sgr0)" "app_name"
  22. echo -n "$(tput setaf 1;tput bold)"
  23. read -p "     How many times? $(tput sgr0)" inst_count
  24. echo
  25. echo -n "          "
  26. echo "$(tput setaf 7;tput bold)$app_name$(tput sgr0) is$(tput setaf 1;tput bold) GO! $(tput sgr0)"
  27. echo
  28.  
  29. for (( c=1; c<=$inst_count; c++ ))
  30. do
  31.   open -n -a "$app_name"
  32. done
  33.  
  34. exit
  35.  
RAW Paste Data