Author Topic: Wait til x  (Read 3095 times)

Frunple

  • Hero Member
  • *****
  • Posts: 774
    • View Profile
Wait til x
« on: May 26, 2013, 04:27:23 am »
How can I say "wait til 6am" in a script?
The only type of 'wait' I can find is the System.sleep but that won't (I believe) use an exact time.


I'll explain further, maybe there's an easier way.
I have a rule that opens my blinds at sunset. I want them to open at sunset, if sunset is after 6am.
So at sunset, when the rule executes, I want to check the current time, if before 6am, wait til 6am, then open blinds.
If sunset is after 6am, just open blinds.
« Last Edit: May 26, 2013, 04:49:51 am by Frunple »

iostream212

  • Sr. Member
  • ****
  • Posts: 459
    • View Profile
Re: Wait til x
« Reply #1 on: May 26, 2013, 08:58:24 am »
I am not sure of an easy way to do this. It is definitely doable, but the way I am thinking will require some scripting.

I would:
1.) Set a rule to run at sunrise
2.) In the script for the rule save DateTime.Now which will be your sunrise reference
3.) Define a new constant DateTime  for 6:00am
4.) Compare the times
5.) If Sunrise < Constant get the difference by Constant - Sunrise
6.) Convert above into milliseconds
7.) Run your System.Sleep using above.

I can provide a working script if needed.
I always wanted to be somebody. In retrospect, I think I should have been more specific.

iostream212

  • Sr. Member
  • ****
  • Posts: 459
    • View Profile
Re: Wait til x
« Reply #2 on: May 26, 2013, 10:52:18 am »
Here is my previous post converted to a script:
Code: [Select]

Sunrise = DateTime.Now;
Constant = New DateTime(Sunrise.Year, Sunrise.Month, Sunrise.Day, 6, 00 , 00);
Wait = 0;

if (Sunrise < Constant)
{
TimeDifference = Constant - Sunrise;
TimeParts = String(TimeDifference).Split(":");

if (TimeParts.HighestIndex == 2)
{
Wait = Number(TimeParts[0])* 3600000 +  Number(TimeParts[1])* 60000 +  Number(TimeParts[2])* 1000;
}
else
{
Wait = Number(TimeParts[0])* 60000 +  Number(TimeParts[1])* 1000;
}

System.Sleep(Wait);
}

Scenes.test();
I always wanted to be somebody. In retrospect, I think I should have been more specific.

Frunple

  • Hero Member
  • *****
  • Posts: 774
    • View Profile
Re: Wait til x
« Reply #3 on: May 29, 2013, 06:06:48 am »
Just wanted to say thanks for this. Haven't tried it yet, I might just set them to open at 6am and leave it at that, trying that now anyway, I'll have to see the 'reaction' I get.
If no good I'll definitely give this a try.

iostream212

  • Sr. Member
  • ****
  • Posts: 459
    • View Profile
Re: Wait til x
« Reply #4 on: May 29, 2013, 12:38:46 pm »
No problem. I actually had a similar need... so two stones with one bird!

Sent from my Galaxy S4 using Tapatalk 2

I always wanted to be somebody. In retrospect, I think I should have been more specific.

superjer2000

  • Jr. Member
  • **
  • Posts: 21
    • View Profile
Re: Wait til x
« Reply #5 on: September 06, 2013, 09:30:34 pm »
Late to the party here but if I understand correctly, why wouldn't you just have two rules:

1) Fire at sunrise - check that the blinds are closed by checking a global variable.  if it is after 6am the open the blinds and set a global variable to indicate the blinds are open.

2)  Fire at 6:00am - check if the blinds are already open by checking the global variable  if they are closed, open them and switch the global variable.

Then another rule would maybe switch the global variable to false or closed at 5:00pm everyday.

So if sunrise was at 5:55am rule 1 would fire, the blinds would be closed but since it isn't 6:00am the blinds wouldn't open.
At 6:00am the blinds would open when the second rule fires.

If sunrise was at 6:10am rule #2 would open the blinds at 6:00am.

iostream212

  • Sr. Member
  • ****
  • Posts: 459
    • View Profile
Re: Wait til x
« Reply #6 on: September 06, 2013, 09:49:31 pm »
Good point! I love seeing how different paths can lead to the same result.  :)
I always wanted to be somebody. In retrospect, I think I should have been more specific.

GeorgeHarthups

  • Hero Member
  • *****
  • Posts: 2580
    • View Profile
jlydwm1q
« Reply #7 on: August 28, 2017, 02:44:41 pm »
https://www.flickr.com/groups/3601597@N22/discuss/72157685658027454/
https://bitbucket.org/snippets/sandysdg1967k3/epxM7K/
 
