A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows 7 » Windows 7 Forum
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Request help with 40tude dialog program syntax



 
 
Thread Tools Rate Thread Display Modes
  #1  
Old December 31st 16, 07:40 PM posted to news.software.readers,alt.windows7.general
Stijn De Jong
external usenet poster
 
Posts: 76
Default Request help with 40tude dialog program syntax

I'm not a programmer where I'm just trying to meld two different
onBeforeSendingMessage scripts found in the 40tude script repository
(http://dialog.datalist.org/scripts).

I can put the two scripts together, but I can't redefine the variable.
The variable seems to take one and only one value!

That is, I can easily give the variable any value, but I can't seem to
figure out the syntax to *redefine* that variable in an "if" statement.

This pseudocode tries to explain what I'm trying to accomplish:
if identity = id1 then
Remove_Headers='User-Agent: ,Message-ID: ';
else if identity = id2 then
Remove_Headers='User-Agent: ,Content-Transfer-Encoding: ';
else
Remove_Headers='User-Agent: ,Mime-Version: ';

To help you help me, I'll post the exact code I'm using, but at the risk of
confusing things (because the code is a few hundred lines long).

Essentially, all I'm trying to do is set the headers based on the identity.
Nothing more fancy than that.

I'm asking for syntax help because everything I try, by trial and error,
has caused an error, simply because I don't know how to redefine the
RemoveHeader variable syntactically.
Ads
  #2  
Old December 31st 16, 07:50 PM posted to news.software.readers,alt.windows7.general
Stijn De Jong
external usenet poster
 
Posts: 76
Default Request help with 40tude dialog program syntax

Op Sat, 31 Dec 2016 20:40:28 +0100, Stijn De Jong schreef:

To help you help me, I'll post the exact code I'm using, but at the risk of
confusing things (because the code is a few hundred lines long).


This is the code I am using which sets the identity.
http://dialog.datalist.org/scripts/C...gIdentity.html

This is the code I am using which removes the headers:
http://dialog.datalist.org/scripts/RemoveHeaders.html

All I'm trying to do is meld the two, where the outgoing headers to be
removed depend on the identity of the sender.
  #3  
Old December 31st 16, 08:00 PM posted to alt.windows7.general,news.software.readers
Rodney Pont[_5_]
external usenet poster
 
Posts: 95
Default Request help with 40tude dialog program syntax

On Sat, 31 Dec 2016 20:40:28 +0100, Stijn De Jong wrote:

This pseudocode tries to explain what I'm trying to accomplish:
if identity = id1 then
Remove_Headers='User-Agent: ,Message-ID: ';
else if identity = id2 then
Remove_Headers='User-Agent: ,Content-Transfer-Encoding: ';
else
Remove_Headers='User-Agent: ,Mime-Version: ';


Try;
if identity == id1 then
Remove_Headers='User-Agent: ,Message-ID: ';
else if identity == id2 then
Remove_Headers='User-Agent: ,Content-Transfer-Encoding: ';
else
Remove_Headers='User-Agent: ,Mime-Version: ';

= is an assignment operator, it makes the left side = to the right
side, you need the double = for a comparison.

I'm not familiar with the scripting you are using but that's worth
trying.

--
Faster, cheaper, quieter than HS2
and built in 5 years;
UKUltraspeed http://www.500kmh.com/


  #4  
Old December 31st 16, 08:01 PM posted to news.software.readers,alt.windows7.general
Stijn De Jong
external usenet poster
 
Posts: 76
Default Request help with 40tude dialog program syntax

Op Sat, 31 Dec 2016 20:50:46 +0100, Stijn De Jong schreef:

This is the code I am using which sets the identity.
http://dialog.datalist.org/scripts/C...gIdentity.html

This is the code I am using which removes the headers:
http://dialog.datalist.org/scripts/RemoveHeaders.html

All I'm trying to do is meld the two, where the outgoing headers to be
removed depend on the identity of the sender.


At the risk of confusing the issue, here is the current code that was used
to send this message, which has no syntax errors, and which sort of works
but which allows only a single static setting for the remove headers
variable.

All I'm trying to do is add the simple decision below:

if identity = id1 then
Remove_Headers='User-Agent: ,Message-ID: ';
else if identity = id2 then
Remove_Headers='User-Agent: ,Content-Transfer-Encoding: ';
else
Remove_Headers='User-Agent: ,Mime-Version: ';

------- cut here for the current working code --------
program OnBeforeSendingMessage;
RemoveFromEmails = true;
RemoveFromNews = true;

procedure RemoveHeaders ( Message : TStringlist;
IsEmail : boolean
);
var i : integer;
k : integer;
s : string;
CommaPos : integer;
DelHeader : TStringlist;
RemoveH : String;
begin
RemoveH := Remove_Headers;
i := 0;
if ((IsEmail=true) and (RemoveFromEmails=true)) or
((IsEmail=false) and (RemoveFromNews=true)) then begin
If ( RemoveH '' ) then begin
try
DelHeader := TStringlist.Create;
if ansipos ( ',', RemoveH) = 0 then begin
DelHeader.Add ( LowerCase ( TrimLeft( RemoveH )));
end // if
else begin
CommaPos := 0;
for k := 1 to length ( RemoveH ) do begin
If RemoveH[k] = ',' then begin
DelHeader.Add ( LowerCase ( TrimLeft (copy ( RemoveH,
CommaPos + 1, k - ( CommaPos + 1 )))));
CommaPos := k;
end; // if
if k = length ( RemoveH ) then
DelHeader.Add ( LowerCase ( TrimLeft (copy ( RemoveH,
CommaPos + 1, k - CommaPos ))));
end; // for
end; // else
s:=Message.text;
while (Message.Strings[i]'') do begin
k := 0;
while k = ( DelHeader.Count - 1 ) do begin
if pos( DelHeader[k], LowerCase ( Message.Strings[i] )) = 1
then begin
delete ( s, pos(DelHeader[k], LowerCase (s) ), length (
Message.Strings[i] ) + 2 );
i := i - 1;
k := DelHeader.Count - 1;
message.text := s;
end; // if
k := k + 1;
end; // while
i := i + 1;
end; //while
message.text:=s;
finally
DelHeader.Free;
end; // try - finally
end; // if
end; // if
end; // RemoveHeaders

function StrMatch(str: String; pattern: String):Boolean;
var
patternSize : Integer;
subStr : String;
compareRes : Integer;
begin
patternSize := Length(pattern);
subStr := Copy(str, 1, patternSize);
compareRes := CompareStr(pattern, subStr);
if (compareRes = 0) then
result := true
else
result := false;
end;

function From2Identity(from: String): String;
begin
if (StrMatch(from, 'First1 Last1 ')) then
result := 'id1'
else if (StrMatch(from, 'First2 Last2 ')) then
result := 'id2'
else
result := 'unknown';
end;

function NewsGroup2Identity(newsgroup: String): String;
begin
if (StrMatch(newsgroup, 'news.software.readers') or
StrMatch(newsgroup, 'alt.free.newsservers')) then
result := 'id1'
else
result := 'id2';
end;
// The server identity doesn't seem to play any role in the decision.
// So I'm not sure why this is needed (but it's required).
function Server2Identity(server: String): String;
begin
if (CompareStr(server, 'aioe') = 0) then
result := 'id1'
else
result := 'id2';
end;

function BadIdentity(): boolean;
begin
result := false;
end;

function CheckIdentity(var message: TStringlist; servername: string;
isEmail: boolean):boolean;
var
fromIdentity : String;
newsgroupIdentity : String;
serverIdentity : String;
i : Integer;
begin
if (not IsEmail) then
begin
for i := 0 to Message.Count - 1 do
begin
if (strMatch(Message[i], 'From:')) then
fromIdentity := Copy(Message[i], 7, Length(Message[i]) - 6);
if (strMatch(Message[i], 'Newsgroups:')) then
newsgroupIdentity := Copy(Message[i], 13, Length(Message[i]) - 12);
end;
fromIdentity := From2Identity(fromIdentity);
newsgroupIdentity := NewsGroup2Identity(newsgroupIdentity);
serverIdentity := Server2Identity(servername);
// The lines below write to the log file ./40tude/logs/20161231.log
WriteToLog(' fromIdentity = ' + fromIdentity, 7);
WriteToLog(' newsgroupIdentity = ' + newsgroupIdentity, 7);
WriteToLog(' serverIdentity = ' + serverIdentity, 7);
if ((CompareStr(fromIdentity, newsgroupIdentity) = 0) and
(CompareStr(newsgroupIdentity, serverIdentity) = 0)) then
result := true
else
result := BadIdentity();
end
else
result := true;
end;

function OnBeforeSendingMessage(var Message : TStringlist;
Servername : string;
IsEmail : boolean
):boolean;
begin
// Added the result line below:
result := CheckIdentity(message, servername, isEmail);
RemoveHeaders(Message,IsEmail);
result:=true;
end;
// ----------------------------------------------------------------------
begin
end.
------- cut here for the current working code --------
  #5  
Old December 31st 16, 08:11 PM posted to alt.windows7.general,news.software.readers
Rodney Pont[_5_]
external usenet poster
 
Posts: 95
Default Request help with 40tude dialog program syntax

On Sat, 31 Dec 2016 20:50:46 +0100, Stijn De Jong wrote:

This is the code I am using which sets the identity.
http://dialog.datalist.org/scripts/C...gIdentity.html

All I'm trying to do is meld the two, where the outgoing headers to be
removed depend on the identity of the sender.


I looked at the setting identity script so try
if (identity = id1) then
Remove_Headers := 'User-Agent: ,Message-ID: ';
else (if identity = id2) then
Remove_Headers := 'User-Agent: ,Content-Transfer-Encoding: ';
else
Remove_Headers := 'User-Agent: ,Mime-Version: ';


Your sample script has the comparison in brackets and used := as
assignment. It also appears to not use semicolon for line ending after
a then if there is an else following but does after the else.

Does id1 and id2 need to be in quotes, 'id1' 'id2'

--
Faster, cheaper, quieter than HS2
and built in 5 years;
UKUltraspeed http://www.500kmh.com/


  #6  
Old December 31st 16, 08:20 PM posted to alt.windows7.general,news.software.readers
Stijn De Jong
external usenet poster
 
Posts: 76
Default Request help with 40tude dialog program syntax

Op Sat, 31 Dec 2016 20:00:07 +0000 (GMT), Rodney Pont schreef:

Try;
if identity == id1 then
Remove_Headers='User-Agent: ,Message-ID: ';
else if identity == id2 then
Remove_Headers='User-Agent: ,Content-Transfer-Encoding: ';
else
Remove_Headers='User-Agent: ,Mime-Version: ';

= is an assignment operator, it makes the left side = to the right
side, you need the double = for a comparison.

I'm not familiar with the scripting you are using but that's worth
trying.


Thanks for that prompt help (which I realize came before I added the actual
scripts that I was melding).

I don't think the "if" sytax is my mental problem here (it may be a problem
later, but not just yet).

