Thread View: news.software.readers
1 messages
1 total messages
Started by Winston
Sat, 02 Apr 2005 09:38
[Dialog] Dialup scripting
Author: Winston
Date: Sat, 02 Apr 2005 09:38
Date: Sat, 02 Apr 2005 09:38
79 lines
3478 bytes
3478 bytes
The Dialog scripting section in the wiki contains a useful script to
automate dialup connection.
It looks like this (with some small changes)
Program DialUp;
uses Forms;
{$I zRas}
var myProvider, myUsername, myPassword: String;
connection: LongWord;
dialedByScript: Boolean;
Begin
// dial-up parameters
myProvider := 'Xtra';
myUsername := 'pjd48';
myPassword := 'heref0rd';
// check, if already connected
dialedByScript := False;
connection := RasGetConnection();
if connection = 0 then begin
// no connection, so script dials up now
dialedByScript := True;
writeToLog('Connecting to ' + myProvider + '...',1);
connection := RasDial( myProvider, myUsername, myPassword );
if connection = 0 then begin
writeToLog( 'Dialing failed! Error: '
+ RasErrorText(RasLastError),1);
exit;
end
else begin
writeToLog('Connected to ' + myProvider,1);
end;
end;
// transfer data
ADo('OnlineMode');
ADo('SendAllInOutbox');
ADo('GetNewHeadersInSubscribedGroups');
ADo('GetNewEmailsForAllIdentities');
ADo('GetMarkedMessageBodies');
// hangup, if script has dialed
//Only when we have gone offline
(*
while (AChecked('OnlineMode') = true) do begin
Sleep(0);
end;
if dialedByScript then begin
writeToLog('Disconnecting from ' + myProvider,1);
RasHangup( connection );
end;
*)
End.
The commented out bit at the end is because the default of executing the
last few lines doesn't work properly (if dialedByScript...
Apparently because the commands are executed asynchronously
The waiting until OnlineMode goes off works fine in the scripting windows
but if the script is run from Dialog it makes Dialog hang
Sleep is the only thing actually available to use
Application.Processmessages which Delphi programmers would use is not
available here
In any case OnlineMode never goes off by itself
The user has to tell the application to go offline
What I need is some foolproof way of discovering that Dialog has
disconnected from the server and then being able to effect an automatic
disconnection of the connectoid. I don't see a way to do it with the built
in functions of the Pascal scripting except for that shown above - which
doesn't work
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