🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
8 messages
8 total messages Started by VanguardLH Sat, 05 Apr 2008 00:44
40tude Dialog: Sorting on watched flag. Need help with script.
#218543
Author: VanguardLH
Date: Sat, 05 Apr 2008 00:44
98 lines
6124 bytes
The sort parameters for the message list do not include flags, like the
watch flag.  So I figured to up the score of a message when the watched
flag was set on it.

No, I do not want to use a "!watched <criteria> <parm>" line in the
scroing rules.  That marks a message as watched if the criteria is met.
That is the wrong way around.  I don't want to watch all messages, for
example, that I post.  Instead I want to decide which threads to watch
(I have Dialog configured to not just flag on a subthread but instead on
the whole thread).  I want to set a score for the message based on
whether or not *I* set watch flag.  Since I can sort on the message's
score value, I want to assign a high score to any thread where I
*choose* to watch it.  If I clear the watch flag, the score should be
low or zero to get it out of the top of the sorted list (i.e., it isn't
being watched anymore).

40tude Dialog has scripting to perform some user-defined functions.
However, it does not provide attributes or methods to the current
selected object.  So, for example, I can't merely use something in a
custom script like:

if AEnabled('Watch') then 
    <objectname>.score := 9999"
else
    <objectname>.score := 0;

