I am running an Automator script to launch SFTP on my Mac when double-clicked. Here’s the script:

do shell script "sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist" with administrator privileges
tell app "Finder" to display alert "SFTP Opened and your IP address is"

The alert displayed is:

SFTP Opened and your IP address is

Screenshot of alert

As you can see, the alert message is incomplete because I don’t know how to retrieve the IP address of my system to pass through as a variable in the second line of my code. Any workaround? Please don’t suggest any external tools. And please don’t suggest using Automator’s System variable “IP address” with a separate “Ask for Confirmation” box because I want the IP to be displayed as a part of my existing message in the alert that I am already showing.

1 Answer 1


You can set a variable containing your IPv4, then append the contents of the variable to the contents of the alert message:

set ipaddress to IPv4 address of (get system info)
tell app "Finder" to display alert "SFTP opened and your IP address is " & ipaddress

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .