繁体   English   中英

如何让Apple Script询问我要使用的IP,然后使用该IP运行命令

[英]How to have Apple Script ask me for IP to use and then runs the command with that IP

这是我到目前为止所拥有的。

tell application "Terminal"
    activate
    do script "nmap -oN scan.txt -p 3306 10.0.69.11"
end tell

我想要做的是让Apple Script询问我要运行的IP地址,然后键入IP地址,它将更改命令以使用该IP,并运行该命令。

如果您只是在寻找如何在AppleScript中使用字符串插值的方法,请尝试:

set userResponse to text returned of (display dialog "Enter IP" default answer "10.0.69.11")

tell application "Terminal"
    if not (exists window 1) then reopen
    activate
    do script "nmap -oN scan.txt -p 3306 " & userResponse & " ;" in window 1
end tell

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM