Jump to content

pal read from txt file


bizkit1

Recommended Posts

Hello guys. I`m having trouble reading with sam braoadcaster from a txt file. I have a pal script that reads a txt file generated by another software. The file contains "now playing" data. The problem is that the other software ads a blank line after the one containing the data and whenever i try to read a certain word from that file it also reads the blank line. I want to know if pal knows how to read only from the first line of the txt file or maybe trim the line so that the output will only be that word and no spaces or blank lines. Here is my code

 

var S: String;
S := FileToStr('C:\gen.txt');
Song := ActivePlayer.GetSongInfo;


if S = 'pub'  then \\ here is the problem, when there is the pub word its actually pub and after a blank line
begin
Cat['jing'].QueueTop(smRandom, NoRules);
ActivePlayer.FadeToNext;
end;
PAL.UnLockExecution;

 

Thanks!

Link to comment
Share on other sites

Here you go, this should work.

 

var filename, S: String;

filename := 'C:\gen.txt';
Song := ActivePlayer.GetSongInfo;

S := Trim( LoadStringFromFile ( filename) );
  if S = 'pub'  then  \\ here is the problem, when there is the pub word its actually pub and  after a blank line
   begin
    Cat['jing'].QueueTop(smRandom, NoRules);
    ActivePlayer.FadeToNext;
   end;
PAL.UnLockExecution;

Spacial SVS Support Team

http://support.spacialaudio.com/forums/

Get help with PAL Scripts at http://www.palscripts.com

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...