使用applscript执行dig并启动远程桌面
我不知道 applescript,但我需要自动化执行以下步骤,看来 applsescript 是正确的选择。
1)运行终端命令“dig @123.4.5.678 computername.domain.net +short” 2)捕获返回的IP地址 3) 启动 Microsoft 远程桌面并传入捕获的 IP 地址。
这可能吗?我使用什么命令?有什么地方有好的教程吗?
I don't know applescript, but I need to automate the following steps, and it seems that applsescript is the way to go.
1) run the terminal command "dig @123.4.5.678 computername.domain.net +short"
2) Capture the returned IP address
3) Launch Microsoft remote desktop passing in the captured IP address.
Is this possible? what commands do i use? Is there a good tutorial somewhere?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要从Applescript运行shell脚本,您可以使用命令
do shell script“mycommand”,
其中mycommand是您正在执行的shell命令。
微软的远程桌面可能无法编写脚本。 (我不使用它,也不能说)但是您可以使用所谓的 GUI 脚本来编写其他应用程序的脚本。
然后,您可以有一个类似这样的脚本(注意未经测试)
GUI 脚本基本上告诉 RDC 将剪贴板粘贴到您的 IP 字段中。
有关 GUI 脚本编写的教程可以在这里找到:
http://www.macosxautomation.com/applescript /uiscripting/index.html
有很多通用的 Applescript 教程,例如:
http://homepage.mac.com/swain/Macinchem/Applescript/AppScript_tut/AppScrip_tut_1/appscript_tut_1.htm
To run a shell script from Applescript you use the command
do shell script "mycommand"
where mycommand is the shell command you are executing.
Microsoft's Remote Desktop is probably not scriptable. (I don't use it and can't say) However you can use what is called GUI scripting to script other applications.
You could then have a script somewhat like this (note untested)
The GUI scripting basically tells RDC to paste the clipboard into the field for your IP.
The tutorial on GUI scripting can be found here:
http://www.macosxautomation.com/applescript/uiscripting/index.html
There are lots of general Applescript tutorials such as here:
http://homepage.mac.com/swain/Macinchem/Applescript/AppScript_tut/AppScrip_tut_1/appscript_tut_1.htm