I think there is a "rule" that I don't understand which doesn't allow me to
redefine the Remove_Headers variable (or constant, as it seems to be).

For example, this works:
const
Remove_Headers='User-Agent: ,Message-ID: ';

But this fails:
https://i.imgsafe.org/811a9201c9.jpg

Just redefining the variable fails with a "duplicate identifier" error:
const
Remove_Headers='User-Agent: ,Message-ID: ';
Remove_Headers='User-Agent: ,Mime-Version: ';

This also fails with a "duplicte identifier" error:
const
Remove_Headers='User-Agent: ,Message-ID: ';
const
Remove_Headers='User-Agent: ,Mime-Version: ';

If I remove the "const", it complains of a different error, so, the const
is apparently required.
https://i.imgsafe.org/811aae6f99.jpg

All I'm asking, really, is how to re-define the variable "Remove_Headers".
  #7  
Old December 31st 16, 08:43 PM posted to alt.windows7.general,news.software.readers
Rodney Pont[_5_]
external usenet poster
 
Posts: 95
Default Request help with 40tude dialog program syntax

On Sat, 31 Dec 2016 21:20:09 +0100, Stijn De Jong wrote:

I think there is a "rule" that I don't understand which doesn't allow me to
redefine the Remove_Headers variable (or constant, as it seems to be).