So I had to find another way.  When I right-click on a message, there is
a context-menu entry for the message's properties which includes
changing its scoring value.  So I can manually change the score for a
message but this would be a real pain.  I'd have to add the watch flag
and then have to wade through the menus and dialog to up the score for
that message.  However, because there is a dialog that lets me change
the message's score value, I figured that I could use the PostKey()
function in a custom script for a toolbar button.  Several examples at
http://dialog.datalist.org/scripts/script_library.html show using the
ADo() function to open a dialog window and then using PostKey() to enter
the keystrokes that I would otherwise have to enter manually.  So I
wrote the following script (but it doesn't work correctly):


Program WatchedwithHighScore;

Begin
   lockdisplay;             
   ADo('Watch');
   ADo('MessageProperties');
   PostKey(77,false,true,false,false,false,false,false,false);
   PostKey(9,false,false,false,false,false,false,false,false);
   if ( AEnabled('Watch') ) then  
      begin
         PostKey(57,false,false,false,false,false,false,false,false); 
         PostKey(57,false,false,false,false,false,false,false,false);
         PostKey(57,false,false,false,false,false,false,false,false);
         PostKey(57,false,false,false,false,false,false,false,false);
      end
   else
         PostKey(48,false,false,false,false,false,false,false,false);
   PostKey(79,false,true,false,false,false,false,false,false);
   unlockdisplay;
end.

What it does (or what I expected it to do was):
- Lock the painting (refresh) of the windows to eliminate flicker and
possibly timing problems.
- Toggles the watch flag (on or off).
- Opens the 'MessageProperties' dialog (where I can change the score).
- 77 is the keycode for Alt+m which should select and enable "Set
message score" checkbox.
- 9 is the Tab key to move the cursor into the value field.
- If the watch flag is enabled, 9999 is entered for the score value
(each 57 is the keycode for the "9" character); else, 0 is entered (the
48 keycode).
- 79 is the keycode for "O" (oh) and the 2nd 'true' parameter is for the
Alt key, so Alt+O is used to click the OK button to close the dialog
window.
- The display is unlocked to show the changes.

It seems like this should work.  However, what happens is that the
message properties window appears like it does not get focus for the
keystrokes.  The watch flag gets toggled as expected, the
MessageProperties window appears, but nothing gets changed inside the
window.  The window gets close but then the "Online" menu goes active
(because the window is close so the Alt+O gets seen by the main window's
menubar).

I've looked at several other scripts that used the PostKey() function to
issue keystrokes to whatever is the current focused window.  The other
scripts just used ADo() to open the dialog and that dialog supposedly
got focus so the keystrokes would apply to it.

The script would probably work and give me a toolbar button for the
script where I could mark a message as watched and get it sorted to the
top of the message list with a high score assigned to it - *if*
PostKey() worked to manipulate the controls in the MessageProperties
dialog.  I didn't see a function that I could use to force focus to that
window.  I tried not locking/unlocking the display (just in case that
also locked out the properties window that pops up) during the flag and
score changes but that didn't help.
Re: 40tude Dialog: Sorting on watched flag. Need help with script.
#218564
Author: Enrico Bauer
Date: Sat, 05 Apr 2008 05:51
19 lines
2036 bytes
05.04.2008 02:44:54 Uhr, *VanguardLH*:
> I want to set a score for the message based on whether or not *I* set
> watch flag.  Since I can sort on the message's score value, I want to
> assign a high score to any thread where I *choose* to watch it.  If I
> clear the watch flag, the score should be low or zero to get it out
> of the top of the sorted list (i.e., it isn't being watched anymore).

You should consider to give the attempt in
http://dialog.datalist.org/faq/frequently_asked_questions.html#Q:_How_can_I_change_the_default_Plonk.21_action.3F
a try.

If you assign some hotkeys to the new default plonk rules it should work
for you.

HTH
Enrico 
-- 
No fear. No distractions. The ability to let that
which does not matter truly slide.
Re: 40tude Dialog: Sorting on watched flag. Need help with script.
#218566
Author: VanguardLH
Date: Sat, 05 Apr 2008 06:38
50 lines
4098 bytes
"Enrico Bauer" wrote in message 
news:050408.075139.nsr.66@ID-5349.user.uni-berlin.de...
> VanguardLH:
>> I want to set a score for the message based on whether or not *I* 
>> set
>> watch flag.  Since I can sort on the message's score value, I want 
>> to
>> assign a high score to any thread where I *choose* to watch it.  If 
>> I
>> clear the watch flag, the score should be low or zero to get it out
>> of the top of the sorted list (i.e., it isn't being watched 
>> anymore).
>
> You should consider to give the attempt in
> http://dialog.datalist.org/faq/frequently_asked_questions.html#Q:_How_can_I_change_the_default_Plonk.21_action.3F
> a try.
>
> If you assign some hotkeys to the new default plonk rules it should 
> work
> for you.


But it doesn't appear that I can assign both an action (!watch) and a 
score value using the same plonk rule.  I'd have to define one plonk 
rule to do the scoring and still use the watch flag toolbar button.  I 
could define hotkeys to both but I'd have to remember them, remember 
to do them together, and it requires multiple actions.

Basically I want the same sorting where primary sort is on watch flag 
and secondary sort is by date (with grouping of threaded messages) 
like I have in Outlook Express.  I just make one click in the watch 
column to set the flag.  Sorting is already set up so on my next visit 
the watched threads are at the top.  One of the critical requirements 
for me to switch away from OE was the ability to sort by watch, then 
date, and with grouping just like I already have in OE.

I obviously flag threads to be watched because I want to watch them, 
not have to scroll down dozens, hundreds, or thousands of messages to 
go find them again.  They were marked watched because I really do want 
to watch them.  I do NOT want to watch all threads which have one of 
my posts, just those that I select to watch.  The other way I figured 
in 40Tude Dialog was to define views where one is the All messages or 
Not-Ignored view and another view for Watched.  This doesn't sort them 
together in one message list but requires me to bounce back and forth 
between 2 views (for which I could add toolbar buttons).  If I can't 
figure out why the script doesn't work (although it should based on 
other example scripts that open dialog windows and then perform 
keyboard actions within them), I'll probably go with the 2 view 
toolbar buttons.
Re: 40tude Dialog: Sorting on watched flag. Need help with script.
#218568
Author: Blinky the Shark
Date: Sat, 05 Apr 2008 08:20
27 lines
2370 bytes
Enrico Bauer wrote:

> 05.04.2008 02:44:54 Uhr, *VanguardLH*:
>> I want to set a score for the message based on whether or not *I* set
>> watch flag.  Since I can sort on the message's score value, I want to
>> assign a high score to any thread where I *choose* to watch it.  If I
>> clear the watch flag, the score should be low or zero to get it out of
>> the top of the sorted list (i.e., it isn't being watched anymore).
> 
> You should consider to give the attempt in
> http://dialog.datalist.org/faq/frequently_asked_questions.html#Q:_How_can_I_change_the_default_Plonk.21_action.3F
> a try.
> 
> If you assign some hotkeys to the new default plonk rules it should work
> for you.

Hey, who wants to order one of my programmed plonk keys?

Animation on:  http://blinkynet.net/stuff/comp/pks.gif


-- 
Blinky
Killing all posts from Google Groups
The Usenet Improvement Project: http://improve-usenet.org
Blinky: http://blinkynet.net
Re: 40tude Dialog: Sorting on watched flag. Need help with script.
#218581
Author: Rom
Date: Sat, 05 Apr 2008 14:55
81 lines
3803 bytes
On Fri, 4 Apr 2008 19:44:54 -0500, VanguardLH wrote:

> The sort parameters for the message list do not include flags, like the
> watch flag.  So I figured to up the score of a message when the watched
> flag was set on it.
> 
> No, I do not want to use a "!watched <criteria> <parm>" line in the
> scroing rules.  That marks a message as watched if the criteria is met.
> That is the wrong way around.  I don't want to watch all messages, for
> example, that I post.  Instead I want to decide which threads to watch
> (I have Dialog configured to not just flag on a subthread but instead on
> the whole thread).  I want to set a score for the message based on
> whether or not *I* set watch flag.  Since I can sort on the message's
> score value, I want to assign a high score to any thread where I
> *choose* to watch it.  If I clear the watch flag, the score should be
> low or zero to get it out of the top of the sorted list (i.e., it isn't
> being watched anymore).

I looked through the old messages I still have for this group and
found a script by MLC that will do what you want. All I've done is
added Watch to it and tested it with a keyboard shortcut, but you can
also add a custom/own button in Dialog.

Double-click <dialog.chm::/scripting.htm>, which should open the 
Scripting page in Dialog's Help, then read the second paragraph.
The icons added to ...\Scripts\Icons should be 20 x 20 bitmaps.

How this works is use a keyboard shortcut or button, enter the score,
say, 9999, and it will add the Watch flag too. Use the keyboard
shortcut or button again, enter 0 (zero) to unwatch and reset the
score.

It's from this message (I added the Watch to it):
From: MLC
Newsgroups: news.software.readers
Subject: Re: [Dialog] Adjust score for subject up?
Date: Sat, 10 Jan 2004 23:04:06 +0100
Message-ID: <y96aaf2e3n7t$.dlg@ID-187316.user.uni-berlin.de>

Program PutScore;
uses
   Forms,
   StdCtrls;

var
   s:string;
   myForm : TForm;
   myMemo : TMemo;

Begin
 s:='';
 myForm:=TForm.Create(nil);
 myForm.Width:=80;
 myForm.Height:=40;
 myMemo:=TMemo.Create(myForm);
 myMemo.Parent:=myForm;
 myMemo.Width:=50;
 s:=Readln('How many?');
 if s='' then exit;
 myMemo.Text:=s;
 myMemo.SelectAll;
 myMemo.CopyToClipboard;
 
 PostKey(77, false, true, false, false, false, false, false, false);
 //the above is 80 for the Italian version;
 
 PostKey(9, false, false, false, false, false, false, false, false);
 PostKey(86, false, false, true, false, false, false, false, false);
 PostKey(13, false, false, false, false, false, false, false, false);
 ADo('MessageProperties');
 myForm.free;
ADo('Watch');
End.

Save and compile with Ctr-F9 (not with the green triangles), then
assign a
hotkey.


-- 
Rom
Re: 40tude Dialog: Sorting on watched flag. Need help with script.
#218586
Author: VanguardLH
Date: Sat, 05 Apr 2008 17:29
137 lines
7183 bytes
"Rom" <-@-.invalid> wrote in message 
news:6aod2sok6yhy.1i6rae0xm67m$.dlg@40tude.net...
> On Fri, 4 Apr 2008 19:44:54 -0500, VanguardLH wrote:
>
>> The sort parameters for the message list do not include flags, like 
>> the
>> watch flag.  So I figured to up the score of a message when the 
>> watched
>> flag was set on it.
>>
>> No, I do not want to use a "!watched <criteria> <parm>" line in the
>> scroing rules.  That marks a message as watched if the criteria is 
>> met.
>> That is the wrong way around.  I don't want to watch all messages, 
>> for
>> example, that I post.  Instead I want to decide which threads to 
>> watch
>> (I have Dialog configured to not just flag on a subthread but 
>> instead on
>> the whole thread).  I want to set a score for the message based on
>> whether or not *I* set watch flag.  Since I can sort on the 
>> message's
>> score value, I want to assign a high score to any thread where I
>> *choose* to watch it.  If I clear the watch flag, the score should 
>> be
>> low or zero to get it out of the top of the sorted list (i.e., it 
>> isn't
>> being watched anymore).
>
> I looked through the old messages I still have for this group and
> found a script by MLC that will do what you want. All I've done is
> added Watch to it and tested it with a keyboard shortcut, but you 
> can
> also add a custom/own button in Dialog.
>
> Double-click <dialog.chm::/scripting.htm>, which should open the
> Scripting page in Dialog's Help, then read the second paragraph.
> The icons added to ...\Scripts\Icons should be 20 x 20 bitmaps.
>
> How this works is use a keyboard shortcut or button, enter the 
> score,
> say, 9999, and it will add the Watch flag too. Use the keyboard
> shortcut or button again, enter 0 (zero) to unwatch and reset the
> score.
>
> It's from this message (I added the Watch to it):
> From: MLC
> Newsgroups: news.software.readers
> Subject: Re: [Dialog] Adjust score for subject up?
> Date: Sat, 10 Jan 2004 23:04:06 +0100
> Message-ID: <y96aaf2e3n7t$.dlg@ID-187316.user.uni-berlin.de>
>
> Program PutScore;
> uses
>   Forms,
>   StdCtrls;
>
> var
>   s:string;
>   myForm : TForm;
>   myMemo : TMemo;
>
> Begin
> s:='';
> myForm:=TForm.Create(nil);
> myForm.Width:=80;
> myForm.Height:=40;
> myMemo:=TMemo.Create(myForm);
> myMemo.Parent:=myForm;
> myMemo.Width:=50;
> s:=Readln('How many?');
> if s='' then exit;
> myMemo.Text:=s;
> myMemo.SelectAll;
> myMemo.CopyToClipboard;
>
> PostKey(77, false, true, false, false, false, false, false, false);
> //the above is 80 for the Italian version;
>
> PostKey(9, false, false, false, false, false, false, false, false);
> PostKey(86, false, false, true, false, false, false, false, false);
> PostKey(13, false, false, false, false, false, false, false, false);
> ADo('MessageProperties');
> myForm.free;
> ADo('Watch');
> End.
>
> Save and compile with Ctr-F9 (not with the green triangles), then
> assign a
> hotkey.


It looks like that script opens a form where the user can enter a 
value (How many?) and then pastes it to a buffer (clipboard).  Rather 
than enter the value into the input field using PostKey for each 
character ('9', '9', '9', '9') as I did, it uses Ctrl-V (the 86 
keycode with 'true' 4th parameter).  It also then hits the Enter key 
(13 keycode) instead of where I tried to use Alt+O (for the OK 
button).  What I really see different is that the keystrokes for 
PostKey look to get buffered up.  That is, PostKey is used *before* 
the dialog window is opened with the ADo function.

In some scripts, I noticed the use of ADoLater() to open the dialog 
window which is then followed by the PostKey functions to issue 
keystrokes, as at 
http://dialog.datalist.org/scripts/ScriptTrashBin.html.  I could not 
find documentation in Dialog's help about ADoLater.  In other 
examples, like at 
http://dialog.datalist.org/scripts/ExpireRelative.html, and like your 
code shown here, the ADo() is used *after* the PostKey commands.  In 
another example, at 
http://dialog.datalist.org/scripts/ScriptPaterNoster.html, the ADo() 
is used first and followed by the PostKey commands but it seems that 
example merely changes focus rather than open a new dialog window.

So I see some examples that use the undocumented ADoLater() which is 
followed by PostKey().  In some examples, I see PostKey() followed by 
ADo().  In some examples, I see ADo() followed by PostKey() but the 
ones that I looked at are changing focus (to a pane or object in the 
GUI) rather than opening a new window.  So I'm wondering if PostKey() 
is buffering up the keystrokes until the next window that gets focus. 
I use ADo() to open the window and then use PostKey() but those 
keystrokes are not seen by the new window opened by ADo() but instead 
by the main window when the new window gets closed.  So other than 
when ADo() is used to change focus and then use PostKey(), it seems to 
get the keystrokes in a newly opened window that I must either:

- Use ADoLater() that will accept what PostKey() buffered up.
- Use PostKey() first to buffer up the keystrokes and then use ADo() 
to open the window.

I'll see what happens if I do the 2nd scheme.  I can't find any 
documentation on ADoLater() to know how to use it.  I don't want to 
bother with a popup form where I have to enter the scoring value when 
what I want done is to toggle the watch flag and score based on 
whether the watched flag is on or off.
Re: 40tude Dialog: Sorting on watched flag. Need help with script.
#218589
Author: VanguardLH
Date: Sat, 05 Apr 2008 17:44
38 lines
2955 bytes
VanguardLH wrote:

> So other than when ADo() is used to change focus and then use 
> PostKey(), it seems to get the keystrokes in a newly opened window 
> that I must either:
> 
> - Use ADoLater() that will accept what PostKey() buffered up.
> - Use PostKey() first to buffer up the keystrokes and then use ADo() 
> to open the window.
> 
> I'll see what happens if I do the 2nd scheme.  I can't find any 
> documentation on ADoLater() to know how to use it.  

Okay, I moved the ADo() command to *after* the PostKey() commands and it
works better (but not yet perfect).  So now I have:

   ...
   lockdisplay;             
   ADo('Watch');
   <PostKey commands here>
   ADo('MessageProperties');
   unlockdisplay;
   ...

The dialog pops up very quickly (almost can't be seen unless I run the
script many times).  The watch flag gets added and the score gets set to
9999.  So I'm almost there.

The problem now is that the 'if' command doesn't work.  When I use the
script on a message (that is not watched and not scored), the script
sees the watch flag got set so it runs the 'then' clause of the 'if'
command to set the scoring value to 9999.  However, when I run the
script a 2nd time (to clear the watch flag and try to zero out the
score), the watch flag comes off but AEnabled('Watch') is still
returning 'true' so the value gets set to 9999 (what it is before)
instead of zero.
 
So there is still some more playing around with the script to do.
Re: 40tude Dialog: Sorting on watched flag. Need help with script.
#218593
Author: VanguardLH
Date: Sat, 05 Apr 2008 17:54
56 lines
4026 bytes
VanguardLH wrote:

> VanguardLH wrote:
> 
>> So other than when ADo() is used to change focus and then use 
>> PostKey(), it seems to get the keystrokes in a newly opened window 
>> that I must either:
>> 
>> - Use ADoLater() that will accept what PostKey() buffered up.
>> - Use PostKey() first to buffer up the keystrokes and then use ADo() 
>> to open the window.
>> 
>> I'll see what happens if I do the 2nd scheme.  I can't find any 
>> documentation on ADoLater() to know how to use it.  
> 
> Okay, I moved the ADo() command to *after* the PostKey() commands and it
> works better (but not yet perfect).  So now I have:
> 
>    ...
>    lockdisplay;             
>    ADo('Watch');
>    <PostKey commands here>
>    ADo('MessageProperties');
>    unlockdisplay;
>    ...
> 
> The dialog pops up very quickly (almost can't be seen unless I run the
> script many times).  The watch flag gets added and the score gets set to
> 9999.  So I'm almost there.
> 
> The problem now is that the 'if' command doesn't work.  When I use the
> script on a message (that is not watched and not scored), the script
> sees the watch flag got set so it runs the 'then' clause of the 'if'
> command to set the scoring value to 9999.  However, when I run the
> script a 2nd time (to clear the watch flag and try to zero out the
> score), the watch flag comes off but AEnabled('Watch') is still
> returning 'true' so the value gets set to 9999 (what it is before)
> instead of zero.
>  
> So there is still some more playing around with the script to do.

My guess, at this point, is that AEnabled() and AChecked() won't work to
test if the watch flag is set or not.  AEnabled(), according to its
extremely terse one-line description via the comment shown in the help
after this function, checks if the object is enabled.  Enabled and
disabled usually is an object attribute that specifies whether or not
the object can be selected (whereas the visible attribute is to
determine if it appears or not in the window).  The "W" menu entry is
always enabled.  That is why the 'then' clause of "if (
AEnabled('Watch') )" always gets ran to set the score to 9999 because it
is always true that the "W" (watch) menu item is enabled.  AChecked()
looks to be for checkbox or radiobox controls.  The "W" menu entry is
not a checkbox or radiobox but instead a trigger that merely toggles the
current watchstate variable.

So how else might I test if the watch flag is set or not?
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads