PDA

View Full Version : Print/Save Anandtech thread - improved method


Muse
08-01-2002, 10:43 AM
When you print a long thread on these forums don't you get sick of seeing everybody's signature's... again and again? Here's a function I wrote that deletes all that stuff. You need some version of FoxPro to do this (another dBase derivative would work, maybe with a tweak or two). What you do is click the printer icon - the right-most one at the top right of each post and you will get your printable version of the entire thread. Copy this to your clipboard and then run the FoxPro function I've pasted below. You will then have a version of the thread on your clipboard that doesn't have all those signature lines.

FUNCTION AT
* Cut the signature lines out of Anandtech formatted-for-printing threads
PRIVATE cbuild, cleft, n, ccurrent
n=1
cbuild=''
ccurrent=ALLTRIM(_CLIPTEXT)
ccurrent=SUBSTR(ccurrent,AT(CHR(13),ccurrent)+1) && Gets rid of the "Print this thread." preamble.
ccurrent=ALLTRIM(ccurrent)
DO WHILE SUBSTR(ccurrent,1,1)=CHR(13)
ccurrent=SUBSTR(ccurrent,2)
ENDDO
ccurrent=SUBSTR(ccurrent,1,AT(CHR(13),ccurrent)) + CHR(13) + SUBSTR(ccurrent,AT(CHR(13),ccurrent))
cleft=ccurrent
DO WHILE .T.
cbuild=cbuild + IIF(n>1, '- - - - - - - - - - - - - - - - - - - - - -','') + CHR(13) + ;
SUBSTR(cleft,1,AT('---------------',cleft)-1)
cleft=SUBSTR(cleft,AT('Date Posted',cleft,n))
IF !'Date Posted'$cleft
EXIT
ENDIF
n=n+1
ENDDO
cbuild=ALLTRIM(cbuild)+'- - - - - - - - - - - - - - - - - - - - - - - -';
+CHR(13)+' Original post end.'
cbuild=STRTRAN(cbuild,CHR(13)+CHR(13)+'Date Posted','- - - - - - - - - - - - - - - - - - - - - -'+CHR(13)+'Date Posted')
_CLIPTEXT=cbuild
RETURN

Muse
08-04-2002, 11:15 PM
Anybody tried this?

Muse
08-05-2002, 07:56 AM
This has a bug. I'll debug and post the code. If I can't fix it I'll delete...