For example, this works:
const
Remove_Headers='User-Agent: ,Message-ID: ';

But this fails:
https://i.imgsafe.org/811a9201c9.jpg

Just redefining the variable fails with a "duplicate identifier" error:
const
Remove_Headers='User-Agent: ,Message-ID: ';
Remove_Headers='User-Agent: ,Mime-Version: ';

This also fails with a "duplicte identifier" error:
const
Remove_Headers='User-Agent: ,Message-ID: ';
const
Remove_Headers='User-Agent: ,Mime-Version: ';

If I remove the "const", it complains of a different error, so, the const
is apparently required.
https://i.imgsafe.org/811aae6f99.jpg

All I'm asking, really, is how to re-define the variable "Remove_Headers".


For a start if you define it as a constant it's not a variable and
can't(shouldn't) be redefined. I don't recognise the syntax of this
scripting language so I'm guessing a bit(lot) :-)

It looks as if you define a string as

Remove_Headers : String
in the var section.

If you want to use that variable outside of a function don't define it
within a function call, you need to define it at the beginning of the
script so that it has global context. If it's defined within a function
call it only has context within that function and the value will not be
carried outside of it.

I can't tell you exactly what to do since I can't follow the code, I've
got CFS/ME and my short term memory isn't any good, I can follow a few
lines but no more, the earlier lines have just left me.

