Sign in to follow this  
Followers 0
roboz

iTunes, TCP and AutoIt

3 posts in this topic

#1 ·  Posted (edited)

Hi,

I've developed a script a few months ago that shows you which track is currently playing on the iTunes computer at my office. A host script is running on the iTunes computer which writes the track info into a text file everytime the track changes (I'm using the COM interface for that). Now the client script on the other computers checks if the timestamp of the text file on the iTunes pc has changed. If that's the case it reads the info from the file and displays it. Previsously I used a third party iTunes plugin that writes the track info into the registry and then my script puts this info into the text file. It was working fine like that for the last few month but now that I've discovered the COM interface I've changed that part as mentioned above. The only problem is that whenever I change the track in iTunes now it freezes for a few seconds. This only happens when a client is running. I guess it has something to do with the fact that host and server script are trying to access the text file at the same time. I know it's probably not the most elegant solution anyway, so I thought that it might be possible to the same thing with the TCP functions in AutoIt.

I just had a look at the TCP server/client sample scripts to get an understanding how things work. I'm still a beginner when it comes to programming so my question is if something like the scenario above would be possible with iTunes. In theory I thought it could work like that: The host IP is saved in the client's ini file. Every x seconds client connects to host to receive the latest trackinfo. Is that possible? What if there are, let's say, 5 clients trying to connect to the host at the same time? As I said, I haven't done any TCP stuff in AutoIt and just wanted to check first if something like that is possible in theory.

I hope all of the above makes sense :)

Thanks!

Edited by roboz

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You can use TCPListen, and just set the socket indentifiers into an array, and then use TCPSend() and use the array (For...Next Loop) to send the same information to each client.

Larry has a chat program that might have some of the stuff you're looking for, take a peek in the Scripts and Scraps forum for it, I'm sure it would give you a good head start :evil:

Edit: found it :)

Edited by MSLx Fanboy

Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Thanks for pointing me in the right direction. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0