Hello MacScripters,
thank you very much for this helpful and patient community.
Could you please help me out ? Thank you very very much !!
I want to copy the IP Address to the clipboard,
and then show it in an AppleScript Studio Text Field named “IP”.
This is my Shell script I am referring to:
#!/bin/sh
ifconfig | grep "inet " | grep -vn 127.0.0.1 | cut -c9-21 | head -1 | pbcopy
This is my AppleScript:
property foo : "foo"
on clicked
do shell script "/Applications/Utilities/USE.app/Contents/Resources/USE.app/Contents/Resources/copyIP.sh"
set foo to the clipboard
tell window "Interface"
set contents of text field "IP" to foo as string
end tell
end clicked
Everthing works fine except that the Text copied
to the clipboard is two lines long, with one line
containing the address and the other containing
nothing. I suppose it has to do with unix line
endings but I am not sure.
But therefore also the Text Field “IP” does not
contain the one preferred line, but two.