--
Faster, cheaper, quieter than HS2
and built in 5 years;
UKUltraspeed http://www.500kmh.com/


  #8  
Old December 31st 16, 08:45 PM posted to alt.windows7.general,news.software.readers
Stijn De Jong
external usenet poster
 
Posts: 76
Default Request help with 40tude dialog program syntax

Op Sat, 31 Dec 2016 20:11:30 +0000 (GMT), Rodney Pont schreef:

Does id1 and id2 need to be in quotes, 'id1' 'id2'


I do not know, but my plan was to define the Remove_Headers variable at the
time that the identity was determined, so that I wouldn't even need an if
statement at that very moment.

But when I do that, I get the error that the Remove_Headers is a duplicate!

This is the original that works without the Remove_Header variable:
https://i.imgsafe.org/817947489d.jpg

function From2Identity(from: String): String;
begin
if (StrMatch(from, 'Stijn De Jong ')) then
result := 'id1'
else if (StrMatch(from, 'First1 Last2 ')) then
result := 'id2'
else
result := 'unknown';
end;

This is the same as above, but with the Remove_Header inserted:
https://i.imgsafe.org/8182381b0a.jpg

function From2Identity(from: String): String;
begin
if (StrMatch(from, 'Stijn De Jong ')) then
result := 'id1'
Remove_Headers := 'User-Agent: ,Message-ID: ';
else if (StrMatch(from, 'First1 Last2 ')) then
result := 'id2'
Remove_Headers := 'User-Agent: ,Content-Transfer-Encoding: ';
else
result := 'unknown';
Remove_Headers := 'User-Agent: ,Mime-Version: ';
end;

What I can't mentally fathom yet is why I can't just re-define the variable
"Remove_Header" at any point whatsoever in the script.

That's really where I think I'm most stumbled.
  #9  
Old December 31st 16, 08:51 PM posted to alt.windows7.general,news.software.readers
Stijn De Jong
external usenet poster
 
Posts: 76
Default Request help with 40tude dialog program syntax

Op Sat, 31 Dec 2016 20:00:07 +0000 (GMT), Rodney Pont schreef:

Try;
if identity == id1 then
Remove_Headers='User-Agent: ,Message-ID: ';
else if identity == id2 then
Remove_Headers='User-Agent: ,Content-Transfer-Encoding: ';
else
Remove_Headers='User-Agent: ,Mime-Version: ';