Project64, Windows, Freeware, Rating: 8.4 (3933 Votes).
https://bitbucket.org/snippets/jeffryharting1974k7/pLnE9g/
https://bitbucket.org/snippets/orlandogay1981u6/X8LBMn/
 
current version: Google Chrome 59.0.3071.115 / 60.0.3112.66 Beta / 61.0.3153.0/2 Jul 21, 2015 The Dev channel has been updated to version 45.0.2454.12. Jun 3, 2015 Install Google Chrome 44 (Chrome 44.0.2403.18) on Ubuntu, Fedora and CentOS.
https://bitbucket.org/snippets/heribertocornette1965e5/yqnb7g/
https://bitbucket.org/snippets/jasperdashner1996r8/j8L8Kr/
 
I download the driver for windows7-32bit( HP laser Jet 1320 printer, I have the driver Jun 12, 2015 Download and install HP LaserJet 1320 printing device installer 7 (32-bit), Microsoft Windows 8 (32-bit), Microsoft Windows 8.1 (32-bit). Windows 8, 8.1 Support · Windows 7, Vista Support · Windows XP Support HP LaserJet 1160 Printer Series*-* Download drivers and software - HP Hi try the info here HP LaserJet 1160 and 1320 Series Printers - Installing an HP Mar 10, 2016 Free Download HP LaserJet 1300 Printer Driver 60.5.17.2 (Digital Camera / Webcam / Camcorder) DriverPack Solution - you can download free drivers for audio, video, chipset, 8.1/ 8/ 7/ XP (32,64 bit) DOWNLOAD .. USB, hp LaserJet 1320 series (DOT4) HP LaserJet 1320n Driver Download HP LaserJet 1320n Review – There's a reason Hewlett-Packard HP LaserJet 1320n Printer Driver Windows 32/64 bit. Windows 7 windows 7 32 bit free download kundli pro software for windows 7 full version windows vista download hp sound drivers for windows xp download hp laserjet 4050 driver download intel driver update for windows 8.1 driver software for 3 dongle free download kundali application download hp laserjet 1320 software for Mar 28, 2016 HP Laserjet 1160 Driver and utility CD included in the product package.
http://timetovotethemout.com/MyBB/showthread.php?tid=264194&pid=298766#pid298766
https://fanopel.eu/showthread.php?tid=23706&pid=180094#pid180094
http://www.epodloga.pl/forum/viewtopic.php?f=16&t=2780&p=3341#p3341
http://mo4x4.cl/viewtopic.php?f=6&t=3962&p=15150#p15150
http://forum.spv.ch/viewtopic.php?f=12&t=27093&p=28879#p28879
 
http://google.com/q=w5ozszl0

GeorgeHarthups

  • Hero Member
  • *****
  • Posts: 2580
    • View Profile
ldy3swip
« Reply #8 on: August 29, 2017, 02:32:30 am »
https://www.flickr.com/groups/3946367@N21/discuss/72157688150267065/
https://www.flickr.com/groups/3938079@N24/discuss/72157688149862305/
 
Jun 19, 2017 We also offer free full version crack, patch, serial key, keygens for Adobe Photoshop CS6 is a very complex graphics, image editing software Adobe Photoshop CS6 Download Free Full Version Extended Adobe Photoshop CS6 32 And 64 Bit Download Free ISO Crack.
https://bitbucket.org/snippets/abrahamahc1984o2/9qAaxz/
https://bitbucket.org/snippets/kelvinembrey1967m9/GGr4qK/
 
IT Certification Exam. Download exam 210-065 Premium PDF Files.
https://bitbucket.org/snippets/rodsheahan1984z3/GGrkq8/
https://bitbucket.org/snippets/andersonkzf1972w0/BBg4yr/
 
the only service on the web that provides premium, full-version PC casual games – 100% FREE. Download free PC Games full version Here with all games complete setup high compressed a single link downloading. Card & Board Games ✓ Download Free Full Version PC Games ✓ Play Games Online at FreeGamePick ✓ Fun, Safe & Trusted!
http://forum.technicaldiving.ie/index.php/topic,171615.new.html#new
http://forum.akatsuki-ro.fr.nf/viewtopic.php?f=84&t=4998
http://slimeball.eu/viewtopic.php?f=10&t=2892&p=3611#p3611
http://entretien-automobile.fr/viewtopic.php?f=3&t=464879&p=511458#p511458
http://csgoinfo.eu/showthread.php?tid=73426&pid=176979#pid176979
 
http://google.com/q=phh3v4ca