[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

timed script

PeCoNe

10/5/2014 6:57:00 AM

i need to write a script which starts on 09:00 and stops on 17:40:00.
What is the best way to do this?
8 Answers

Evertjan.

10/5/2014 7:28:00 AM

0

PeCoNe <maljers@telfort.nl> wrote on 05 okt 2014 in comp.lang.javascript:

> i need to write a script which starts on 09:00 and stops on 17:40:00.
> What is the best way to do this?

0 [we programmers, like babies, start at zero]
I doubt you "need" to do that, perhaps you want to do that.
[Unless you were ordered to do that as school homework, in which case
we should not do it for you?]

1
The nonsense of asking for "the best". There is only such in one's private
opinion. Even the visual-appealing-ness of the source script could be part
of such assessment.

2
You cannot write a script that starts to be executed on a certain time by
the content of such script, as the script has to start before it knows what
time it is. Script execution has to be started by some form of external
action.

3
What do you really mean by a script that "stops"? A script is a peace of
text used as a sourcecode for/by an interpreting engine. Do you mean "stops
executing"?

4
Are you asking for a javascript script in a html-file in a browser?
That would be stretching it, because modern browsers will time out any
javascript script long before, within minutes. If not in a browser, please
state the platform.

Heb je ook een naam?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

JJ

10/5/2014 9:34:00 PM

0

On Sun, 05 Oct 2014 08:56:46 +0200, PeCoNe wrote:
> i need to write a script which starts on 09:00 and stops on 17:40:00.
> What is the best way to do this?

Assuming that you want this in a browser...

You can use a timer to start a script (i.e. execute a function) on 09:00.

But once the code is executed, it'll always run as fast as possible. It
can't be slowed down so that when it finishes, it would be on 17:40. This
applies to all programming languages in any platform. So, I'm pretty sure
this isn't what you meant.

Perhaps you want a code that's run periodically (e.g. every one second)
starting from 09:00 and until 17:40. If this is what you meant, then have
the function that's periodically executed to check the current time. If it's
17:40 or later, stop the timer. One thing that's important is that the
function must always return as soon as possible. Otherwise, the browser
would lag.

Thomas 'PointedEars' Lahn

10/6/2014 12:03:00 AM

0

Evertjan. wrote:

> PeCoNe <maljers@telfort.nl> wrote on 05 okt 2014 in comp.lang.javascript:
> [â?¦]
> Heb je ook een naam?

Heb *je*?

You don't post with your real name either. Pot calling the kettle black.

And omit the attribution novel next time, please.

--
PointedEars
FAQ: <http://PointedEars.... | SVN: <http://PointedEars.de...
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-...
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Evertjan.

10/6/2014 7:45:00 AM

0

Thomas 'PointedEars' Lahn <PointedEars@web.de> wrote on 06 okt 2014 in
comp.lang.javascript:

> Evertjan. wrote:
>
>> PeCoNe <maljers@telfort.nl> wrote on 05 okt 2014 in comp.lang.javascript:
>> [â?¦]
>> Heb je ook een naam?
>
> Heb *je*?

Yes?

> You don't post with your real name either. Pot calling the kettle black.

I am not 'calling'.

Don't pretend to know Dutch, obviously you don't.

> And omit the attribution novel next time, please.

I post with my real name, Pointy,
and have done so long before you even new usenet.

Dont't play the smartass.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Thomas 'PointedEars' Lahn

10/6/2014 11:23:00 AM

0

Evertjan. wrote:

> Thomas 'PointedEars' Lahn [â?¦]:
>> Evertjan. wrote:
>>> PeCoNe <maljers@telfort.nl> wrote on 05 okt 2014 in
>>> comp.lang.javascript:
>>> [â?¦]
>>> Heb je ook een naam?
>> Heb *je*?
>
> Yes?

I asked a question. The proper response to that is not a question.

>> You don't post with your real name either. Pot calling the kettle black.
>
> I am not 'calling'.

â??The pot calling the kettle blackâ?? is an English idiom for hypocrisy:
criticizing something that others do but that you do yourself. See also
<https://en.wikipedia.org/wiki/The_pot_calling_the_kettle....

> Don't pretend to know Dutch, obviously you don't.
>
>> And omit the attribution novel next time, please.
>
> I post with my real name, Pointy,
> and have done so long before you even new usenet.

â??Evertjan.â?, the only non-address part of the From header field of your
postings is _not_ your real name. It cannot be. Your real name might be
â??Jan Evertâ?, but you are _not_ posting under that name.

Why you would claim the opposite as response to my statement above, which
has nothing to do with your name, remains a mystery.

> Dont't play the smartass.
^^^
Don't pretend you know English, obviously you don't.

--
PointedEars
FAQ: <http://PointedEars.... | SVN: <http://PointedEars.de...
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-...
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Evertjan.

10/6/2014 11:50:00 AM

0

Thomas 'PointedEars' Lahn <PointedEars@web.de> wrote on 06 okt 2014 in
comp.lang.javascript:

> Evertjan. wrote:
>
>> Thomas 'PointedEars' Lahn [? Ý]:
>>> Evertjan. wrote:
>>>> PeCoNe <maljers@telfort.nl> wrote on 05 okt 2014 in
>>>> comp.lang.javascript:
>>>> Heb je ook een naam?
>>> Heb *je*?
>>
>> Yes?
>
> I asked a question. The proper response to that is not a question.

You yourself responded with a Q on a Q!

And why should a response be "proper"?

Methinks you are still demonized by childhood indoctrination?

Go and play somewhere else.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Thomas 'PointedEars' Lahn

10/6/2014 12:54:00 PM

0

Evertjan. wrote:

> Thomas 'PointedEars' Lahn [â?¦]:
>> Evertjan. wrote:
>>> Thomas 'PointedEars' Lahn [� �]:
>>>> Evertjan. wrote:
>>>>> PeCoNe <maljers@telfort.nl> wrote on 05 okt 2014 in
>>>>> comp.lang.javascript:
>>>>> Heb je ook een naam?
>>>> Heb *je*?
>>> Yes?
>> I asked a question. The proper response to that is not a question.
>
> You yourself responded with a Q on a Q!

There is a subtle difference: The question was not posed to me, and my
response was a rhetorical question.

> And why should a response be "proper"?

You can fool someone else.

> Methinks you are still demonized by childhood indoctrination?

You must be projecting.

> Go and play somewhere else.

Yes, please do that.

--
PointedEars
FAQ: <http://PointedEars.... | SVN: <http://PointedEars.de...
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-...
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Michael Haufe (\"TNO\")

10/12/2014 9:23:00 PM

0

On Sunday, October 5, 2014 1:56:58 AM UTC-5, PeCoNe wrote:
> i need to write a script which starts on 09:00 and stops on 17:40:00.
>
> What is the best way to do this?

That will depend on where you plan to have the JavaScript executing. In a browser? On a server (ASP, Node, other)? On a Window's machine through WSH? Somewhere else?