= is an assignment operator, it makes the left side = to the right
side, you need the double = for a comparison.

I'm not familiar with the scripting you are using but that's worth
trying.


I'm not familiar with the scripting syntax either.
I don't understand why I can't redefine the variable "Remove_Headers".

Here's what happens when I use the suggested syntax above:
https://i.imgsafe.org/819a434db8.jpg

function From2Identity(from: String): String;
begin
if (StrMatch(from, 'Stijn De Jong ')) then
result := 'id1'
Remove_Headers='User-Agent: ,Message-ID: ';
else if (StrMatch(from, 'First2 Last2 ')) then
result := 'id2'
Remove_Headers='User-Agent: ,Content-Transfer-Encoding: ';
else
result := 'unknow';
Remove_Headers='User-Agent: ,Mime-Version: ';
end;
  #10  
Old December 31st 16, 09:08 PM posted to alt.windows7.general,news.software.readers
Stijn De Jong
external usenet poster
 
Posts: 76
Default Request help with 40tude dialog program syntax

Op Sat, 31 Dec 2016 20:43:21 +0000 (GMT), Rodney Pont schreef:

For a start if you define it as a constant it's not a variable and
can't(shouldn't) be redefined. I don't recognise the syntax of this
scripting language so I'm guessing a bit(lot) :-)


I understand.
The scripting language is foreign to me too.

Each of the scripts works alone, so all I was really trying to do was meld
them so that I could redefine the "thing" that is "Remove_Headers" based on
the identity which appears to be either "id1" or "id2" as shown in the log
file from my last post:
3 13411140: Sending message to alt.windows7.general,news.software.readers
(Started) [$00000F44]
3 13411140: Connecting to NNTP (SSL) news.mixmin.net:563 [$00000F44]
7 13413796: fromIdentity = id1
7 13413796: newsgroupIdentity = id2
7 13413796: serverIdentity = id2
3 13413781: Connected to NNTP news.mixmin.net:563 [$00000F44]
3 13413781: Posting message to NNTP server [$00000F44]
3 13414781: Posting sent successfully: Article received
; (Finished) [$00000F44]

It looks as if you define a string as

Remove_Headers : String
in the var section.


I don't see a "section" for variables, but I think I agree with you that at
some point we simply define the variable "Remove_Headers".

I've defined it in a variety of places in the script and if I only define
it once, it seems to work. But my whole point is to define it based on the
identity (either id1 or id2) which is where I get the errors.

If you want to use that variable outside of a function don't define it
within a function call, you need to define it at the beginning of the
script so that it has global context.


I can define the variable Remove_Headers almost anywhere, but I seem to
only be able to do that once. If I later redefine it inside of the
procedure that determines if it's id1 or id2 that is posting, then the
redefinition of Remove_Headers always fails with a duplicate identifier
error.

That's really my block that is stumbling me!

If it's defined within a function
call it only has context within that function and the value will not be
carried outside of it.


It works to define it in the first two lines of the script:
const
Remove_Headers='User-Agent: ,Message-ID: ';
// Remove_Headers='User-Agent: ,Content-Transfer-Encoding: ';
// Remove_Headers='User-Agent: ,Mime-Version: ';

That works just fine.
Of course, I manually have to uncomment whichever Remove_Header variable I
want to use to post with. But that works fine.

The only thing I'm trying to add is to automatically re-define the
Remove_Header based on the id1 or id2.

I must have the definition syntax wrong because it won't work whenever I
define Remove_Headers for a second time.

That's really, I think, my syntax block of stumbling.
  #11  
Old December 31st 16, 09:28 PM posted to alt.windows7.general,news.software.readers
Stijn De Jong
external usenet poster
 
Posts: 76
Default Request help with 40tude dialog program syntax

Op Sat, 31 Dec 2016 20:43:21 +0000 (GMT), Rodney Pont schreef:

