Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.