Thread View: news.software.readers
28 messages
28 total messages
Started by MLC
Tue, 24 Feb 2004 08:30
[Dialog] help needed with scripts
Author: MLC
Date: Tue, 24 Feb 2004 08:30
Date: Tue, 24 Feb 2004 08:30
16 lines
1927 bytes
1927 bytes
Hi, I'm writing some scripts to have pop-ups listing new arrivals of emails or answers to my posts. All is working fine, I have however still this problem: the command to show the pop-up is after that to download the messages, but Dialog shows the pop-up while it's still downloading, therefore the list isn't yet updated. I've thought to put a sleep between the two commands, and it works well if I give enough time, but it makes impossible every interaction with Dialog until this time is elapsed. Can be there another solution? Every help is *much* appreciated :) -- Maria Luisa C - 24/02/04 9.18.17, here. Le FAQ italiane del newsreader 40tude Dialog http://fido.altervista.org/Dialog/faq.html http://www.lillathedog.net/dialog/faq.html
Re: [Dialog] help needed with scripts
Author: Jeff Relf
Date: Tue, 24 Feb 2004 08:49
Date: Tue, 24 Feb 2004 08:49
8 lines
1417 bytes
1417 bytes
Hi MLC, Re: Your reply notification script, Can you set and kill timers ? Maybe you could set a timer to periodically check if the thread is active. ( And then kill the timer after that )
Re: [Dialog] help needed with scripts
Author: MLC
Date: Tue, 24 Feb 2004 09:03
Date: Tue, 24 Feb 2004 09:03
19 lines
1884 bytes
1884 bytes
martedì 24/feb/2004 _Jeff Relf_ ha scritto: > Hi MLC, > Re: Your reply notification script, > > Can you set and kill timers ? > > Maybe you could set a timer to > periodically check if the thread is active. > ( And then kill the timer after that ) This is a very good idea, thanks. I can set a timer, but I don't know if there is a way in the limited script language to check if a thread is active. Is there? -- Maria Luisa C - 24/02/04 9.58.05, here. Le FAQ italiane del newsreader 40tude Dialog http://fido.altervista.org/Dialog/faq.html http://www.lillathedog.net/dialog/faq.html
Re: [Dialog] help needed with scripts
Author: Doktor
Date: Tue, 24 Feb 2004 09:32
Date: Tue, 24 Feb 2004 09:32
15 lines
1865 bytes
1865 bytes
24 Feb You wrote: > I've thought to put a sleep between the two commands, and it works well if I > give enough time, but it makes impossible every interaction with Dialog > until this time is elapsed. > Can be there another solution? Try this: Application.ProcessMessages; sleep (1000); -- Doktor http://usenetowa.lameriada.com
Re: [Dialog] help needed with scripts
Author: MLC
Date: Tue, 24 Feb 2004 10:46
Date: Tue, 24 Feb 2004 10:46
25 lines
2253 bytes
2253 bytes
martedì 24/feb/2004 _Doktor_ ha scritto: > 24 Feb You wrote: > >> I've thought to put a sleep between the two commands, and it works well if I >> give enough time, but it makes impossible every interaction with Dialog >> until this time is elapsed. >> Can be there another solution? > > Try this: > > Application.ProcessMessages; > sleep (1000); Thank you, Doktor, I'm trying it but that pop-up keeps appearing before the process of retrieving messages is terminated (also putting 3000). I think I'll try also to put a counter in the form, as Jeff Relf suggested, without checking for running processes because I don't know how to do it in Dialog scripts. If you have other inputs they'll be very welcome! :) -- Maria Luisa C - 24/02/04 11.31.27, here. Le FAQ italiane del newsreader 40tude Dialog http://fido.altervista.org/Dialog/faq.html http://www.lillathedog.net/dialog/faq.html
Re: [Dialog] help needed with scripts
Author: Doktor
Date: Tue, 24 Feb 2004 12:11
Date: Tue, 24 Feb 2004 12:11
81 lines
3721 bytes
3721 bytes
On 24 Feb (11:46) You wrote:
> I think I'll try also to put a counter in the form, as Jeff Relf suggested,
> without checking for running processes because I don't know how to do it in
> Dialog scripts.
I don't know how to check if the thread is active but I have another idea.
At your main script at the beginning, You must create some Form. Later, You
should put Your code. At the end of script You should destroy this Form.
At the second script you should check if the form exists in memory. If
exists - process is active, if not exists - process is not active.
I know it's not the best solution but it works. ;)
Examples: (You'll see the effect on the Dialog main window caption) :)
First script (main):
// -------------------
Program test;
uses Forms;
var Form : TForm;
// here is only example to show that script works:
function MessageBox (hWnd : LongWord; lpText,
lpCaption : PChar; uType : LongWord ) : Integer;
external 'MessageBoxA@user32.dll stdcall';
Begin
Form := TForm.Create (Application.MainForm);
Form.Parent := Application.MainForm;
Form.Name := 'DummyForm';
// [your code goes here]
// here is only example to show that script works:
MessageBox (0, 'Check Main 40tude Dialog form caption', 'Info', $40);
Form.Free;
End.
// -------------------
Second script (OnTimer2 event):
// -------------------
program OnTimer2;
uses Forms;
procedure OnTimer2;
begin
if Application.MainForm.FindComponent ('DummyForm') <> nil
then Application.MainForm.Caption := 'Process active!'
else Application.MainForm.Caption := 'Process not active!';
end;
begin
end.
// -------------------
This way allows You to "communicate" between every two or more scripts. :)
> If you have other inputs they'll be very welcome! :)
You are welcome. ;)
PS.
Sorry for my English. I know it's not good enough. I still better know
Pascal language than English. ;)
--
Doktor
http://usenetowa.lameriada.com
Re: [Dialog] help needed with scripts
Author: MLC
Date: Tue, 24 Feb 2004 12:26
Date: Tue, 24 Feb 2004 12:26
31 lines
2142 bytes
2142 bytes
martedì 24/feb/2004 _Doktor_ ha scritto: [snip code] > This way allows You to "communicate" between every two or more scripts. :) Thank you! :) I haven't tried it yet, but it looks very promising. I'll let you know. > >> If you have other inputs they'll be very welcome! :) > > You are welcome. ;) You're very kind. > > PS. > Sorry for my English. I know it's not good enough. I still better know > Pascal language than English. ;) Your English is enough for mine, that isn't better. And unfortunately my Pascal neither ;) Ciao! -- Maria Luisa C - 24/02/04 13.16.41, here. Le FAQ italiane del newsreader 40tude Dialog http://fido.altervista.org/Dialog/faq.html http://www.lillathedog.net/dialog/faq.html
Re: [Dialog] help needed with scripts
Author: MLC
Date: Tue, 24 Feb 2004 12:40
Date: Tue, 24 Feb 2004 12:40
34 lines
2354 bytes
2354 bytes
martedì 24/feb/2004 _MLC_ ha scritto: > martedì 24/feb/2004 _Jeff Relf_ ha scritto: > >> Hi MLC, >> Re: Your reply notification script, >> >> Can you set and kill timers ? >> >> Maybe you could set a timer to >> periodically check if the thread is active. >> ( And then kill the timer after that ) > > This is a very good idea, thanks. > I can set a timer, but I don't know if there is a way in the limited script > language to check if a thread is active. Is there? Hi Jeff, Putting a timer in my form (with the Extctrls in the uses clause) gives this AV error at run time: Access violation at address 00459D98 in module 'dialog.exe'. Read of address 00000030 in 0 at 106 I'm not so expert to deal with AV errors... Now I'll study the Doktor's hint :) Ciao, -- Maria Luisa C - 24/02/04 13.35.05, here. Le FAQ italiane del newsreader 40tude Dialog http://fido.altervista.org/Dialog/faq.html http://www.lillathedog.net/dialog/faq.html
Re: [Dialog] help needed with scripts
Author: MLC
Date: Tue, 24 Feb 2004 20:12
Date: Tue, 24 Feb 2004 20:12
23 lines
2459 bytes
2459 bytes
martedì 24/feb/2004 _MLC_ ha scritto: > I'll let you know. Here I am :) Your hint is clever indeed, my problem however is that I need to control if the OnBeforeSavingMessage process is terminated, because I use it to save in a file the header "From" of all becoming replies. Other two personal scripts then do the work to create the forms, etc. Anyway I thought to use your method , creating there a dummy Form and using it to control if the process is still active. Unluckily, in the OnBeforeSavingMessage event I get an /Unknown identifier 'Application'/ error, and it is strange because I don't get it for other events. I wish Marcus in a future version could add a some WaitIdle function. Thanks again for your help :) -- Maria Luisa C - 24/02/04 20.53.00, here. Le FAQ italiane del newsreader 40tude Dialog http://fido.altervista.org/Dialog/faq.html http://www.lillathedog.net/dialog/faq.html
Re: [Dialog] help needed with scripts
Author: Doktor
Date: Tue, 24 Feb 2004 21:23
Date: Tue, 24 Feb 2004 21:23
17 lines
2054 bytes
2054 bytes
24 Feb 2004 (21:12) You wrote: > Unluckily, in the OnBeforeSavingMessage event I get an > /Unknown identifier 'Application'/ error, and it is strange because I don't > get it for other events. Did You add this: uses Forms; ? You must add it because "Application" is in "Forms" class. -- Doktor http://usenetowa.lameriada.com
Re: [Dialog] help needed with scripts
Author: Jeff Relf
Date: Wed, 25 Feb 2004 05:43
Date: Wed, 25 Feb 2004 05:43
9 lines
1719 bytes
1719 bytes
Hi MLC, You mentioned, " I wish Marcus in a future version could add a WaitIdle function. " . Pop-ups can be annoying, Why not make your script very independent of any downloads ? Just have the script report this: All new replies since the user last ran the script ?
Re: [Dialog] help needed with scripts
Author: MLC
Date: Wed, 25 Feb 2004 08:09
Date: Wed, 25 Feb 2004 08:09
21 lines
2360 bytes
2360 bytes
mercoledì 25/feb/2004 _Jeff Relf_ ha scritto: > Hi MLC, You mentioned, > " I wish Marcus in a future version > could add a WaitIdle function. " . > > Pop-ups can be annoying, > Why not make your script very independent of any downloads ? > > Just have the script report this: > All new replies since the user last ran the script ? This is simple and already done :) I'd like also to add an automatic feature for those who want it. Now I've implemented it but, as I said, it shows the arrivals of the preceding "round". -- Maria Luisa C - 25/02/04 9.03.27, here. Le FAQ italiane del newsreader 40tude Dialog http://fido.altervista.org/Dialog/faq.html http://www.lillathedog.net/dialog/faq.html
Re: [Dialog] help needed with scripts
Author: MLC
Date: Wed, 25 Feb 2004 08:09
Date: Wed, 25 Feb 2004 08:09
24 lines
2215 bytes
2215 bytes
martedì 24/feb/2004 _Doktor_ ha scritto: > 24 Feb 2004 (21:12) You wrote: > >> Unluckily, in the OnBeforeSavingMessage event I get an >> /Unknown identifier 'Application'/ error, and it is strange because I don't >> get it for other events. > > Did You add this: > > uses Forms; > > ? > > You must add it because "Application" is in "Forms" class. Of course I added it :) For this reason I found it strange, because for example in the OnTimer2 event that error doesn't come up. -- Maria Luisa C - 25/02/04 8.53.02, here. Le FAQ italiane del newsreader 40tude Dialog http://fido.altervista.org/Dialog/faq.html http://www.lillathedog.net/dialog/faq.html
Re: [Dialog] help needed with scripts
Author: Jeff Relf
Date: Wed, 25 Feb 2004 12:22
Date: Wed, 25 Feb 2004 12:22
24 lines
2280 bytes
2280 bytes
Hi MLC,
Re: Re your script that
runs in the background checking for replies,
and how it can't tell when the downloads are finished.
Is there a " process ended " message somewhere ?
This probably won't help,
but here's how I wait for a process to finish in C,
PROCESS_INFORMATION Thread; STARTUPINFO s;
CreateProcess( 0, Command_Line, 0,0,0,0,0,0, &s, &Thread );
DWORD Thread_Status;
while(
GetExitCodeProcess( Thread.hProcess , & Thread_Status )
&& Thread_Status == STILL_ACTIVE )
{
while( PeekMessage( & Msg, 0,0,0,0 ) )
DispatchMessage( & Msg );
Sleep(300);
}
Sleep(300);
Re: [Dialog] help needed with scripts
Author: MLC
Date: Wed, 25 Feb 2004 12:33
Date: Wed, 25 Feb 2004 12:33
34 lines
2587 bytes
2587 bytes
mercoledì 25/feb/2004 _Jeff Relf_ ha scritto:
> Hi MLC,
> Re: Re your script that
> runs in the background checking for replies,
> and how it can't tell when the downloads are finished.
>
> Is there a " process ended " message somewhere ?
>
> This probably won't help,
> but here's how I wait for a process to finish in C,
>
> PROCESS_INFORMATION Thread; STARTUPINFO s;
>
> CreateProcess( 0, Command_Line, 0,0,0,0,0,0, &s, &Thread );
>
> DWORD Thread_Status;
> while(
> GetExitCodeProcess( Thread.hProcess , & Thread_Status )
> && Thread_Status == STILL_ACTIVE )
> {
> while( PeekMessage( & Msg, 0,0,0,0 ) )
> DispatchMessage( & Msg );
> Sleep(300);
> }
> Sleep(300);
Thanks Jeff, but I think that the script language doesn't allow it, at least
I don't know.
--
Maria Luisa C - 25/02/04 13.30.15, here.
Le FAQ italiane del newsreader 40tude Dialog
http://fido.altervista.org/Dialog/faq.html
http://www.lillathedog.net/dialog/faq.html
Re: [Dialog] help needed with scripts
Author: matija
Date: Fri, 27 Feb 2004 22:03
Date: Fri, 27 Feb 2004 22:03
14 lines
1876 bytes
1876 bytes
MLC, completely geschtonkenflapped, wrote:
> I've thought to put a sleep between the two commands, and it works well if I
> give enough time, but it makes impossible every interaction with Dialog
> until this time is elapsed.
> Can be there another solution?
i'll try to dig up something that deals with atoms...
no promises, though.
--
there is a cheer. the gnomes have learned a new way to say hooray. [-shpongle]
address is scrambled - remove the superfluous "x" marks to reply
Re: [Dialog] help needed with scripts
Author: MLC
Date: Fri, 27 Feb 2004 22:11
Date: Fri, 27 Feb 2004 22:11
18 lines
1975 bytes
1975 bytes
venerdì 27/feb/2004 _matija_ ha scritto: > MLC, completely geschtonkenflapped, wrote: >> I've thought to put a sleep between the two commands, and it works well if I >> give enough time, but it makes impossible every interaction with Dialog >> until this time is elapsed. >> Can be there another solution? > > i'll try to dig up something that deals with atoms... > no promises, though. Thanks matija! I wish you all the best :) -- Maria Luisa C - 27/02/04 23.07.36, here. Le FAQ italiane del newsreader 40tude Dialog http://fido.altervista.org/Dialog/faq.html http://www.lillathedog.net/dialog/faq.html
Re: [Dialog] help needed with scripts
Author: matija
Date: Fri, 27 Feb 2004 22:44
Date: Fri, 27 Feb 2004 22:44
50 lines
3128 bytes
3128 bytes
MLC, completely geschtonkenflapped, wrote:
> I've thought to put a sleep between the two commands, and it works well if I
> give enough time, but it makes impossible every interaction with Dialog
> until this time is elapsed.
> Can be there another solution?
would this help somehow? note that you can have multiple references
to an atom, so if you create it five times and delete it only once,
it will still be kept in the atom table until you call the delete
function four more times. also, it might be a good idea to enclose
everything in try..finally blocks.
program atomTest;
function globalAddAtom(lpStr: pchar) : word; external 'GlobalAddAtomA@kernel32.dll stdcall';
function globalFindAtom(lpStr: pchar) : word; external 'GlobalFindAtomA@kernel32.dll stdcall';
function globalDeleteAtom(nAtom: word) : word; external 'GlobalDeleteAtom@kernel32.dll stdcall';
var atomName: pchar;
myAtom: word;
begin
atomName := 'MLCAtom';
myAtom := globalAddAtom(atomName);
if (myAtom <> 0) then
begin
writeln('');
writeln('created atom with ID ' + inttostr(myAtom));
myAtom := globalFindAtom(atomName);
if (myAtom <> 0) then
begin
writeln ('found the atom! now going to delete it...')
globalDeleteAtom(myAtom);
writeln ('atom hopefully deleted; we would need setLastError() and getLastError() to check :/');
writeln('');
end;
end; // if (myAtom <> 0) after globalAddAtom()
end.
--
there is a cheer. the gnomes have learned a new way to say hooray. [-shpongle]
address is scrambled - remove the superfluous "x" marks to reply
Re: [Dialog] help needed with scripts
Author: MLC
Date: Sat, 28 Feb 2004 10:34
Date: Sat, 28 Feb 2004 10:34
20 lines
2008 bytes
2008 bytes
venerdì 27/feb/2004 _matija_ ha scritto: > program atomTest; [...] Hi matija, first of all thank you for your help. I've never worked with atoms (in every sense :)), and I'm studying now how to use atoms to make my two scripts PostShow and MailShow to run when GetNewHeadersInSubscribedGroups and GetNewEmailsForAllIdentities have finished... I hope I'll work it out! P.S. What's the meaning of "geschtonkenflapped" ? :) -- Maria Luisa C - 28/02/04 10.43.25, here. Le FAQ italiane del newsreader 40tude Dialog http://fido.altervista.org/Dialog/faq.html http://www.lillathedog.net/dialog/faq.html
Re: [Dialog] help needed with scripts
Author: matija
Date: Sat, 28 Feb 2004 14:14
Date: Sat, 28 Feb 2004 14:14
31 lines
2728 bytes
2728 bytes
MLC, completely geschtonkenflapped, wrote:
> first of all thank you for your help.
no problem :)
> I've never worked with atoms (in every sense :)), and I'm studying now how
> to use atoms to make my two scripts PostShow and MailShow to run when
> GetNewHeadersInSubscribedGroups and GetNewEmailsForAllIdentities have
> finished... I hope I'll work it out!
well, i never worked with atoms too, so that makes two of us ;)
basicly, they can be used as little pieces of information that
can be shared globally across the OS; so, you'd need to set an
atom somewhere and check it somewhere else. i don't know if this
will be of any use of you, my mind is at another place the last
few days, so i don't know if i understood what you were trying
to accomplish in the first place...
> P.S. What's the meaning of "geschtonkenflapped" ? :)
"to be shpongled is to be kippered, mashed, smashed, destroyed,
completely geschtonkenflapped" (from shpongle's "room 23")
--
there is a cheer. the gnomes have learned a new way to say hooray. [-shpongle]
address is scrambled - remove the superfluous "x" marks to reply
Re: [Dialog] help needed with scripts
Author: MLC
Date: Sat, 28 Feb 2004 15:57
Date: Sat, 28 Feb 2004 15:57
49 lines
3548 bytes
3548 bytes
sabato 28/feb/2004 _matija_ ha scritto:
> well, i never worked with atoms too, so that makes two of us ;)
>
> basicly, they can be used as little pieces of information that
> can be shared globally across the OS; so, you'd need to set an
> atom somewhere and check it somewhere else. i don't know if this
> will be of any use of you, my mind is at another place the last
> few days, so i don't know if i understood what you were trying
> to accomplish in the first place...
It's seems to me a powerful tool to use, maybe I'll find a way to get what I
want with it. I need time, however: often the solutions come to me while I'm
sleeping :)
In short, this is what I'm trying to do: when the messages arrive, in
OnBeforeSavingMessage I save some information from each of them in a file;
this information is read and shown in a Form by a custom script PostShow.
I can put PostShow on a button and it works very well, but I'd like also to
have it done automatically, with a timer, so if you're working on other
things, with Dialog minimized, you get a popup window with the list of the
messages that are replies to you, or replies to replies,..., depending on
the "depth" level you've chosen.
I've already done all that, the only problem is that, being my timer2
procedure this:
ADo('GetNewHeadersInSubscribedGroups');
ADo('Script_PostShow');
the popup window I get with PostShow shows the messages of the preceding
timer2 event, because ADo('Script_PostShow') is triggered while
ADo('GetNewHeadersInSubscribedGroups') is still executing.
Now I'm thinking to put an atom somewhere...
...still don't know where... :-/
>
>> P.S. What's the meaning of "geschtonkenflapped" ? :)
>
> "to be shpongled is to be kippered, mashed, smashed, destroyed,
> completely geschtonkenflapped" (from shpongle's "room 23")
Thanks :)
--
Maria Luisa C - 28/02/04 16.03.05, here.
Le FAQ italiane del newsreader 40tude Dialog
http://fido.altervista.org/Dialog/faq.html
http://www.lillathedog.net/dialog/faq.html
Re: [Dialog] help needed with scripts
Author: matija
Date: Sat, 28 Feb 2004 18:07
Date: Sat, 28 Feb 2004 18:07
136 lines
6315 bytes
6315 bytes
MLC, completely geschtonkenflapped, wrote:
> In short, this is what I'm trying to do: when the messages arrive, in
> OnBeforeSavingMessage I save some information from each of them in a file;
> this information is read and shown in a Form by a custom script PostShow.
hmmm... what about this: you create a form in onStartup (and delete
it in onShutdown) and populate it within onBeforeSavingMessage?
onStartup:
createMyForm()
script_getHeaders:
ADo('getNewHeadersInSubscribedGroups')
onBeforeSavingMessage:
check replies
find myForm
if reply meets conditions, add data to myForm
onShutdown:
deleteMyForm()
i'm actually supposed to do some hacking soon (there's a program
with some textboxes which i need to populate programatically from
another program, "click" on a button and have my h4><0r proggie
read the contents of the original window and steal the data ;)
so, a similar thing could be applied here - the form could have
a listbox which could be populated from another place. that's
a bit clunky, though it would look awesome...
> the popup window I get with PostShow shows the messages of the preceding
> timer2 event, because ADo('Script_PostShow') is triggered while
> ADo('GetNewHeadersInSubscribedGroups') is still executing.
oh... well, i'm thinking of something else right now:
1) try the onEmailChecked event and see if it also applies to
retrieving posts - if it does, you put your postShow stuff
right there and get rid of timer2 and all the problems.
2) postShow() could try to get some sort of access to dialog's
progressbar (TTntProgressBar.UnicodeClass) and loop until it's
back at 0% - this would mean that dialog has finished
retrieving headers.
something like this should work:
- get dialog's window handle (findWindow)
- get status bar's handle (findWindowEx)
- get progressbar's handle (findWindowEx)
- dispatch PBM_GETPOS to progressbar until 0 is received
- display form
(... half an hour later: see the code at the bottom :))
> Now I'm thinking to put an atom somewhere...
> ...still don't know where... :-/
yeah, they won't work, i misunderstood you. you'd need the
ADo('gnhisg') command to set an atom when it's finished
and have your postShow script loop until it has found it,
which obviously isn't possible.
and now, the progressbar code:
------
Program progressbar;
function findWindow(lpClassName, lpWindowName: pchar): cardinal; external 'FindWindowA@user32.dll stdcall';
function findWindowEx(hWndParent, hwndChildAfter: cardinal; lpszClass, lpszWindow: pchar): cardinal; external 'FindWindowExA@user32.dll stdcall';
function sendMessage(hWnd, Msg, wParam, lParam: cardinal): cardinal; external 'SendMessageA@user32.dll stdcall';
const dialogWindowTitle = 'Tfrm40tdMain.UnicodeClass';
statusBarTitle = 'TTBXStatusBar';
progressBarTitle = 'TTntProgressBar.UnicodeClass';
WM_USER = 1024;
PBM_GETPOS = WM_USER + 8;
function findDialogHWND : cardinal;
begin
// get dialog's window handle
result := findWindow(dialogWindowTitle, null);
end;
function findStatusBarHWND(dialogHWND : cardinal) : cardinal;
begin
// get dialog status bar's window handle
result := findWindowEx(DialogHWND, null, statusBarTitle, null);
end;
function findProgressBarHWND(statusBarHWND : cardinal) : cardinal;
begin
// get dialog status bar progress bar's window handle
result := findWindowEx(statusBarHWND, null, progressBarTitle, null);
end;
function getProgressBarPosition(progressBarHWND : cardinal) : cardinal;
begin
// get position of progress bar :)
result := sendMessage(progressBarHWND, PBM_GETPOS, 0, 0);
end;
// ---------------------------
var dialogHWND, statusBarHWND, progressBarHWND, progressBarPosition : cardinal;
Begin
dialogHWND := findDialogHWND;
writeln ('dialog HWND: ' + inttostr(dialogHWND));
statusBarHWND := findStatusBarHWND(dialogHWND);
writeln ('status bar HWND: ' + inttostr(statusBarHWND));
progressBarHWND := findProgressBarHWND(statusBarHWND);
writeln ('progress bar HWND: ' + inttostr(progressBarHWND));
progressBarPosition := getProgressBarPosition(progressBarHWND);
writeln ('progress bar position: ' + inttostr(progressBarPosition));
End.
--
there is a cheer. the gnomes have learned a new way to say hooray. [-shpongle]
address is scrambled - remove the superfluous "x" marks to reply
Re: [Dialog] help needed with scripts
Author: MLC
Date: Sat, 28 Feb 2004 20:50
Date: Sat, 28 Feb 2004 20:50
41 lines
2808 bytes
2808 bytes
sabato 28/feb/2004 _matija_ ha scritto:
> Program progressbar;
This sounds a great idea!
Nevertheless it seems odd to me that, wanting to test it inside timer2, the
messagebox always gives 0 as progress bar position, even if it's started:
[...]
begin
ADo('GetNewHeadersInSubscribedGroups');
dialogHWND := findDialogHWND;
statusBarHWND := findStatusBarHWND(dialogHWND);
progressBarHWND := findProgressBarHWND(statusBarHWND);
progressBarPosition := getProgressBarPosition(progressBarHWND);
sleep (5000);
MessageBox (0, IntToStr(progressBarPosition), 'Test', $40);
if(progressBarPosition)=0 then ADo('Script_PostShow');
end;
and therefore PostShow starts too soon.
Do you know why there is always 0 ?
I've tried also onEmailChecked but it doesn't apply to retrieving posts, and
I see that if you don't get any email it does nothing.
My last chance now is to try to check the progress bar position inside a
loop in PostShow, as you suggested.
Yet I'm feeling a bit pessimistic, having seen that value 0 inside timer2.
Thanks again for all your help and your time! :)
--
Maria Luisa C - 28/02/04 21.43.37, here.
Le FAQ italiane del newsreader 40tude Dialog
http://fido.altervista.org/Dialog/faq.html
http://www.lillathedog.net/dialog/faq.html
Re: [Dialog] help needed with scripts
Author: Barry Jones
Date: Sat, 28 Feb 2004 21:04
Date: Sat, 28 Feb 2004 21:04
48 lines
3705 bytes
3705 bytes
On Sat, 28 Feb 2004 16:57:46 +0100, MLC wrote:
> sabato 28/feb/2004 _matija_ ha scritto:
>
>> well, i never worked with atoms too, so that makes two of us ;)
>>
>> basicly, they can be used as little pieces of information that
>> can be shared globally across the OS; so, you'd need to set an
>> atom somewhere and check it somewhere else. i don't know if this
>> will be of any use of you, my mind is at another place the last
>> few days, so i don't know if i understood what you were trying
>> to accomplish in the first place...
>
> It's seems to me a powerful tool to use, maybe I'll find a way to get what I
> want with it. I need time, however: often the solutions come to me while I'm
> sleeping :)
>
> In short, this is what I'm trying to do: when the messages arrive, in
> OnBeforeSavingMessage I save some information from each of them in a file;
> this information is read and shown in a Form by a custom script PostShow.
> I can put PostShow on a button and it works very well, but I'd like also to
> have it done automatically, with a timer, so if you're working on other
> things, with Dialog minimized, you get a popup window with the list of the
> messages that are replies to you, or replies to replies,..., depending on
> the "depth" level you've chosen.
> I've already done all that, the only problem is that, being my timer2
> procedure this:
>
> ADo('GetNewHeadersInSubscribedGroups');
> ADo('Script_PostShow');
>
> the popup window I get with PostShow shows the messages of the preceding
> timer2 event, because ADo('Script_PostShow') is triggered while
> ADo('GetNewHeadersInSubscribedGroups') is still executing.
>
> Now I'm thinking to put an atom somewhere...
> ...still don't know where... :-/
I don't see how that will help.
What are you doing with timer1? Could it be made available? If so, put a
sleep command in the OnStartup procedure between the two timer
initializations, with the same timer interval for both. Let timer 1 do
action 1 and timer 2 do action 2. If you used timer 1 for something else,
try to combine it with this use of the timer.
--
Barry
Re: [Dialog] help needed with scripts
Author: matija
Date: Sat, 28 Feb 2004 21:56
Date: Sat, 28 Feb 2004 21:56
76 lines
4435 bytes
4435 bytes
MLC, completely geschtonkenflapped, wrote:
>> Program progressbar;
>
> This sounds a great idea!
> Nevertheless it seems odd to me that, wanting to test it inside timer2, the
> messagebox always gives 0 as progress bar position, even if it's started:
here's the problem:
> ADo('GetNewHeadersInSubscribedGroups');
> progressBarPosition := getProgressBarPosition(progressBarHWND);
> sleep (5000);
it takes some time until dialog starts downloading the headers.
move the sleep() function above getProgressBarPosition() and
you won't get 0 as the result (if dialog doesn't finish sooner
than those five seconds :))
> My last chance now is to try to check the progress bar position inside a
> loop in PostShow, as you suggested.
bleh, loops are bad. i think this is what you need:
- execute getNewHeadersInSubscribedGroups
- set "newHeaders" atom
- set a timer that runs every x seconds and checks the progressbar
- in this timer:
- if (PB position = 0) and (atom "newHeaders" exists)
- execute postShow
- delete "newHeaders" atom
hey, it seems that atoms will be useful after all! ;) here you use
one to indicate that there was an attempt to download new headers;
that is, to prevent the postShow form popping up every time the timer
fires. also, since you'll be checking the progressbar status in the
timer procedure, you won't get the postShow form if dialog still
isn't finished downloading new headers.
to recap:
timer1 (say, five minutes):
- get new headers
- set an atom to indicate that headers are downloaded (be sure to
check if it exists first - if it does, delete it! remember what
i said about atom dependencies, we don't want resource leaks...)
timer2 (say, five seconds):
- check progressbar position
- if it's 0 and the atom exists, it means that dialog has finished
downloading new headers, so...
- call postShow and delete the atom within it to indicate that
you have successfully shown your form
also, to be on the safe side, there should be some code in the
onShutdown event in the form of
myAtom = findAtom(myAtomName);
while (myAtom <> 0) do deleteAtom(myAtom);
maybe the same thing should be in timer1, or you can modify the
atom deletion procedure to automatically trash all of them.
i hope this works as intended...
> Thanks again for all your help and your time! :)
my pleasure :)
--
there is a cheer. the gnomes have learned a new way to say hooray. [-shpongle]
address is scrambled - remove the superfluous "x" marks to reply
Re: [Dialog] help needed with scripts
Author: MLC
Date: Sun, 29 Feb 2004 11:20
Date: Sun, 29 Feb 2004 11:20
21 lines
2450 bytes
2450 bytes
sabato 28/feb/2004 _Barry Jones_ ha scritto: > I don't see how that will help. > > What are you doing with timer1? Could it be made available? If so, put a > sleep command in the OnStartup procedure between the two timer > initializations, with the same timer interval for both. Let timer 1 do > action 1 and timer 2 do action 2. If you used timer 1 for something else, > try to combine it with this use of the timer. Thanks, Barry, I've tried also your idea but there are still some problems: the main is that I need to run PostShow and MailShow also from the OnStartup event and the problem is still there , another is I'd be bound to have the mail check and the post check synchronized. Anyway you made me think to something I never thought before: thank you! :) -- Maria Luisa C - 29/02/04 12.11.39, here. Le FAQ italiane del newsreader 40tude Dialog http://fido.altervista.org/Dialog/faq.html http://www.lillathedog.net/dialog/faq.html
Re: [Dialog] help needed with scripts
Author: MLC
Date: Sun, 29 Feb 2004 11:24
Date: Sun, 29 Feb 2004 11:24
13 lines
2002 bytes
2002 bytes
sabato 28/feb/2004 _matija_ ha scritto: [many very useful ideas] > i hope this works as intended... I hope too: I'll study all that this afternoon. You're a mountain of great ideas: thanks!!! -- Maria Luisa C - 29/02/04 12.21.26, here. Le FAQ italiane del newsreader 40tude Dialog http://fido.altervista.org/Dialog/faq.html http://www.lillathedog.net/dialog/faq.html
Re: [Dialog] help needed with scripts
Author: MLC
Date: Sun, 29 Feb 2004 23:08
Date: Sun, 29 Feb 2004 23:08
75 lines
4165 bytes
4165 bytes
sabato 28/feb/2004 _matija_ ha scritto:
> timer1 (say, five minutes):
> - get new headers
> - set an atom to indicate that headers are downloaded (be sure to
> check if it exists first - if it does, delete it! remember what
> i said about atom dependencies, we don't want resource leaks...)
>
> timer2 (say, five seconds):
> - check progressbar position
> - if it's 0 and the atom exists, it means that dialog has finished
> downloading new headers, so...
> - call postShow and delete the atom within it to indicate that
> you have successfully shown your form
Hi matija,
I've done it, and Dialog dispite the atom (and the progress bar) keeps
triggering the code immediately. :(
I have:
procedure OnTimer1; (every 2 minutes)
begin
atomName := 'newArrivals';
myAtom := globalFindAtom(atomName);
if (myAtom <> 0) then
begin
//MessageBox (0, 'esiste (T1)', 'Info', $40); debugging
globalDeleteAtom(myAtom);
end;
ADo('GetNewHeadersInSubscribedGroups');
ADo('GetNewEmailsForAllIdentities');
myAtom := globalAddAtom(atomName);
end;
procedure OnTimer2; (every 20 seconds)
begin
dialogHWND := findDialogHWND;
statusBarHWND := findStatusBarHWND(dialogHWND);
progressBarHWND := findProgressBarHWND(statusBarHWND);
progressBarPosition := getProgressBarPosition(progressBarHWND);
atomName := 'newArrivals';
myAtom := globalFindAtom(atomName);
if((progressBarPosition)=0) and (myAtom <> 0) then
begin
//MessageBox (0, 'esiste (T2)', 'Info', $40); debugging
ADo('Script_PostShow');
ADo('Script_MailShow');
end;
end;
Then, at the end of my PostShow I have:
atomName := 'newArrivals';
myAtom := globalFindAtom(atomName);
if (myAtom <> 0) then globalDeleteAtom(myAtom);
I've also set Timer2 every 20 seconds instead of 5, hoping it could help,
but it doesn't.
There is also the problem that ADo('Script_MailShow') doesn't execute if it
is after ADo('Script_PostShow'). In my original version I had them
separated, one in Timer1, the other in Timer2. I can't imagine why they
cannot come one after the other, here. I tried them in a test script and
they come out well one after the other...
I think I'll give up. Maybe tomorrow I'll try to stop the flow with a
MessageBox. If you have other ideas, let me know! :)
--
Maria Luisa C - 29/02/04 23.57.07, here.
Le FAQ italiane del newsreader 40tude Dialog
http://fido.altervista.org/Dialog/faq.html
http://www.lillathedog.net/dialog/faq.html
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