mIRC Homepage
Posted By: ATMA gettok took me down - 11/12/03 10:53 PM
ok basicly i fixed the problem i was having but NOW im having a slightly diffrent problem

if there is a space any where in the file location this doesnt work what i have is:

$gettok($remove($read($mircdirmp3\mp3list.txt, %mp3.songnum), "), 1, 32)

can any one point me in the right direction so it will like find .mp3 part and then start removing again after that or something?
Posted By: RockHound Re: gettok took me down - 11/12/03 11:02 PM
$replace instead of $remove maybe
]
when i saw your post i did not quiet understand it and played with it a little $remove the _ and $replace the - with a space
Posted By: ATMA Re: gettok took me down - 11/12/03 11:07 PM
if i try to do a replace on space then it would come out as one big chunk of text and all i need is the files url _-_;
Posted By: RockHound Re: gettok took me down - 11/12/03 11:09 PM
did you use $chr(160) as a replacement?
Posted By: ATMA Re: gettok took me down - 11/12/03 11:13 PM
no i didnt even do the replace ~_~ i am just saying if i were to replace (Space) with (_ or -) then it would be a chunk of text =/
Posted By: RockHound Re: gettok took me down - 11/12/03 11:23 PM
Sorry im completely lost as to what your trying to do here.
Posted By: KingTomato Re: gettok took me down - 11/12/03 11:28 PM
Code:
alias demo {
  var %f = "C:\Path\To\Song\Song_-_title.mp3" Blah
  /echo -s 
  /echo -s Parsed: $songFromFile(%f)
  /echo -s Dir: $songFromFile(%f).Dir
  /echo -s File: $songFromFile(%f).File
  /echo -s Artist: $songFromFile(%f).Artist
  /echo -s Song: $songFromFile(%f).Song
  /echo -s 
}
alias songFromFile {
  if ($prop == dir) return $nofile($gettok($1-, 1, $asc(")))
  else if ($prop == file) return $nopath($gettok($1-, 1, $asc(")))
  else if ($prop == artist) return $gettok($nopath($gettok($1-, 1, $asc("))), 1, $asc(-))
  else if ($prop == song) return $gettok($gettok($nopath($gettok($1-, 1, $asc("))), 2, $asc(-)), 1, 46)
  else return $gettok($1-, 1, $asc("))
}
Posted By: ATMA Re: gettok took me down - 11/12/03 11:35 PM
ok ok here i get a line from a text file with this:

$read($mircdirmp3\mp3list.txt, %mp3.songnum)

k so far got me?! _-_;

now it will return a text of line that looks like this:
"C:\Anime\music\gunsmith_cats_-_hateshinai_toiki.mp3 Hateshinai Toiki" Unknown

k now let me break that down

"<location to mp3 and mp3file name> <song title>" <then this is the band name>

k get where i am going?

i think i might have to break the text down more like have it like this

"<dir to song> <filename> <song name>" <title>
Posted By: ATMA Re: gettok took me down - 11/12/03 11:41 PM
erm KT that didnt quiet help me if i have the title longer it doesnt work right
Posted By: Man Re: gettok took me down - 12/12/03 04:01 AM
Why didn't the two regular expession answers in the previous post not work?? They both work for me, Ill put the one not made by me (its slightl'y smaller) here.

Code:
alias mp3.play {  
  if ($dialog(topbar)) {
    if (!%mp3.songnum) { set %mp3.songnum 1 }
    var %songname $read($mircdirmp3\mp3list.txt, %songnum)
    if ($regex(file,%songname,/"(.+\.\w+)/)) {
      splay -p $+(",$regml(file,1),")
      startmp3
    }
    else echo -a Error Song not found in line %songnum
  }
}


Edit: Fixed so mIRC will play files with spaces correctly
Posted By: Man Re: gettok took me down - 12/12/03 04:21 AM
I'll explain what the regular expession here does, just incase you wanted to know.

Code:
$regex(file,%songname,/"(.+\.\w+)/)

Sets the name of 'file' to the regular expession so it can easily be called in a $regml later

Looks in the sting contained in the varible %songname

/"(.+\.\w+)/ This is the regular expression

the / at the start and end are used to set properties, but in this no properties are selected making the / and / useless

Then we have a ", this will look in the string for a "
The ( and ) marks what we want to be stored in the $regml.

After finding the the ", we want it to find anything, thats what the . does, we know SOMETHING is going to be after the " but we dont know what, and theres going to be more than 1 charector so we use a + to repeat the .

The \. states to look for the . charector (this will find the dot just before the mp3)

Then we look for any word charector with \w as many times as there are word charectors (a space isn't a word charector)

Hope this helps
Posted By: Man Re: gettok took me down - 12/12/03 05:00 AM
Sorry for the many replies, but the way you have set your file up makes it very difficult to make something work 100% of the time.

The example above WONT work if you have a . in the stuff after the filename to fix this use

Code:
/"([^\.]+\.\w+)/

as the regular expression instead

But doing this means you CANT have . in your filename, this shouldnt matter as I dont think mIRC will play a file with more than one . in it anyway.

PS: It would be ALOT easier if the filename was covered in " and if the song name needs it own give it its own, and dont put them in the one.

ie
"Filename" "Song Title" "Artist Name"

Then use the regular expression
Code:
/("[^"]+"|\w+)/g

In your $regml you can use $regml(file,N) where N the like your token.

In "This will allow spaces" Dont_need_spaces "Space here"

1 = "This will allow spaces"
2 = Dont_need_spaces
3 = "Space here"

For 2 and 3 you would want to remove the " $remove(text,")
but for 1 just pass it through with the " mIRC will understand the spaces better that way.
Posted By: jacksparrow2 atma i need a favor - 12/12/03 05:17 AM
i know you are the only one who knows mdx i need a add on
of status bar with mdx please helpme
Posted By: Iori Re: gettok took me down - 14/12/03 08:35 PM
Quote:
Edit: Fixed so mIRC will play files with spaces correctly

/splay C:\path to dir\song with spaces.ext <- works fine. wink
Posted By: Man Re: gettok took me down - 15/12/03 03:15 PM
Its always best to put the " in
© mIRC Discussion Forums