I can't tell you exactly what to do since I can't follow the code, I've
got CFS/ME and my short term memory isn't any good, I can follow a few
lines but no more, the earlier lines have just left me.


I understand and you've given me more help than I deserve since I really
don't understand how to just redefine the variable "Remove_Headers".

Redefining a variable should be just about the simplest thing anyone can
do, so, the fact I can't do that is my major problem stumbling.

To give back and pay forward any help, and in case you, or anyone want to
install Dialog and test the scripts yourself, here is how you can do that.

1. Install version 2.0.15.1 from the "4d2b38.exe" installer.
(for our purposes, this version works fine)
(if you like, you can update to 2.0.15.41 Beta 38)
(but do not upgrade to 40tude Dialog Alpha .84)
2. Set up your news servers:
Dialog: Settings Servers,Identities,Signatures Newsservers New
(for example: nntp.aioe.net 119)
3. Set up your identity:
Dialog: Settings Servers,Identities,Signatures Identities New
(for example: FirstName LastName )
4. OPTIONAL: Subscribe and read and post to your desired newsgroups:
a. Click on the "All" tab
b. Put your cursor on the top newsgroup before searching!
c. Type "control+f" to bring up the find menu
d. Type the name of the desired newsgroup.
e. Select the newsgroup & right click & select "subscribe"

Once you get the hang of using Dialog as a Usenet client, then you can add
a script (any script will do).
1. Obtain the remove headers script:
http://dialog.datalist.org/scripts/RemoveHeaders.html
2. Obtain the check identity script:
http://dialog.datalist.org/scripts/C...gIdentity.html
3. Load either one of those two scripts into 40Tude Dialog:
Dialog: Settings Scripting Scripting Event Scripts
OnBeforeSendingMessage (copy & paste script here)
4. Compile the script to check for errors:
Scripting: Script Compile (look for "Successfully compiled")
5. Save the compiled script (it will force you to save anyway):
Scripting: File Save

At this point anyone would see exactly what I see.
  #12  
Old December 31st 16, 09:35 PM posted to alt.windows7.general,news.software.readers
Stijn De Jong
external usenet poster
 
Posts: 76
Default Request help with 40tude dialog program syntax

Op Sat, 31 Dec 2016 22:28:15 +0100, Stijn De Jong schreef:

To give back and pay forward any help, and in case you, or anyone want to
install Dialog and test the scripts yourself, here is how you can do that.


I realized a line was missing so I repeat with the URL for the installer!

To give back and pay forward any help, and in case you, or anyone want to
install Dialog and test the scripts yourself, here is how you can do that.

1. Install from http://dialog.datalist.org/downloads/download.html
(for our purposes version 2.0.15.1 works fine)
(if you like, you can update to 2.0.15.41 Beta 38)
(but do not upgrade to 40tude Dialog Alpha .84)

The update to 2.0.15.41 is purely optional but here is the process:
a. First install 40tude Dialog 2.0.15.1 from the exe installer.
b. Rename C:\Program Files\40tude Dialog\dialog.exe to anything else.
c. Extract the v41 "dialog.exe" to replace the original dialog.exe file.
d. Check versions: 40TudeDialog: Help About
If you do this update, you'll see: Version 2.0.15.41 (Beta 38
2. Set up your news servers:
Dialog: Settings Servers,Identities,Signatures Newsservers New
(for example: nntp.aioe.net 119)
3. Set up your identity:
Dialog: Settings Servers,Identities,Signatures Identities New
(for example: FirstName LastName )
4. OPTIONAL: Subscribe and read and post to your desired newsgroups:
a. Click on the "All" tab
b. Put your cursor on the top newsgroup before searching!
c. Type "control+f" to bring up the find menu
d. Type the name of the desired newsgroup.
e. Select the newsgroup & right click & select "subscribe"

