PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WEBDEV 2024 → automatic procedure mechanism (WebDev11)
automatic procedure mechanism (WebDev11)
Débuté par Gerd Nossing, 30 juin 2008 01:47 - 4 réponses
Posté le 30 juin 2008 - 01:47
I try to use the automatic procedure mechanism, but I find no way to set the parameters 'Time between calls' or 'Delayed to'. Both stay greyed all the time.
I try to start a background thread on the server that runs once a day 1 minute after midnight. A simple IF-statement like 'IF Now()="00010000" THEN' doesn't work (btw the CPU-load is 100%) and I can't see what's wrong. I tried EVENTWAIT, THREADWAIT etc. into the procedure but this doesn't help either. Has someone an idee what's wrong?
TIA, Gerd
Posté le 07 juillet 2008 - 16:41
Hi Gerd...

A webdev code is not able to do this kind of things, as it runs in a
user session (started by a user connecting to the web site via a
browser/url) that will be ended automatically via the webdev server time
out mechanism...

But you can implement that in a Windev program that will stay awake on
the servere (or even on one of you distant computer and will run a
special url request vis httprequest at your specified time)... All this
can be done using the 'timer' instruction

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com


Gerd Nossing wrote:
I try to use the automatic procedure mechanism, but I find no way to set the parameters 'Time between calls' or 'Delayed to'. Both stay greyed all the time.
I try to start a background thread on the server that runs once a day 1 minute after midnight. A simple IF-statement like 'IF Now()="00010000" THEN' doesn't work (btw the CPU-load is 100%) and I can't see what's wrong. I tried EVENTWAIT, THREADWAIT etc. into the procedure but this doesn't help either. Has someone an idee what's wrong?
TIA, Gerd
Posté le 07 juillet 2008 - 18:33
Hi Fabrice,
Thank you for answering mij questions! I just realize, as you mention, everthing that is happening on the server is started by userrequests and will eventually timeout.
Because I bought WebDev as a private person (from my own money) I haven't bought WinDev as well yet (until now I developed my programs in Clarion). So I can't use the suggested solution.
As an alternative I look at this moment into the Windows API. I found there the possibility to start a timer (SetTimer) that can start a procedure at intervals. Because I'm not familiar with the use of the Windows API in WebDev I wonder wether someone at PCSoft has more experience with this subject. Maybe an example how to work with it. Or do I try to do something impossible?
B.t.w., can I use other Window API-calls as the one which are mentioned in the list of Windows API help?
TIA, Gerd
Posté le 08 juillet 2008 - 11:40
Hi Gerd...

About the api call... You can certainly call the api from some webdev
server code, but I don't know (in fact I don't believe that) if the
timer will survive the closing of the calling process (which is once
again the webdev user session which started it)

Another possibility, as you don't have windev, is to create a webdev awp
page in charge of doing what you need to do... Then either on the server
itself (if it's an in house or dedicated server) or on a secondary
machine you will set up a windows task called everyday at the desired
time and simply calling the url of your awp page... That should do the trick

best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com


Gerd Nossing wrote:
Hi Fabrice,
Thank you for answering mij questions! I just realize, as you mention, everthing that is happening on the server is started by userrequests and will eventually timeout.
Because I bought WebDev as a private person (from my own money) I haven't bought WinDev as well yet (until now I developed my programs in Clarion). So I can't use the suggested solution.
As an alternative I look at this moment into the Windows API. I found there the possibility to start a timer (SetTimer) that can start a procedure at intervals. Because I'm not familiar with the use of the Windows API in WebDev I wonder wether someone at PCSoft has more experience with this subject. Maybe an example how to work with it. Or do I try to do something impossible?
B.t.w., can I use other Window API-calls as the one which are mentioned in the list of Windows API help?
TIA, Gerd
Posté le 08 juillet 2008 - 13:17
Thank you very much Fabrice! Yes, you are right, the end of the thread will stop the timer too! I read it, but I still have problems to realize, that there is no application running on the server, only a task that runs for a brief moment to answer a request.
I will follow your advice and run an application on the server (my own one) that issues http-requests every minute or so. This will start a procedure that determines what to do at a given moment in time.

Thank you again Fabrice!
Gerd