copy your current ip address to the clipboard

Posted by in mac, salesforce

Salesforce Security Controls

if you’ve worked in several different instances of from several different locations, surely you’ve run into roadblocks on Security Boulevard (and yes, I know you can use a security token, but many times I’m using a client’s license and he/she will “inadvertently” reset the token and lock me out of the org).

when in a new location, I used to copy my external ip from well, if you’re using os x, you can leverage Applescript to make this a bit less painful.

set response to do shell script "/usr/bin/curl"
set ip_address to extract_ip(response)

set the Reply to display dialog "Your IP address is: " & ip_address
set the clipboard to ip_address

-- Function to extract ip from HTML returned by 
on extract_ip(this_text)
	set clean_ip to ""
	set this_char to ""
	repeat with this_char in this_text
		set this_char to the contents of this_char
		if the this_char is in {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "."} then
			set the clean_ip to the clean_ip & this_char as string
		end if
	end repeat
	return the clean_ip
end extract_ip

-- end script


if you’re using Butler, you can run this applescript with a hot key. so, whenever I need my external ip, I simply hold command + shift + i and my ip address is copied to my clipboard for handy paste into the trusted ip ranges.