Dimitri Pantzos
Dimitri Pantzos

Reputation: 15

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

Here is what I have so far.

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

What i want to be able to do is have Apple Script ask me for a IP address to run, and I type in the IP Address and it will change the command to use that IP, and runs the command.

Upvotes: 0

Views: 181

Answers (1)

adayzdone
adayzdone

Reputation: 11238

If you are simply looking for how to use string interpolation in AppleScript... try:

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

Upvotes: 3

Related Questions