Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

For reading a text file of hostnames into an AppleScript list, see Read textfile into list in ApplescriptRead textfile into list in Applescript.

For looping over hostnames within your AppleScript list see An AppleScript list iterate/loop example:

set myList to {"Hello", "Goodbye", "I must be going"}
repeat with theItem in myList
  say theItem
end repeat

do shell script

To avoid launching Terminal.app, use the do shell script command:

tell machine "eppc://<ip address of remote machine>"
    do shell script "system_profiler -detailLevel full > /tmp/sysprofile.txt"
end tell

This can be run without launching a supporting graphical application.

I am assuming you can not access the remote host via secure shell, only via Remote AppleEvent access eppc.

Returning the File

Read the contents of the file within your AppleScript's tell machine block and save it locally outside of the tell machine block.

Alternatively, have you considered transferring back the system profile file via ssh or scp? Consider having your AppleScript to connect to your Mac and copy back the collected system profile.

For reading a text file of hostnames into an AppleScript list, see Read textfile into list in Applescript.

For looping over hostnames within your AppleScript list see An AppleScript list iterate/loop example:

set myList to {"Hello", "Goodbye", "I must be going"}
repeat with theItem in myList
  say theItem
end repeat

do shell script

To avoid launching Terminal.app, use the do shell script command:

tell machine "eppc://<ip address of remote machine>"
    do shell script "system_profiler -detailLevel full > /tmp/sysprofile.txt"
end tell

This can be run without launching a supporting graphical application.

I am assuming you can not access the remote host via secure shell, only via Remote AppleEvent access eppc.

Returning the File

Read the contents of the file within your AppleScript's tell machine block and save it locally outside of the tell machine block.

Alternatively, have you considered transferring back the system profile file via ssh or scp? Consider having your AppleScript to connect to your Mac and copy back the collected system profile.

For reading a text file of hostnames into an AppleScript list, see Read textfile into list in Applescript.

For looping over hostnames within your AppleScript list see An AppleScript list iterate/loop example:

set myList to {"Hello", "Goodbye", "I must be going"}
repeat with theItem in myList
  say theItem
end repeat

do shell script

To avoid launching Terminal.app, use the do shell script command:

tell machine "eppc://<ip address of remote machine>"
    do shell script "system_profiler -detailLevel full > /tmp/sysprofile.txt"
end tell

This can be run without launching a supporting graphical application.

I am assuming you can not access the remote host via secure shell, only via Remote AppleEvent access eppc.

Returning the File

Read the contents of the file within your AppleScript's tell machine block and save it locally outside of the tell machine block.

Alternatively, have you considered transferring back the system profile file via ssh or scp? Consider having your AppleScript to connect to your Mac and copy back the collected system profile.

Source Link
Graham Miln
  • 45.8k
  • 8
  • 96
  • 128

For reading a text file of hostnames into an AppleScript list, see Read textfile into list in Applescript.

For looping over hostnames within your AppleScript list see An AppleScript list iterate/loop example:

set myList to {"Hello", "Goodbye", "I must be going"}
repeat with theItem in myList
  say theItem
end repeat

do shell script

To avoid launching Terminal.app, use the do shell script command:

tell machine "eppc://<ip address of remote machine>"
    do shell script "system_profiler -detailLevel full > /tmp/sysprofile.txt"
end tell

This can be run without launching a supporting graphical application.

I am assuming you can not access the remote host via secure shell, only via Remote AppleEvent access eppc.

Returning the File

Read the contents of the file within your AppleScript's tell machine block and save it locally outside of the tell machine block.

Alternatively, have you considered transferring back the system profile file via ssh or scp? Consider having your AppleScript to connect to your Mac and copy back the collected system profile.