Hi
I have a script that reads lines of news from a txt file into a channel. As the headlines are financially related, often they have $ signs in them referring to money (obviously!), however, since the script uses several identifiers like $mid etc to return the text, the $ signs in the headline news are ignored, as are any numbers with it. eg '$20mln' is just returned as 'mln'.
I'm wondering if there's a way around this? Would appreciate any ideas!
Thanks alot!
yeah, since $read evalute identifiers and variable so identifiers that are not exist doesn't returns nothing that's why u think it's ignored (it returned NULL)
so there is ,n, switch that return it as plain text, like:
$read(file.txt,n,LINE)
Use $chr(36) $+ min
A full list of ASCII characters can be found at
http://helpdesk.zaz.net/documents/ASCIITable.php
thanks - since not every headline contains a $, would I have to make an 'if' line?
Here is my code - by the way, I'm new to this so I know it's a little messy - have tried combing this into one line but no luck yet!
/cbs2 {
set %cbs $read(c:\CitiNews\news\cbs.txt,w,*[14]*)
set %cbs2 $remove(%cbs,[14],[15])
set %cbs3 $left(%cbs2,7)
set %cbs4 $mid(%cbs2,17)
{
/msg #NewsRoom 4»7 %cbs4 %cbs3 ET
}
unset %cbs
}
Did you try Scatmans suggestion?
cbs2 {
var %cbs = $remove($read(c:\CitiNews\news\cbs.txt,[color:crimson]n[/color]w,*[14]*),[14],[15])
msg #NewsRoom 4»7 $mid(%cbs,17) $left(%cbs,7) ET
}
great - it's working perfectly now - thanks guys! much appreciated! =)
...one more thing (if I'm not pushing my luck!) - is there also a way to make it so if the line of text has not changed since last time it checked, for it not to msg the channel?
I did have a line that was supposed to do this, but it dosn't work...
thanks again in advance!
You could set a global variable to the result of the read, then check if it has changed.
cbs2 {
var %cbs = $remove($read(c:\CitiNews\news\cbs.txt,nw,*[14]*),[14],[15])
if %cbs2.last != %cbs {
set %cbs2.last %cbs
msg #NewsRoom 4»7 $mid(%cbs,17) $left(%cbs,7) ET
}
}
thank you again Nimue - working beautifully!