mIRC Home    About    Download    Register    News    Help

Print Thread
N
NoxiousPluK
NoxiousPluK
N
hi ladies smile
i got a question for ya, Multi-Plugin for iTunes exports the folowing code in a .txtfile smile
Code:
Playing
Sarah Brightman
Captain Nemo
Celtic Myst 2 (Disc 2)

Celtic

5:20
16
3
2
2
0
0

Now i want to make a mIRC script that reads from this file, using $read
But how-o-how can i set it up that way it not reads only the first line? and how do i split the file in variables then?
Thanks for reading, i hope you got an answer for meh smile

Joined: Aug 2004
Posts: 7,168
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,168
When using $read, you can specify which line you want to read by using $read(<filename>,<line_number>)
Using $read(<filename>) will read a random line from the file, not necessarily the first.
You can use $lines(<filename>) to return the total number of lines in the file.

Joined: Mar 2005
Posts: 420
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
If you want to read the whole file, you can use the /play command.

/help /play

Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
What exactly are you trying to do with that data? Display it as a "now playing" ad in a channel?

N
NoxiousPluK
NoxiousPluK
N
Quote:
What exactly are you trying to do with that data? Display it as a "now playing" ad in a channel?

exactly wink

N
NoxiousPluK
NoxiousPluK
N
Quote:
When using $read, you can specify which line you want to read by using $read(<filename>,<line_number>)
Using $read(<filename>) will read a random line from the file, not necessarily the first.
You can use $lines(<filename>) to return the total number of lines in the file.

i tried $read("C:\Program Files\iTunes\CurrentTrack.txt", 2)
and it gives no result :S
when i do:
$read("C:\Program Files\iTunes\CurrentTrack.txt", 1)
it says "P" and when i stop the song it says "S" (the first caracters of the first line, play or stop)
what am i doing wrong? blush

Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
Try this in status window:
//echo -s > $read("C:\Program Files\iTunes\CurrentTrack.txt",nt,2) <

If that works, then you're doing something else wrong. Don't know what since you don't post that part of the script.
If it doesn't, the file doesn't look likt the example you gave above. Try
//play -es "C:\Program Files\iTunes\CurrentTrack.txt" 20
or
/run notepad "C:\Program Files\iTunes\CurrentTrack.txt"
to see the actual contents of the file. Maybe you start reading the file before it's completely written?

N
NoxiousPluK
NoxiousPluK
N
this is so strange :|
notepad shows exact the good contents but when i try the echo line it gives as output only > <
with the play option it generates the folowing output:
Code:
* Playing 'CurrentTrack.txt' to Status Window with 20ms delay
-
P
-
* Playback of 'CurrentTrack.txt' complete
confused

Joined: Feb 2004
Posts: 2,013
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Feb 2004
Posts: 2,013
You can use COM to interact with iTunes, thus avoiding this entire issue, as you can use commands in mIRC to get this data from itunes.

I gave some code to retrieve info from iTunes and issue some commands to it in a thread on mircscripts.org here

Furthermore, a while ago, a friend of mine released a snippet which provides iTunes controls, which you can find here

To use either code, you need mIRC 6.16. Load it in your remotes, and you're good to go. Easy as pie.

N
NoxiousPluK
NoxiousPluK
N
tnx wink i gonna try that laugh
lets see if it works better for me grin


Link Copied to Clipboard