Jump to content

Date restriction not working here. Script runs every


Recommended Posts

Oh, my Gawd! <g> Now _that_ is something far out. I can't make much heads or tails of it, but I'll definitely take you word for the fact that it works!

<phew> I just have to hope that all I need to do is change the numbers because I won't be good for much else <lol>.

Thanks! I know this must have taken a whole lot of time and effort. I sure couldn't have come up anything close to the above.

There is, unfortunately, one horrible thing, I just realized. There is some func code in here <sigh>. As I mentioned in post #5 (http://www.autoitscript.com/forum/index.php?s=&showtopic=72627&view=findpost&p=529974) and you later responded to in post #7 (http://www.autoitscript.com/forum/index.php?showtopic=72627&st=0&p=530058&#entry530058) where you said: "You could still use the second method even without calling a function.", what do we do now??? I can tell you from experience that func code will cost me no end of trouble because the original versions of day/time restriction codes didn't work about on average 85% of the time because of that.

Here's an earlier yet simpler yet much more cumberson first version of code that I've not posted in this thread before. I had to hunt down some earlier backups of my scheduler. It's _great_ stuff and much, much better than nothing, but I found it so difficult to work with even with all the prompting even with all the commented-out lines I put in!:

;
; AutoIt v3.0
;
#include <Date.au3>
#NoTrayIcon     ; AutoIt's icon doesn't show in systray


;==========================================================================================
;  Set the time frame for the reminder ... You can then set the reminder itself to come on _if_ missed, but it will
;  only do so if in the morning.
$StartTime = "04:30"     ;  adjust START time here in 24-hour time
$EndTime = "11:00"     ;  adjust END time here in 24-hour time
$CurrentTime = _NowTime(4)

If $CurrentTime >= $StartTime AND $CurrentTime <= $EndTime Then YourCodeHere()     ;  YourCodeHere calls a function
;==========================================================================================




;==========================================================================================
Func YourCodeHere()     ;  Your script goes here below ...
;==========================================================================================
; YourCODEbelow ... YourCODEbelow ... YourCODEbelow ... YourCODEbelow ... YourCODEbelow ...


If Not ProcessExists("MP3_RADIO.exe") Then Run("M:\clock, MP3Radio\APP- MP3 Radio (actually installed)\MP3_RADIO.exe", @TempDir, @SW_SHOW)


; YourCODEabove ... YourCODEabove ... YourCODEabove ... YourCODEabove ... YourCODEabove ...
;==========================================================================================
EndFunc     ; end of your code.
;==========================================================================================

