Jump to content

pal read from txt file


bizkit1
 Share

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

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
 Share

×
×
  • Create New...