BTM to check for new forum posts

#1
I came up with this (below) which seems to work pretty well. FROMTO.EXE is my own creation to extract parts of a file between arg1 and arg2. It leaves stull that doesn't change when there are no new posts. Since the EGREP gets rid of ampersands (which really screw up processing the file with internal commands) you could probably do this without FROMTO. NOTAGS is in 4UTILS; EGREP and CMP are externals.
Code:
cdd %temp
iff exist jpcheck.new then
  copy /q jpcheck.new jpcheck.old
  del /q jpcheck.new
endiff

type "http://jpsoft.com/forums" | notags | egrep -v "&|RSS|Sub-Forums" | fromto Latest Buy > jpcheck.new

if %@exec[cmp jpcheck.new jpcheck.old > NUL] NE 0 (http://jpsoft.com/forums) else (echo No!)
cdd-
 
#3
I see the above has some externals. Might be nice to post links to where one can get copies..
EGREP is in most UNIX packages, notably, UnxUtils from SourceForge.
NOTAGS is in my 4UTILS plugin.
FROMTO is a rather hastily put together utility that only works in a pipe (IIRC). Syntax "| fromto text text" (quote text with whitespace). I put a copy on ftp://lucky.syr.edu
 
#4
Is my understanding below of the program correct?
1/ notags removes html tags
2/ egrep removes lines containing any of the strings listed
3/ fromto drops lines before "Latest" and those after "Buy"
4/ the remaining lines form the .new file, which is compared with the previous version, .old, to determine if there are any changes

Would it not be simpler to
1/ pushd %temp / popd
2/ ersae the .old and just rename the .new to .old?
3/ use %@compare[jpcheck.new jpcheck.old] instead of the %@exec[...]
4/ using in-process pipes - avoid starting 4 additional TCC instances
 
#5
1. Yes, everything between <>s.
2. Yes.
3. (IIRC) FROMTO drops all characters before the first occurrence of string1 and all characters following the first subsequent occurrence of string2.
4. Yes.
1. Never got into the habit of PUSHD/POPD. CDD and CDD - have always been enough.
2. Erase and rename vs copy and delete? (6 = 1/2 dozen.) In fact since I allow clobbering, the copy would be good enough.
3. Didn't think of that.
4. I know nothing of in-process pipes. I'll look into it.
 
#6
3. (IIRC) FROMTO drops all characters before the first occurrence of string1 and all characters following the first subsequent occurrence of string2.
Ah! Characters, not lines.
2. Erase and rename vs copy and delete? (6 = 1/2 dozen.) In fact since I allow clobbering, the copy would be good enough.
I don't allow clobbering; too many "quick and dirty" actions overwrote important files. You cannot depend on what others do, either. But if you allow clobbering, move could do both steps in a single command.
4. I know nothing of in-process pipes. I'll look into it.
It's like the pipes had been in 4DOS - hidden temporary files. The time to start all the extra TCC instances (esp. with large alias and function tables) is likely to be much more than the saving from doing several things concurrently, esp. if running on a single processor system, which would need to perform context switching between pipes.
 
#7
I tried the in-process pipes and they are a tad slower (~10% of ~1.25 sec). Alas!, by the time I might need their advantages I'll probably have forgotten about them.