Rex Posted April 24, 2005 Share Posted April 24, 2005 (edited) Hi i fount this code on the net. But sins i'm not a math i have no idear how to translate it into a autoIT script. aar = year(Date()) a = modx(aar, 19) b = int(aar/100) c = modx(aar, 100) d = b/4 e = modx(b, 4) f = int((b+8)/25) g = int((b-f+1)/3) h = modx(19*a+b-d-g+15,30) i = int(c/4) k = modx(c,4) l = modx(32+2*e+2*i-h-k,7) m = int((a+11*h+22*l)/451) n = int((h+l-7*m+114)/31) 'måned påsken falder i p = modx(h+l-7*m+114,31) ' dagen før påske '** Modulus **' Function modx(nx, dx) modx = nx - dx*Int(nx/dx) End Function Påsken falder på DateAdd("d", 1, n &"/" & p & "/" & aar) '** Can be used for all years in the gregorian calendar (1701 ac) **' '** Calculation take notice of the 1992-change in the church year, but take NO notice of speciel holidays before Struensees reform in 1770 ac **' Wath i want is a way to calculate thos holidays who moves arount. I need it in a script i'm trying to write for a pall of mine. his son hase problems to close his computer and got to sleep, so i will try to create a script who shuts down the computer at 20.00 sharp on monday to thorsday + sunday, rest of the days fri, sat - holi - wecations at 23.00. Not that i have any ide of how to da sotch a script, but hay if you dont try you dont sucess Edited April 24, 2005 by Rex Link to comment Share on other sites More sharing options...
buzz44 Posted April 24, 2005 Share Posted April 24, 2005 (edited) Best thing to do would be to create a shutdown script, and use the Windows Scheduler to tell it what days/times you want to run it. Edited April 24, 2005 by Burrup qq Link to comment Share on other sites More sharing options...
Rex Posted April 24, 2005 Author Share Posted April 24, 2005 Best thing to do would be to create a shutdown script, and use the Windows Scheduler to tell it what days/times you want to run it.<{POST_SNAPBACK}>Windows don't know when it a holiday, or school wecation.And it will be to easy for the boy to deaktivate the script.I'm thinking about installing the script ass a hiddent service so it would tough to deaktivate i, that i might neeed to google to finde out how to that Also i will try to make i password protectet, i'd a search in the forum about how to generate random cars. (encrypt / decrypt) thru the main script, not that i got wisher but hay u gota try to get a result. I think that i need to make a do while loop for the script, and then check for the current time ewery ½ houre or so. Link to comment Share on other sites More sharing options...
ReFran Posted April 24, 2005 Share Posted April 24, 2005 Here is the basic for you from wonderful Chip Pearsons website:http://www.cpearson.com/excel/holidays.htmYou need only to translate from VBA to AutiIT. When you are ready it would be fine if you can publish it here, so it can be put/changed into UDF.Good luck, Reinhard Link to comment Share on other sites More sharing options...
Rex Posted April 24, 2005 Author Share Posted April 24, 2005 Here is the basic for you from wonderful Chip Pearsons website:http://www.cpearson.com/excel/holidays.htmYou need only to translate from VBA to AutiIT. When you are ready it would be fine if you can publish it here, so it can be put/changed into UDF.Good luck, Reinhard<{POST_SNAPBACK}>Sorry i don't know VBA, but when i finde the correct formula, i will post i in the forum, under script and scrapt - but current i's the danish holidays i'm after i'm not sure that the UK/UK holidays are = Dk. Link to comment Share on other sites More sharing options...
ReFran Posted April 24, 2005 Share Posted April 24, 2005 (edited) Sorry i don't know VBA, but when i finde the correct formula, i will post i in the forum, under script and scrapt - but current i's the danish holidays i'm after i'm not sure that the UK/UK holidays are = Dk.<{POST_SNAPBACK}>You can download the holidays from a website (like: http://www.earthcalendar.net/_php/lookup.php?mode=country) and build a simple database and then query it. Should not be to complex because you need it only for some years ( - until his son is old enough).A formular (like that from chip) you need only in order to be more flexible. The most discussed problem is to calculate eastern, the first Sunday after first full moon in spring. But also if you get it translated - I did it some ages ago for good old Lotus 123 macros - you have to download the school holidays/vacation which will be fixed from government (independent from some christian days).So a database solution, via ADO or whatever, seem to be a better solution for you.Best regards, Reinhard Edited April 24, 2005 by ReFran 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