Article View: news.software.readers
Article #41560Re: [slrn] kill_subject_this_group macro
From: John E. Davis
Date: Wed, 17 Jun 1998 00:00
Date: Wed, 17 Jun 1998 00:00
75 lines
2696 bytes
2696 bytes
On 16 Jun 1998 21:28:22 GMT, Dirk Bernhardt <krid+usenet+@comnets.rwth-aachen.de>
wrote:
>I have a problem with a macro. I often kill a subject in a group (mostly
>threads I'm not intersted in). My macro goes as follows:
>
>define kill_subject_this_group ()
>{
> set_input_chars("s
t
");
> call ("create_score");
>}
>definekey ("kill_subject_this_group", "$", "article");
>
>The `^M's are actually one character (in vi, CTRL-V RET). This macro does
>not work as expected. Can you help me find the error? Thanks!
You have to distinguish between prompts that solicit a single
character and a prompt that is looking for string input. The
`create_score' function uses both types of prompts. In particular, it
does the following:
1. Prompts for a single character to get the header to score on, `s'
for subject, etc...
2. Prompts for a number representing the score. This is a string.
3. Prompts for a character that represents the scope of the score,
e.g., `t' for this newsgroup.
5. Prompts for an expiration date--- this is a string.
So, you want to use:
define kill_subject_this_group ()
{
set_input_chars ("s" % score on subject
+ "t" % this newsgroup
);
set_input_string("-9999\n" % score is -9999
+ "\n" % leave expiration time blank
);
call ("create_score");
}
Note that the `set_input_chars' function is used for the single
character responses, whereas the `set_input_string' function is used
for a multi-character prompt. Perhaps I should simplify this
interface by defining some function, e.g., set_input so that you could
do:
set_input ("s-9999\rt\r");
On the other hand, you may be able to use `ungetkey':
define kill_subject_this_group ()
{
variable s = "s-9999\rt\r";
variable i = strlen (s);
while (i)
{
i--;
ungetkey (s[i]);
}
call ("create_score");
}
Note that `ungetkey' works from the end of the string.
--John
Technical Details
Message-ID:
<slrn6oeg76.i4h.davis@mygir.davis.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mailReferences:
<6m6o1m$24a$1@umrk.comnets.rwth-aachen.de>Show Full Headers
Complete Article Headers
Message-ID: <slrn6oeg76.i4h.davis@mygir.davis.net> Subject: Re: [slrn] kill_subject_this_group macro Date: Wed, 17 Jun 1998 00:00:00 +0000 From: davis@space.mit.edu (John E. Davis) References: <6m6o1m$24a$1@umrk.comnets.rwth-aachen.de> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail X-Deja-AN: 363470930 Organization: Center for Space Research Newsgroups: news.software.readers