Once you get the hang of using Dialog as a Usenet client, then you can add
a script (any script will do).
1. Obtain the remove headers script:
http://dialog.datalist.org/scripts/RemoveHeaders.html
2. Obtain the check identity script:
http://dialog.datalist.org/scripts/C...gIdentity.html
3. Load either one of those two scripts into 40Tude Dialog:
Dialog: Settings Scripting Scripting Event Scripts
OnBeforeSendingMessage (copy & paste script here)
4. Compile the script to check for errors:
Scripting: Script Compile (look for "Successfully compiled")
5. Save the compiled script (it will force you to save anyway):
Scripting: File Save

At this point anyone would see exactly what I see.
  #13  
Old December 31st 16, 09:35 PM posted to alt.windows7.general,news.software.readers
Rodney Pont[_5_]
external usenet poster
 
Posts: 95
Default Request help with 40tude dialog program syntax

On Sat, 31 Dec 2016 21:45:08 +0100, Stijn De Jong wrote:

This is the same as above, but with the Remove_Header inserted:
https://i.imgsafe.org/8182381b0a.jpg

function From2Identity(from: String): String;

var
Remove_Headers : String;

begin
if (StrMatch(from, 'Stijn De Jong ')) then
result := 'id1'
Remove_Headers := 'User-Agent: ,Message-ID: ';
else if (StrMatch(from, 'First1 Last2 ')) then
result := 'id2'
Remove_Headers := 'User-Agent: ,Content-Transfer-Encoding: ';
else
result := 'unknown';
Remove_Headers := 'User-Agent: ,Mime-Version: ';
end;


Try adding the var section as above. If that says it's a duplicate the
Remove_Headers has been defined elsewhere, likely as a const, so try to
find where and change it to a string.

--
Faster, cheaper, quieter than HS2
and built in 5 years;
UKUltraspeed http://www.500kmh.com/


  #14  
Old December 31st 16, 10:11 PM posted to news.software.readers,alt.windows7.general
VanguardLH[_2_]
external usenet poster
 
Posts: 10,881
Default Request help with 40tude dialog program syntax

Stijn De Jong wrote:

