Article View: news.software.readers
Article #144266Re: [Dialog] help needed with scripts
From: 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
Technical Details
Message-ID:
<1nhd691vntmkh$.dlg@shpongle.604>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!intern1.nntp.aus1.giganews.com!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.r-kom.de!fu-berlin.de!CARNet.hr!not-for-mailReferences:
<1mops9bm8bjs5.dlg@ID-187316.user.uni-berlin.de> <16n122oojxuel$.dlg@shpongle.604> <nyglx8d9lyfk$.dlg@ID-187316.user.uni-berlin.de> <1140be4el222s$.dlg@shpongle.604> <h7ndcuuku3ty.dlg@ID-187316.user.uni-berlin.de>Show Full Headers
Complete Article Headers
Message-ID: <1nhd691vntmkh$.dlg@shpongle.604> Subject: Re: [Dialog] help needed with scripts Date: Sat, 28 Feb 2004 19:07:03 +0100 From: matija <xmkrnicx@xpublicx.xsrcex.hr> References: <1mops9bm8bjs5.dlg@ID-187316.user.uni-berlin.de> <16n122oojxuel$.dlg@shpongle.604> <nyglx8d9lyfk$.dlg@ID-187316.user.uni-berlin.de> <1140be4el222s$.dlg@shpongle.604> <h7ndcuuku3ty.dlg@ID-187316.user.uni-berlin.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.20140922.mbox.gz!intern1.nntp.aus1.giganews.com!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.r-kom.de!fu-berlin.de!CARNet.hr!not-for-mail Newsgroups: news.software.readers Organization: 604 Lines: 136 NNTP-Posting-Host: cmung208.cmu.carnet.hr Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: bagan.srce.hr 1077991623 116 193.198.128.208 (28 Feb 2004 18:07:03 GMT) X-Complaints-To: abuse@carnet.hr NNTP-Posting-Date: Sat, 28 Feb 2004 18:07:03 +0000 (UTC) User-Agent: 40tude_Dialog/2.0.9.1hr (33e02558.479.103) X-Afraid-Of: spiders X-Face: "wB!^cgWZ=; q%#:6lkzMWJ-O*>}<FSIu#HEqp5P2E#=mTGgQ-\^YM|Vt(j_|:*GI8?,7A9Z mkgCj|$f)nB@*>(B14sXotbL/"G.Z0u$]5\GcxnO4')%FUE\48H!!$rCLV.` X-Mastered: the art of pizza making X-Searching-For: GMT soundtrack (guy sigsworth)