Frequently, a 'telnet command' interface is simply a raw socket connection and you can just fire the command with rosstalk.sendMessage(HOST, PORT, MESSAGE);
If the device requires a username/password, you may be able to use rosstalk.sendMessage(HOST, PORT, 'USERNAME\r\nPASSWORD\r\nMESSAGE\r\n');
If you did want to use AppleScript, you'd need to run the DashBoard panel on your Mac. Here is an example panel that we have shared in the past for people trying to achieve this:
<abs contexttype="opengear" style="">
<meta>
<api>function runAppleScript(applescriptCommand)
{
var runtime = java.lang.Runtime.getRuntime();
var args = ["osascript", "-e", applescriptCommand];
var process = runtime.exec(args);
}
</api>
</meta>
<button buttontype="push" height="162" left="22" name="Run Apple Script (for iTunes)" top="21" width="304">
<task tasktype="ogscript">var applescriptCommand = "tell app \"iTunes\"\n" +
"activate\n" +
"set sound volume to 80\n" +
"set EQ enabled to true\n" +
"play\n" +
"end tell";
runAppleScript(applescriptCommand);
</task>
</button>
</abs>#DashBoard