Wednesday, February 01, 2023

AppleScript to SSH

Create a file called ssh_server_name.scpt in a desired folder with the contents:

do shell script "open -a Terminal /bin/bash ~/Documents/server.sh"

To create an icon that you can click to run an AppleScript file. Here are the steps to do it:

  1. Save the AppleScript file with a .scpt extension to your desired location.
  2. Right-click on an empty area of your Desktop and select "New" > "Script".
  3. A new file with a .scpt extension will be created on your Desktop.
  4. Open the newly created file in the AppleScript Editor.
  5. Copy and paste the contents of your original AppleScript file into this new file.
  6. Save the new file.
  7. Right-click on the newly created file and select "Get Info".
  8. In the Info window, click on the icon in the top left corner.
  9. Press "Cmd + V" to paste the copied icon, or select a new icon from your computer.
  10. Close the Info window.
  11. Your new script file should now have the custom icon you selected.

Now you can double-click the icon on your Desktop to run the script.