I would like to use Telnet to send/receive data to and from an ethernet device, as well as command which iTune song to play based on this data. Is this all possible from within a single apple script?
How do you loop in apple script? I’d like to have the script loop waiting for Telnet data from the device. When the new data arrives and it meets certain criteria, I’d like to execute the iTunes portion of the script and then wait again. This could go on for hours, would this be possible to do within the apple scripting environment?
Use telnet through
do shell script “telnet ”
To loop in AppleScript is to repeat.
set p to false
repeat until p = true
do shell script "telnet <whatever command>"
if result = "" then
<whatever you are going to do when you get the info>
set p to true
end if
end repeat
the
if result = “”
part is where you match the result of the telnet command with whatever you are looking for.
Hope this helps. If you have any questions, ask away.
Very cool, I will give this a try! I see a lot of posts regarding iTunes commands, so I can pick that part of the puzzle up myself. Great, thank you very much! I am sure I will be back on here as I progress down this road! Thanks again!
I know I might be thinking way outside of the box on this one, but I will ask anyways. Is it possible to send and receive data from an iphone 4 app, over a wireless network, into an iMac computer? I would like the iMac, which is running the script, to be able to send data to an iphone 4 app (hopefully one exists already, I am not iphone app creation friendly). I would like to select an image (from the iMac) and “push” it to the iphone 4 app, the iphone 4 operator would select an “Ok” button and this data is sent back to the iMac. Would something like this be remotely possible (no pun on remote)?
I thought I would be seeing some feedback on this, does this mean that this cannot be done?
Yes this can but there are sever layers where you can do this.
I’ve written my own server-client and peer to peer sockets which has to be developed in C. or one of it’s superset. You have to create your own protocol and is very much work.
Mostly I make use of XML-RPC. you can send and receive all kinds over contents but this runs on a web server. It’s easy but also the same lacks of the HTTP protocol.
Then there are of course to many other options to put down here to use.
Hello DJ,
I was hoping that there is already something developed that would allow this transfer of data between an iMac and an iphone 4 ? I searched the web for such an iphone app, but cannot locate one, does anyone else know of something that I could use to accomplish this? Basically, displaying a picture and an “Ok” button?