使用AppleScirpt自动化登陆远程服务器

87 阅读1分钟
  • your_user_name:你的用户名
  • your_server_ip:你的服务器公网地址
  • your_password:你的密码
tell application "Terminal"
	activate
	if (count of windows) is 0 then
		do script "ssh {your_user_name}@{your_server_ip}"
	end if
	do script "ssh {your_user_name}@{your_server_ip}" in window 1
	delay 1
	tell application "System Events"
		keystroke "{your_password}"
		keystroke return
	end tell
end tell