What's wrong with this line of code...

James Sentman james at sentman.com
Sun May 8 09:10:01 EDT 2016


Ah good, you changed it to OR. 

I am sitting here trying to think how the time of the current date can be both before 1AM AND after 9AM :) 

you can make it even simpler to read, at least I think so, by using the date() cast like this:

if current date ≤ date( “1:00am”) or current date ≥ date( “9:00am”) then

when you do it like that it creates a date on the same day as the moment the script is run, but with the time set to that time. You can use any time format that AppleScript can parse, it should be able to parse any string that is the same as the system date layout format.

you MUST use the ()’s when you cast to a date like that or applescript will “compile” the date string into a full date and hard code the today part. which is not what you want in something like this.


> On May 8, 2016, at 5:11 AM, Michel Numericable <michel.discors at numericable.com> wrote:
> 
> if time of (current date) < 1 * hours or time of (current date) > 9 * hours then
> 
> end if
> 
> But be careful It will be before 1:00AM and midnight and after 9:00AM until midnight
> It depends what you want exactly..
> 
> Michel
> 
> Le 8 mai 2016 à 08:53, George Handley <ghandley at kc.rr.com <mailto:ghandley at kc.rr.com>> a écrit :
> 
>> XTensioneers,
>> 
>> This line compiles, but will not work. I’ve spent a couple of hours on it, and decided there something basic wrong that is beyond me. Is there someone out there that easily sees it?
>> 
>> 
>> if ((((time of (current date) ≤ 60 * minutes ¬
>> 	and ((time of (current date) ≥ 540 * minutes)))))) then -- Less than 1:00 AM and after 9:00 AM

Thanks,
 James


James Sentman                       http://www.PlanetaryGear.org		http://MacHomeAutomation.com




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.machomeautomation.com/pipermail/xtensionlist/attachments/20160508/32f2caaa/attachment.html>


More information about the XTensionList mailing list