Exit
; finishedoÝ÷ Ø*&¥ªÞ¶­¶ayË«­éí½êìȺÇzZ0¶­i×l¶n)b·+h­ë-®'-¶¡×¡z·­¡©òÁç¤u¬¬"wvÊ"·lÞr©ìm©íæ¢÷²zج汩ݲ.׫y«"z»hºÇºÚ"µÍÓÕ^RXÛÛÈ]]Ò] ÌÎNÜÈXÛÛÙÛÌÎNÝÚÝÈ[ÞÝ^BÚ[ÛYH   Ñ]K]LÉÝÂÌÍÔÝ[YHH    ][ÝÌÌ    ][ÝÈÈYÝÕT[YHH[ZÝ[YBÌÍÑ[[YHH    ][ÝÌLN    ][ÝÈÈYÝS[YHH[ZÝ[YBÌÍÐÝ[[YHHÓÝÕ[YJ
BÝÚ]ÚÑVHÈÝ^ÈØÜ[ÝÙYÈ[
[ÝÜÈÜ][H^È[ÝÙYÝ[ÛÛ[Y[ ÌÎNÎÉÌÎNÈØÙH[JBÈHSH   ][ÝÐØÙI][ÝÈSÕÈUÑTÈÓÕÈUHH   ][ÝÎÉ][ÝÈSÓÒSHSÕÑQNÈHSÔHSÓHVHÐSH   ÌÎNÕSÓÓSQSQ    ÌÎNËHSSÕSÈH    ][ÝÎÉ][ÝÈSÓ   ÌÌÎÂNÈHKK^JÊHÚÝÛÚ]    ][ÝÐØÙHÉ][ÝÈ[ÝÙYKH^JÊHÚÝÛÚ]   ][ÝÎÐØÙHÉ][ÝËÚ]Ù[ZKXÛÛÛ[ÛÕ[ÝÙYPØÙHHÈÝ[^BÂPØÙHÈ[Û^BÈØÙHÈÈYÙ^BÈØÙH
ÈÙYÙ^BÈØÙH
HÈÙ^BÈØÙH
ÈY^BPØÙH
ÈÈØ]^HBPØÙH[ÙHÈ[H^HÝÝY[ØÙHÝXÝBBBNÉÌÎNÑYT[ÙIÌÎNÈ[YBBQ^][ÝÚ]ÚYÝ
    ÌÍÐÝ[[YH    ÝÏH   ÌÍÔÝ[YHS    ÌÍÐÝ[[YH    ÏH ÌÍÑ[[YJH[ÈÛÛ][ÛÈÝY]HÛÈ]  ÌÎNÜÈÝH[Y]H    [È[YHÜØÜÈ[ÈYÜK^]Ú]Ý]ÛÛ[Z[Ë^][YÈOOOOOOOOOH^HØÜÝÛ[ÝÎOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOBÌÍÕÔ][ÛHÝ[ÓY
ØÜBYÝØÙÜÑ^ÝÊ   ][ÝÔØ^U[YNMK^I][ÝÊH[[  ÌÍÕÔ][Û    [È ][ÝÉÌLÐÓÐÒÉÌLØÛØÚÔÜYXÚØ^U[YHMH
IÌLÐTHØ^U[YHMH
IÌLÔØ^U[YNMK^I][ÝË ][ÝÉ][ÝËÕ×ÒQJBÛY
ML
BYÝØÙÜÑ^ÝÊ   ][ÝÓT×ÔQSË^I][ÝÊH[[  ÌÍÕÔ][Û    [È ][ÝÉÌLÐÓÐÒÉÌLØÛØÚËTÔY[ÉÌLÐTHTÈY[È
XÝX[H[Ý[Y
IÌLÓT×ÔQSË^I][ÝË[Õ×ÔÒÕÊB^]È[ÚY

They both are geared to do basically the same thing yet what a difference! ??? What to do???

Thanks bunches!! I'll understand if you throw up your hands in disgust with me <g>, but I do know what I know and the above example with no tons of GUI code with func in them, etc., and is calling a very simple app to launch. Some of the other scripts get very complex where any extra func command throws it off.

Cheers. :)

Link to comment
Share on other sites

Hmmmmm.

Don't see where the functions will throw anything off if you #include the file I PMd you.

You can just use it instead of <Date.au3> which isn't required with those functions.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

  • 1 month later...

Edit; I should have also pointed out that _NowTime(4) returns a string and you can not perform math operations on it because of the colon.

Well, since you insist on having that colon in there, and we can't perform math on it...

Sorry to dig up an old thread, but I think I need to correct some points here.

True, you can't do extensive maths on strings, but you can do simple <,>,<=,>= checks. For example:

$Now = "12:30"

$StartTime = "12:00"
$EndTime = "14:00"

If $Now >= $StartTime And $Now <= $EndTime Then MsgBox(0,"","Time is within range!")oÝ÷ ÚÚòr§)àÓ~£hmê.¶ÈzíêÚÊ,¢g¨~Ø^{¦¦W¬¦-^­æ«xdNI*/(bq«b¢{(&zØbÞ¯+Þ¯+"^N¬Ì!jܳ§µçjº^©oÝ÷ ÙW«ÊȦ¦W­¢éÝz»-jw]¡ë'ßÛn±çîËb¢{¡ë'ßÛn±è§r[zÀ%²Ê°j{m¢Ê^r'òqêíj)ìu¬¬¡ûa{Ú+ºw v趻§¢t·ô®«­¢+Øì´´´MÉ¥ÁÐÍ¡½Õ±½¹±äÉÕ¸¥ÑݸѡÍÑ¥µÌ¡¡ éµ´¤´´´(ÀÌØíMÑÉÑQ¥µôÅÕ½ÐìÀØèÀÀÅÕ½Ðì(ÀÌØí¹Q¥µôÅÕ½ÐìÈÌèÔäÅÕ½ÐìíÑ¡¥ÌµÕÍбÑÈ¥¸Ñ¡M5䡤¹¸¼¹½ÐÕÍÀÀèÀÀ¤((ì´´´MÉ¥ÁÐÍ¡½Õ±½¹±äÉÕ¸ÑݸѡÍÑÌ¡54½¤´´´(ÀÌØíMÑÉÑÑôÅÕ½ÐìÄȼÀÄÅÕ½Ðì(ÀÌØí¹ÑôÅÕ½ÐìÄȼÈÔÅÕ½Ðì((ì´´´MÉ¥ÁÐÍ¡½Õ±½¹±äÉÕ¸½¸Ñ¡ÍåÌ´´´(ÀÌØíåÌô ÅÕ½ÐìİȰ̰а԰ذÜÅÕ½Ðì¤ìÄõÍÕ¹ä°Èõµ½¹ä°ÌõÑÕÍäѡɵ½Ù̹¤((ì´´´MÐÕÉɹÐѽѥµ´´´(ÀÌØí9½ÝQ¥µô!=UHµÀìÅÕ½ÐìèÅÕ½ÐìµÀì5%8(ÀÌØí9½ÝÑô5=8µÀìÅÕ½Ðì¼ÅÕ½ÐìµÀì5d((ì´´´
¡¬½¹¥Ñ¥½¹ÌÉÉ¥¡Ð´´´)%9½Ð ÀÌØí9½ÝQ¥µÐìôÀÌØíMÑÉÑQ¥µ¹ÀÌØí9½ÝQ¥µ±ÐìôÀÌØí¹Q¥µ¤Q¡¸á¥Ð)%9½Ð ÀÌØí9½ÝÑÐìôÀÌØíMÑÉÑѹÀÌØí9½ÝѱÐìôÀÌØí¹Ñ¤Q¡¸á¥Ð)%MÑÉ¥¹%¹MÑÈ ÀÌØíå̱]d¤ôÀQ¡¸á¥Ð((ìôôôôôôô5dM
I%AP    1=ôôôôôôôôô

...change $Days = ("1,2,3,4,5,6,7") to $Days = ("2,3,4,5,6") to prevent running at the weekend.

- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!
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...