Jump to content

Run and end script at specified time


Recommended Posts

  • Moderators

I want to run my script at 3 and end it at 5, but it isn't working. I thought that this would work because it has worked before.

If @HOUR = 3 Then
 ;Code here
Endif

If @HOUR = 5 Then
 Exit
Endif

Positive this is easy i've just gone blank.

Thanks.

MsgBox(64, 'Debug Hour', @Hour)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Fishing lessons? :-)

Figured it was PM for him where ever he was, and he would have seen why 3 wasn't working :).

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

I was wondering that.. too i thought it was 01-24.. so it returns 00 at 12 am.. huh :)

12 am is 00 yes. So it's 00 to 23 ... If you were asking.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

You might actually want to try this...

If @HOUR >= 16 AND @HOUR < 17 Then
     ;Code here
ElseIf @HOUR >= 17
     Exit
Endif

Might be more reliable if the script is started in-between 3 and 5.

Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
Link to comment
Share on other sites

  • Moderators

You might actually want to try this...

If @HOUR >= 16 AND @HOUR < 17 ThenoÝ÷ ØÈ ÖÞÞ­ébi¹^ûazÇ+b²ËZ®×vÞ·v§wêº^N¬Éèv'ßz·§¶ØZ«­¢+Ù%!½ÕÈôÄØQ¡
Because the hour isn't counting minutes and seconds.

Edit:

16 is 4:00 PM not 3:00 PM that would be 15.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Figured it was PM for him where ever he was, and he would have seen why 3 wasn't working :).

I just liked the lesson in how to debug code with a MsgBox... as opposed to - here is the code. Although that came later anyway.

For those that did not get it:

"Fishing lessons?" as in the saying:

Give a man a fish and...

but teach a man to fish and... lifetime.

...but maybe it should be:

Teach a man to debug code and he can just buy fish. :-)

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

"Give a man a fish, and he will eat for a day...

But teach a man to debug code and he will create an blockbuster 3d first-person shooter and make millions and buy a ferrari and a mansion in the Hamptons and his butler Bartholomew will cook fish for him so he will never go hungry..."

[u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia

Link to comment
Share on other sites

I always liked:

Build a man a fire and he's warm for a few hours...

Light a man on fire and he's warm for the rest of his life.

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

MsgBox? Fuxxake! What century are we in?

Surely you mean...

ConsoleWrite("debug: " & $string & @LF)

-mu

If all you had time for was a good one line post - ConsoleWrite would not be the one that I would pick.

I would not suggest ConsoleWrite unless:

I was sure that the OP was using an editor that could handle it

or

I was willing to stick around for the "ConsoleWrite does nothing" post

or

I was willing to take the time to point the OP to SciTE

and

explain a bit about the console...

(In this case, bucky002 does use SciTE - and if I knew that ahead of time, then I might suggest "Ctrl-Shift-D" over ConsoleWrite. It is just so quick to use "Ctrl-Shift-D" "Alt-F5".)

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Check.

Check.

and...

No way! It's crap.

As for you last part, WHAT?

I don't use SciTE, so that's all meaningless to me.

Allows you to see the output without halting the script, or something, does it?

Gotta be better than that archaic, amateur-hour MsgBox nonsense, anyway.

(mu checks)

It inserts a ConsoleWrite command. HAHAHAH!!!!

Very funny!

-mu

Link to comment
Share on other sites

Just to be clear:

I was speaking of the heavily customized version of SciTE SciTE4AutoIt3 and not the generic version.

Using this one line of code:

$data = "text"

then highlighting $data and pressing "Ctrl-Shift-D" creates a debug MsgBox, not a ConsoleWrite.

You can change what SciTE does when those keys are pressed:

http://www.autoitscript.com/forum/index.ph...indpost&p=64262

"amateur-hour"? - I resemble that remark :-)

@bucky002,

Sorry for the highjack of sorts. I hope you don't get an e-mail with each post to your thread.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...