Diana (Cda) Posted November 23, 2007 Share Posted November 23, 2007 (edited) Is there a process where if we have a script scheduled to run, that AI will only run it, say, on Fridays between 3:00-5:00 p.m.? In other words, I could have my scheduler launch the script every day at 3:00 p.m., but AI would only run it on Fridays. Can this be done? Edited December 15, 2007 by Diana (Cda) Link to comment Share on other sites More sharing options...
ame1011 Posted November 23, 2007 Share Posted November 23, 2007 Is there a process where if we have a script scheduled to run, that AI will only run it, say, on Fridays between 3:00-5:00 p.m.? In other words, I could have my scheduler launch the script every day at 3:00 p.m., but AI would only run it on Fridays. Can this be done? if @WDAY = 6 then ;run script endif [font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font] Link to comment Share on other sites More sharing options...
John117 Posted November 23, 2007 Share Posted November 23, 2007 you could use the included windows scheduled Task Wizard. ->Select weekly-> Friday->Time is this not an option for you? Link to comment Share on other sites More sharing options...
Diana (Cda) Posted November 23, 2007 Author Share Posted November 23, 2007 if @WDAY = 6 then ;run script endifThat's great. I'll give this a try. That takes care of the day; but what can I do re defining the time. I'd like to set up a generic scheduler option in my standalone scheduler on my USB flash drive, and have AI determine the date/time on whether to run or not. This will save me hassles as I'd just re-use the code on the scheduler over and over. It also doesn't do time limits at all, so AI would be great for this. Thanks. Link to comment Share on other sites More sharing options...
Diana (Cda) Posted November 23, 2007 Author Share Posted November 23, 2007 you could use the included windows scheduled Task Wizard. ->Select weekly-> Friday->Timeis this not an option for you?Oh, no. Sorry, should have mentioned. It's because the scheduler is one I run off my flash drive so that I'm not dependent on any given host computer.Thanks. Link to comment Share on other sites More sharing options...
Diana (Cda) Posted November 26, 2007 Author Share Posted November 26, 2007 Is there nothing that can determine the time? How can we add that to this:if @WDAY = 6 then ;run script endifI'm assuming that this runs only on day 6 (that would be Saturday??); but how to say, "also only between, say, 8:00 a.m. and 11:30 a.m.", etc.? Thanks. Link to comment Share on other sites More sharing options...
rasim Posted November 26, 2007 Share Posted November 26, 2007 Is there nothing that can determine the time? How can we add that to this:if @WDAY = 6 then ;run script endifoÝ÷ Øý«,ºh§ØZ¶Øb²»§²åÊÝk.«p¢é]mä¶êÝk&î¶0¶Ê«¨µ©l¢åÉ·Á秱¬¼ÓF¦jwu×}«¨µëN§Ïêº^jëh×6#include <Date.au3> If @WDAY = 6 And _NowTime(4) = "8:00" Then ;Run script EndIf Link to comment Share on other sites More sharing options...
ame1011 Posted November 26, 2007 Share Posted November 26, 2007 (edited) @SEC Seconds value of clock. Range is 00 to 59 @MIN Minutes value of clock. Range is 00 to 59 @HOUR Hours value of clock in 24-hour format. Range is 00 to 23 @MDAY Current day of month. Range is 01 to 31 @MON Current month. Range is 01 to 12 @YEAR Current four-digit year @WDAY Numeric day of week. Range is 1 to 7 which corresponds to Sunday through Saturday. @YDAY Current day of year. Range is 1 to 366 (or 365 if not a leap year) From the helpfile listed under 'Macro Reference'. 6 is friday not saturday. if @WDAY = 6 AND @HOUR = 06 AND @MIN = 30 then ;run script endif Edited November 26, 2007 by ame1011 [font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font] Link to comment Share on other sites More sharing options...
Diana (Cda) Posted November 26, 2007 Author Share Posted November 26, 2007 Very kewl. We're getting close. At least both examples now have some sort of start time! <lol> This one will run at 06h30 (a.m.), it seems (?): if @WDAY = 6 AND @HOUR = 06 AND @MIN = 30 then ;run script endif However, is there anything that runs specifically between certain, designated specific times? Yes on a particular day but between certain set hours, too? That way I could set the simple scheduler that I have, since it's very limited, to run every x number of hours every day but it would actually be controlled by AI so that it will in actuality run only on certain days betwen set hours. I have found this the best scheduler that I've tried to date for various reasons, but need to fine-tune it with AI. Is there a process where if we have a script scheduled to run, that AI will only run it, say, on Fridays between 3:00-5:00 p.m.? In other words, I could have my scheduler launch the script every day at 3:00 p.m., but AI would only run it on Fridays.I'm assuming that this runs only on day 6 (that would be Saturday??); but how to say, "also only between, say, 8:00 a.m. and 11:30 a.m.", etc.?Between 8:00 a.m. and 11:30 a.m. I said initially, then changed to 3:00-5:00 p.m., but the idea is the same in both cases. Thanks! Link to comment Share on other sites More sharing options...
John117 Posted November 27, 2007 Share Posted November 27, 2007 looking at this earlier I could see that was going to be a problem. 8-1130 and 3-5 are totally different approaches. At least that I can think of. Here is 3-5 untested. if @WDAY = 6 AND @HOUR => 15 Then if @HOUR =< 17 Then ;run script endif endif If I tried that with and minute = 30 it would not run unless it was 330, 430, or 530. Link to comment Share on other sites More sharing options...
Diana (Cda) Posted November 27, 2007 Author Share Posted November 27, 2007 looking at this earlier I could see that was going to be a problem. 8-1130 and 3-5 are totally different approaches. At least that I can think of. Here is 3-5 untested. if @WDAY = 6 AND @HOUR => 15 Then if @HOUR =< 17 Then ;run script endif endif If I tried that with and minute = 30 it would not run unless it was 330, 430, or 530.Ah, I understand. I don't usually think of this problem as I deal with a 24-hour clock myself all the time but always just automatically "translate" when speaking with other people, as I did here. My mistake. I see that you've used the 24-hour clock here, too (15 instead of 3:00 p.m., 17 instead of 5 p.m.). Though I wrote 08:00 a.m. - 5:00 p.m., as an example in my initial post, in actuality I would ordinarily deal with: 08h00 - 17h00. Is there no way to include minutes in a way that they will be taken into consideration by AI? i.e., instead of thinking 3:30 p.m., wouldn't the same 15h30 (or, of course, instead of this French-style 24-hour, using a more standard 15:30) make for a solution if it were coded in such a way that AI understood it was time? I know that in Excel, for example, one must give Excel numbers for time differently than numbers for numerical calculations. Link to comment Share on other sites More sharing options...
GEOSoft Posted November 27, 2007 Share Posted November 27, 2007 Ah, I understand. I don't usually think of this problem as I deal with a 24-hour clock myself all the time but always just automatically "translate" when speaking with other people, as I did here. My mistake. I see that you've used the 24-hour clock here, too (15 instead of 3:00 p.m., 17 instead of 5 p.m.). Though I wrote 08:00 a.m. - 5:00 p.m., as an example in my initial post, in actuality I would ordinarily deal with: 08h00 - 17h00. Is there no way to include minutes in a way that they will be taken into consideration by AI? i.e., instead of thinking 3:30 p.m., wouldn't the same 15h30 (or, of course, instead of this French-style 24-hour, using a more standard 15:30) make for a solution if it were coded in such a way that AI understood it was time? I know that in Excel, for example, one must give Excel numbers for time differently than numbers for numerical calculations.If @Wday = 6 Then If (@Hour >= 8 AND @Hour <= 17) AND @Minute >= 30 Then _DoFunction()EndIf 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 More sharing options...
John117 Posted November 27, 2007 Share Posted November 27, 2007 @Geo Will this run at 8-829 9-929 10-1029 11-1129 12-1229 . . . ? Link to comment Share on other sites More sharing options...
John117 Posted November 27, 2007 Share Posted November 27, 2007 (edited) This one is working. Its a little longer than I would have liked #include <Date.au3> $StartTime = "08:00" $EndTime = "17:30" $CurrentTime = _NowTime(4) If @WDAY = 3 Then ;Three is tuesday If $CurrentTime >= $StartTime AND $CurrentTime <= $EndTime Then YourCodeHere() ;YourCodeHere calls a function EndIf Func YourCodeHere() ;Add what ever here. -Maybe a message then an exit MsgBox(4096, "Working!", "This box will time out in 5 seconds", 5) ;Exit EndFunc ;==>YourCodeHere Now to get it to not run unless it is that time you will need to just change the signs up in the formula. maybe <<>, -Less than not equal to start time ><> -Greater than not equal to end time *not taking any credit here since I just took everyone else's work and put it together Edited November 27, 2007 by Hatcheda Link to comment Share on other sites More sharing options...
Diana (Cda) Posted November 27, 2007 Author Share Posted November 27, 2007 This one is working. Its a little longer than I would have liked #include <Date.au3> $StartTime = "08:00" $EndTime = "17:30" $CurrentTime = _NowTime(4) If @WDAY = 3 Then ;Three is tuesday If $CurrentTime >= $StartTime AND $CurrentTime <= $EndTime Then YourCodeHere() ;YourCodeHere calls a function EndIf Func YourCodeHere() ;Add what ever here. -Maybe a message then an exit MsgBox(4096, "Working!", "This box will time out in 5 seconds", 5) ;Exit EndFunc ;==>YourCodeHere Now to get it to not run unless it is that time you will need to just change the signs up in the formula. maybe <<>, -Less than not equal to start time ><> -Greater than not equal to end time *not taking any credit here since I just took everyone else's work and put it together Wow, thanks! I'll try it out tonight when I get home. Re the concern on when not to run, well, that's where the scheduler itself comes in. The idea is to have it launch this however well the scheduler can manage it. I can only get limited scheduling customizability -- I can run things either every x numbers of units (hours, minutes, days, weeks, etc.) or every unit at such an hour (every day, every friday, every week), etc. I cannot get this scheduler, or any other, to run every, say, 2 hours between 10:00 a.m. to 2:00 p.m. on Saturdays, never mind deal with the relative paths necessary for a USB flash drive! Believe it or not, this type of time scenario is something I actually need. How I've gotten around this at home is to live with what I can do, and that means that unfortunately, the reminder that is just a voice message one goes on every 2 hours all day from midnight Friday night till 11:59 p.m. Saturday evening, which is a *$%#@ pain in the patootie! <g> While these reminders, for Saturday chores, are alright to live with at home, not the case with office applications. The requirements are slightly different for a couple of reminders here, but I'll use this same idea above of setting the limits of day and time via AI and have the scheduler launch it at set intervals every day, etc. The scheduler might launch the AI reminder, but AI will determine if the parameters are met for the script to actually run! Very kewl. I know it probably sounds complicated, but field work forces solutions to situations and this situation is one that has needed a resolution for a long, long time. So it's a win-win situation. I have a scheduler and AI techniques that allow it to successfully run off of a USB flash drive without the worry of absolute paths, yet with complete functionality and now no limits as to what I need re the combination of days/time to run thanks to AI. However, next step is to test this out. It may need some work still for all I know <g>. Thanks much! Link to comment Share on other sites More sharing options...
Diana (Cda) Posted November 28, 2007 Author Share Posted November 28, 2007 Brilliant! Tested it this morning and it works so far like a charm! I just added some prompting text, etc., to make it easier for me to remember what to do/change in future uses. #include <Date.au3> $StartTime = "06:50" ; adjust START time here in 24-hour time $EndTime = "06:56" ; adjust END time here in 24-hour time $CurrentTime = _NowTime(4) If @WDAY = 4 Then ; Choose 1 = Sunday // 2 = Monday // 3 = Tuesday // 4 = Wednesday // 5 = Thursday // 6 = Friday // 7 = Saturday. If $CurrentTime >= $StartTime AND $CurrentTime <= $EndTime Then YourCodeHere() ; YourCodeHere calls a function EndIf ;========================================================================================== Func YourCodeHere() ; Your script goes here below ... ;========================================================================================== ; YourCODEbelow ... YourCODEbelow ... YourCODEbelow ... YourCODEbelow ... YourCODEbelow ... MsgBox(4096, "Working!", "This box will time out in 5 seconds", 5) ; YourCODEabove ... YourCODEabove ... YourCODEabove ... YourCODEabove ... YourCODEabove ... ;========================================================================================== EndFunc ; end of your code. ;==========================================================================================I have a terrible memory, so it helps to have as many prompts within the script as possible. <g> Thanks!! Will be implementing this script over the next few days in various scheduling tasks. Link to comment Share on other sites More sharing options...
Diana (Cda) Posted December 14, 2007 Author Share Posted December 14, 2007 'kay, this one was a toughie. I even started a new thread when I'd found that a lot of my scripts that I wanted to use this with, had FUNC in them as well. I later learned that one can't nest FUNC codes together! <g> So the struggle with this continued. The above code works perfectly when there is no other "function" syntax to worry about. It might all seem obvious to all of you guys who are so good at this, but scripting even after all these years is often just a jumble of words that one can only half understand. But I wasn't getting any results and searches and searches didn't reveal anything. But I came back to this thread to look at it again and got a glimmer of some understanding that after trying and really playing around with, I think I've managed to get it to work! This is big for me as it's a tiny breakthrough of sorts <lol>. The above I'll use a lot, but when there is a FUNC error, then I can use this below:#include <Date.au3> $StartTime = "15:30" ; adjust START time here in 24-hour time $EndTime = "18:30" ; adjust END time here in 24-hour time $CurrentTime = _NowTime(4) If @WDAY = 6 Then ; Choose 1 = Sunday // 2 = Monday // 3 = Tuesday // 4 = Wednesday // 5 = Thursday // 6 = Friday // 7 = Saturday. If $CurrentTime >= $StartTime AND $CurrentTime <= $EndTime Then ;===================== Your script here below: ============================================ MsgBox(48,"MsgBox","Hello!") ;================================================================================= EndIf EndIfI've tested it and it works just fine so far. Just had to add these to this thread to show the ultimate resolution of this issue. Thanks all! You've all been enormous help. Link to comment Share on other sites More sharing options...
John117 Posted December 14, 2007 Share Posted December 14, 2007 Hey, no prob btw - Could you please add (Solved) to the end title of your first post so that others will not read everyhing before trying to help you only to find you no longer need it Link to comment Share on other sites More sharing options...
Diana (Cda) Posted December 14, 2007 Author Share Posted December 14, 2007 Hey, no prob btw - Could you please add (Solved) to the end title of your first post so that others will not read everyhing before trying to help you only to find you no longer need it Oh, makes sense. But what do you mean, exactly ... "(Solved) to the end title of your _first_ post??" Link to comment Share on other sites More sharing options...
John117 Posted December 14, 2007 Share Posted December 14, 2007 (edited) you go to page 1 then you edit as full (your first post) Add (Solved) to the end of the topic discription Edited December 14, 2007 by Hatcheda Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now