{"id":311,"date":"2008-06-18T15:26:00","date_gmt":"2008-06-18T15:26:00","guid":{"rendered":"http:\/\/192.168.1.142:8080\/2008\/06\/18\/i-wrote-a-script\/"},"modified":"2022-10-04T12:48:45","modified_gmt":"2022-10-04T16:48:45","slug":"i-wrote-a-script","status":"publish","type":"post","link":"https:\/\/home.woodchuckhunters.com\/blog\/2008\/06\/18\/i-wrote-a-script\/","title":{"rendered":"I wrote a script!"},"content":{"rendered":"\n<p>Copy the quoted text into a plain text file on your computer and name it &#8220;holiday.vbs&#8221;. This program will tell you how many days are left until the next Hillsdale Community Health Center approved holiday.<\/p>\n\n\n\n<!--more Holiday program under cut...-->\n\n\n\n<pre class=\"wp-block-code\"><code><blockquote><pre>currentDate = Date\ncurrentYear = cint(year(currentDate))\n\n'Six HCHC Holidays: New Years Day(Jan 1), Memorial Day(Last Monday in May), Fourth of July(July 4), Labor Day(First Monday Sept.),\n' Thanksgiving Day(fourth Thursday in Nov.), X-Mas Day(Dec. 25)\nnewYears = \"Jan. 1 \" &amp; (currentYear + 1)\nmemDay = LastMonMay &amp; currentYear\njuly4 = \"July 4 \" &amp; currentYear\nlaborDay = FirstMonSept &amp; currentYear\nturkeyDay = FourThursNov &amp; currentYear\nxMasDay = \"Dec. 25 \" &amp; currentYear\n\nSet dicHolidays = CreateObject(\"Scripting.Dictionary\")\ndicHolidays.Add \"Memorial Day\",memDay 'key first, next item\ndicHolidays.Add \"the 4th of July\",july4\ndicHolidays.Add \"Labor Day\",laborDay\ndicHolidays.Add \"Thanksgiving\",turkeyDay\ndicHolidays.Add \"Christmas Day\",xMasDay\ndicHolidays.Add \"New Years\", newYears\n\narrHoliNames = dicHolidays.keys\narrHoliDates = dicHolidays.items\n\nFor i=0 to dicHolidays.count -1\nintDays = DateDiff(\"d\", currentDate, cdate(arrHoliDates(i)))\nif intDays &lt; 0 then 'wscript.echo arrHoliNames(i) &amp; \" has passed, continue loop\" else if intDays = 0 then wscript.echo \"Today is \" &amp; arrHoliNames(i) Exit For else if intDays &gt; 0 then\nwscript.echo intDays &amp; \" days until \" &amp; arrHoliNames(i)\nExit For\nEnd if\nEnd if\nEnd if\nNext\n\n'----------Function\/Subs listed below-------------------\nFunction LastMonMay()\ndtmDate = cdate(\"May 31 \" &amp; currentYear)\nDo\nintDayOfWeek = Weekday(dtmDate)\nIf intDayOfWeek = 2 Then\n'Wscript.Echo \"The last Monday of May is \" &amp; dtmDate &amp; \".\"\nLastMonMay = \"May \" &amp; day(dtmDate) &amp; \" \"\nExit Do\nElse\ndtmDate = dtmDate - 1\nEnd If\nLoop\nEnd Function\n\nFunction FirstMonSept()\ndtmDate = cdate(\"Sept 1 \" &amp; currentYear)\nDo\nintDayOfWeek = Weekday(dtmDate)\nIf intDayOfWeek = 2 Then\n'Wscript.Echo \"The first Monday of Sept. is \" &amp; dtmDate &amp; \".\"\nFirstMonSept = \"Sept \" &amp; day(dtmDate) &amp; \" \"\nExit Do\nElse\ndtmDate = dtmDate + 1\nEnd If\nLoop\nEnd Function\n\nFunction FourThursNov()\ndtmDate = cdate(\"Nov. 1 \" &amp; currentYear)\nx = 0\nDo\nintDayOfWeek = Weekday(dtmDate)\nIf intDayOfWeek = 5 Then\n'Wscript.Echo \"A thursday in Nov. is \" &amp; dtmDate &amp; \".\"\nx = x+1\nIf x = 4 then\nFourThursNov = \"Nov. \" &amp; day(dtmDate) &amp; \" \"\nExit Do\nEnd If\nElse\ndtmDate = dtmDate + 1\nEnd If\nLoop\nEnd Function<\/pre><\/blockquote><\/code><\/pre>\n<div class='lj-moods-meta'><b>Current Mood:<\/b> accomplished<br\/><\/div>","protected":false},"excerpt":{"rendered":"<p>Copy the quoted text into a plain text file on your computer and name it &#8220;holiday.vbs&#8221;. This program will tell you how many days are left until the next Hillsdale Community Health Center approved holiday. Current Mood: accomplished<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-311","post","type-post","status-publish","format-standard","hentry","category-techy"],"_links":{"self":[{"href":"https:\/\/home.woodchuckhunters.com\/blog\/wp-json\/wp\/v2\/posts\/311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/home.woodchuckhunters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/home.woodchuckhunters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/home.woodchuckhunters.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/home.woodchuckhunters.com\/blog\/wp-json\/wp\/v2\/comments?post=311"}],"version-history":[{"count":3,"href":"https:\/\/home.woodchuckhunters.com\/blog\/wp-json\/wp\/v2\/posts\/311\/revisions"}],"predecessor-version":[{"id":922,"href":"https:\/\/home.woodchuckhunters.com\/blog\/wp-json\/wp\/v2\/posts\/311\/revisions\/922"}],"wp:attachment":[{"href":"https:\/\/home.woodchuckhunters.com\/blog\/wp-json\/wp\/v2\/media?parent=311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/home.woodchuckhunters.com\/blog\/wp-json\/wp\/v2\/categories?post=311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/home.woodchuckhunters.com\/blog\/wp-json\/wp\/v2\/tags?post=311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}