I'm not a programmer where I'm just trying to meld two different
onBeforeSendingMessage scripts found in the 40tude script repository
(http://dialog.datalist.org/scripts).

I can put the two scripts together, but I can't redefine the variable.
The variable seems to take one and only one value!

That is, I can easily give the variable any value, but I can't seem to
figure out the syntax to *redefine* that variable in an "if" statement.

This pseudocode tries to explain what I'm trying to accomplish:
if identity = id1 then
Remove_Headers='User-Agent: ,Message-ID: ';
else if identity = id2 then
Remove_Headers='User-Agent: ,Content-Transfer-Encoding: ';
else
Remove_Headers='User-Agent: ,Mime-Version: ';

To help you help me, I'll post the exact code I'm using, but at the risk of
confusing things (because the code is a few hundred lines long).

Essentially, all I'm trying to do is set the headers based on the identity.
Nothing more fancy than that.

I'm asking for syntax help because everything I try, by trial and error,
has caused an error, simply because I don't know how to redefine the
RemoveHeader variable syntactically.


Okay, I'll bite. Why do you have to remove Dialog's own generated
Message-ID header that you told it to add instead of just configuring
Dialog to not add the header in the first place (and have the server add
its own MID header)? I do NOT have Dialog add a MID header. I let the
server add the MID header. According to NNTP RFCs, the server will add
the MID header *if* the client did not already add one. I would prefer
servers discard any client-added MID header and always add the server's
own MID header but the RFCs say the client can do it. If you configure
Dialog to NOT add a MID header then there isn't one to remove.

Sorry, I've not bothered to lie about what NNTP client that I use or
keep it a secrete so I don't know how to configure Dialog to not add a
UA header. While I know you can use a macro (script) to iterate through
a received message to parse and modify it (which is how I get rid of
those worthless PGP "sigs" in the body of a message), I don't that you
could do the same line-by-line iteration through a document that has not
yet been sent by Dialog.

For more detailed info about how to write macros on events in Dialog,
and since you cross-posted to the news.software.readers newsgroup, you
might want to wait until Bernd Rose shows up. He knows the inner
workings of Dialog and better understands the internal structures and
variables known and used by Dialog. There is no documentation on the
environment in which the macros will run so too often a user has no clue
on how to code the script (which becomes a fragment in the main
program). If he doesn't respond, you might want to start a new thread,
like "Ping Bernd Rose - topic". Hopefully he still visits the
news.software.readers newsgroup.

For scripting in Dialog, you use ":=" to assign/test a value to/of a
variable, not "=". You should not attempt to "redefine that variable"
in an if-statement. While it is doable, like in C, it means you are
trying to alter the value on which you intent to test its value. In a
for-statement, yes, you do want to change the variable's value on each
iteration of the for-loop but you do not change its value when testing
the current value of the variable.

Sorry, but to me it looks like you are trying to avoid recognitions of
your nyshifting and your socks by making your header vary when using
different identities in Dialog. There's no reason to change all those
headers between different identities other than to alter your
fingerprint for each of your sock puppets.

  #15  
Old December 31st 16, 10:46 PM posted to news.software.readers,alt.windows7.general
Stijn De Jong
external usenet poster
 
Posts: 76
Default Request help with 40tude dialog program syntax

Op Sat, 31 Dec 2016 16:11:33 -0600, VanguardLH schreef:

Okay, I'll bite. Why do you have to remove Dialog's own generated
Message-ID header that you told it to add instead of just configuring
Dialog to not add the header in the first place (and have the server add
its own MID header)?


Your question makes complete sense since you didn't realize that those were
just simplified strings for the variable "Remove_Headers".

So it's my fault for saying that the value of the Remove_Headers will
change depending on the need - but the value of the Remove_Headers never
was the question.

So I just put arbitrary values for Remove_Header in the post because the
actual value of the "Remove_Headers" variable is not in the least relevant
to the stated problem.

But the fact you asked the question shows you are both thinking, and you
know that 40Tude allows the user to turn off dialog=-generated message ids,
so I appreciate your acumen.

I do NOT have Dialog add a MID header. I let the
server add the MID header.


I completely undersstand.
You can have the server set the date also.

These are dialog-related facts which are completely outside the problem set
though, which is that I'm having trouble with the syntax of setting the
Remove_Headers variable depending on the id of the outgoing sender.

If you configure
Dialog to NOT add a MID header then there isn't one to remove.

Yup. But that doesn't change the problem set in the least.


Sorry, I've not bothered to lie about what NNTP client that I use or
keep it a secrete so I don't know how to configure Dialog to not add a
UA header.


It's super easy to do that!

1. Load this script:
http://dialog.datalist.org/scripts/RemoveHeaders.html
2. Set this variable:
Remove_Headers='User-Agent: ';
3. Voila!
No user-agent header.

The problem never was removing the headers.
Nor was the problem figuring out who the sending id is:

The problem is the syntax for melding those two scripts together so that
the script can choose which headers to remove based on the sending id.

Specifically, I can't seem to set the Remove_Header to one thing in one
part of the script, and then change it to another thing in the line just
below the first.

That's weird.

We should be able to do something like this:
variable = 1
echo $variable ===== this should output "1"
variable = 2
echo $variable ===== this should output "2"

For whatever syntax reason, I can't re-define the "Remove_Headers".


For more detailed info about how to write macros on events in Dialog,
and since you cross-posted to the news.software.readers newsgroup, you
might want to wait until Bernd Rose shows up. He knows the inner
workings of Dialog and better understands the internal structures and
variables known and used by Dialog.


OK. I've had this problem for months, so I can wait for Bernd Rose to show
up.

For scripting in Dialog, you use ":=" to assign/test a value to/of a
variable, not "=". You should not attempt to "redefine that variable"
in an if-statement. While it is doable, like in C, it means you are
trying to alter the value on which you intent to test its value. In a
for-statement, yes, you do want to change the variable's value on each
iteration of the for-loop but you do not change its value when testing
the current value of the variable.


My main stumbling problem is why can't I just do this?

Remove_Headers='whatever';
Remove_Headers='something else';

 




Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off






All times are GMT +1. The time now is 01:24 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.