Sign in to follow this  
Followers 0
GEOSoft

What day was I born? [UPDATED]

31 posts in this topic

#1 ·  Posted (edited)

Since this is Sunday, I don't feel like doing any serious coding so here is a Sunday script for you. Made in response to a question in General Help forum actually.

;

#Include <date.au3>
$mData = ""
For $I = 1 To 12
   $mData &= "|" & StringFormat("%02u", $I)
Next
$Gw = 560
$Gh = 580
$Ttl = "About Your Birth Date"
$Comb_Style = BitOr(0x00200000, 0x0003)
$Frm = GUICreate($ttl, $Gw, $Gh)
GUICtrlCreateLabel("Enter the year..", 20,10, 80, 20)
$Yr = GUICtrlCreateInput("", 100,10, 35)
$Lbl_M = GUICtrlCreateLabel("Select the Month", 155, 10, 90)
$mth = GUICtrlCreateCombo("", 245,10, 60, -1, $Comb_Style)
$Lbl_D = GUICtrlCreateLabel("Select the Day", 325, 10, 90)
$Day = GUICtrlCreateCombo("", 415,10, 40, -1, $Comb_Style)
GUICtrlSetData($Mth, $mData)
For $I = $Lbl_M To $Day
   GUICtrlSetState($I, 32)
Next
GUISetCoord(60, 50)
$Lbl_Data = GUICtrlCreateLabel("", -1, -1, $Gw - 120, 250)
GUICtrlSetFont($Lbl_Data, 10)
$Lbl_Data2 = GUICtrlCreateLabel("", 20, 320, ($Gw/2)-50, 20)
GUICtrlSetFont($Lbl_Data2, 10)
$Btn_Clr = GUICtrlCreateButton("Reset", ($Gw/2) -30, $Gh -40, 60, 30)
GUISetState()

While 1
   If StringLen(GUICtrlRead($Yr)) < 4 Then
      Do
         Sleep(2)
         If GUIGetMsg() = -3 Then Exit
      Until StringLen(GUICtrlRead($Yr)) = 4
      GUICtrlSetState($mth, 336)
      GUICtrlSetState($Lbl_M, 80)
   EndIf
   Switch GUIGetMsg()
      Case - 3
         Exit
      Case $mth
         $dData = ""
         For $I = 1 To _DateDaysInMonth(GUICtrlRead($Yr), GUICtrlRead($mth))
            $dData &= "|" & StringFormat("%02u", $I)
         Next
         GUICtrlSetData($day, $dData)
         GUICtrlSetState($day, 336)
         GUICtrlSetState($Lbl_D, 80)
      Case $day
         $oData = ""
         Local $dY = GUICtrlRead($Yr), $dM = GUICtrlRead($mth), $dD = GUICtrlRead($day)
         WinSetTitle($Frm, "", $Ttl & "  " &  _DateMonthOfYear($dM, 0) & " " & $dD & ", " & $dY)
         If $dD = @Mday AND $dM = @Mon Then $oData &= "HAPPY BIRTHDAY!!" & @CRLF & @CRLF
         $oData &= "You were born on a "
         $astData = _Astrology_Symbols($dM, $dD)
         $oData &= _DateDayofWeek(_DateToDayOfWeek ($dY, $dM, $dD))
         If _DateIsLeapYear($dY) Then $oData &= "  (" & $dY & " was a Leap Year)"
         $bInfo = _Date_DaysLapsed($dY, $dM, $dD)
         $oData &=@CRLF & "You are " & $bInfo[0] & " years old." & @CRLF & "Your astrological sign is " & $astData[0] & @CRLF
         $oData &= "Your element is " & $astData[1] & @CRLF & @CRLF & "Time periods passed since your birth:" & @CRLF
         $oData &= @Tab & @Tab & $bInfo[1] & " years" & @CRLF & @Tab & @Tab & $bInfo[2] & " months" & @CRLF
         $oData &= @Tab & @Tab & $bInfo[3] & " weeks" & @CRLF & @Tab & @Tab & $bInfo[4] & " days" & @CRLF & @Tab & @Tab
         $oData &= $bInfo[5] & " hours" & @CRLF & @Tab & @Tab & $bInfo[6] & " minutes" & @CRLF & @Tab & @Tab & $bInfo[7] & _
               " seconds" & @CRLF
         $oData &= @CRLF & "There are " & _Date_DaysRemaining($dM, $dD) & " days remaining before your next birthday." & @CRLF & @CRLF
         GUICtrlSetData($Lbl_Data, $oData)
         $brData = _Date_BioRhythm($bInfo[4])
         $Lsp = 345
         GUICtrlSetData($Lbl_Data2, "Your Biorythms for today are :")
         $BioStart = GUICtrlCreateDummy()
         For $i = 0 To Ubound($brData) -1
            GUICtrlCreateLabel("   " & $brData[$i][0] & " = " & StringReplace($brData[$i][1], "-", " - ") & "%", 60, $Lsp, 160, 20)
            GUICtrlSetBkColor(-1, "0x" & $brData[$i][2])
            If $i = 2 OR $i = 3 OR $i = 6 Then GUICtrlSetColor(-1, "0xFFFFFF")
            GUICtrlSetFont(-1, 10)
            $Lsp += 25
         Next
         CreateChart(($Gw/2) +30,320,230,200,2,0xcaeaff, 0x7276a6)
         $BioEnd = GUICtrlCreateDummy()
         GUICtrlSetState($Btn_Clr, 256)
      Case $Btn_Clr
         For $I = $Lbl_M To $Day
            GUICtrlSetState($I, 32)
         Next
         GUICtrlSetState($Yr, 256)
         GUICtrlSetData($Yr, "")
         GUICtrlSetData($day,"")
         GUICtrlSetData($Mth, $mData, "")
         GUICtrlSetData($Lbl_Data, "")
         GUICtrlSetData($Lbl_Data2, "")
         For $I = $BioStart To $BioEnd
            GUICtrlDelete($i)
         Next
         WinSetTitle($Frm, "", $ttl)
   EndSwitch
Wend

Func _Astrology_Symbols($iMth, $iDay);;Return Astrological Data of a Date
   local $aData[2][13] = [ ["","Capricorn", "Aquarius", "Pisces", "Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius"] _
         , ["","Earth", "Air", "Water", "Fire", "Earth", "Air", "Water", "Fire", "Earth", "Air", "Water", "Fire"]]
   $rSign = $iMth
   Switch $iMth
      Case 1, 3; Capricorn
         If $iDay > 19 Then $rSign += 1
      Case 2; Aquarius
         If $iDay > 17 Then $rSign += 1
      Case 4, 5, 11; Aries
         If $iDay > 20 Then $rSign += 1
      Case 6;Gemini
         If $iDay > 22 Then $rSign += 1
      Case 12; Sagittarius
         If $iDay > 21 Then $rSign = 1
      Case Else
         If $iDay > 21 Then $rSign += 1
   EndSwitch
   local $Sg = $aData[0][$rSign], $El = $aData[1][$rSign], $oData[2] = [$Sg, $El]
   Return $oData
EndFunc   ;<===> _Astrology_Symbols()

Func _Date_DaysLapsed($nYr, $nMth, $nDay)
   Local $I, $cMth = $nMth, $aDays = _DateDaysInMonth($nYr, $nMth) - $nDay, $aYrs = @Year - ($nYr + 1), $aMths = $aYrs * 12
   Local $dDiff = (_DateDaysInMonth($nYr, $nMth) - $nDay) + @Mday
   $aMths += Round((12 - ($nMth)) + @Mon -1 + ($dDiff/30), 2)
   $dYrs = Round($aMths/12, 2)
   $nMth += 1
   For $I = $nYr to @Year
      Do
         $aDays += _DateDaysInMonth($I, $nMth)
         $nMth += 1
         If $nMth = @Mon -1 AND $I = @Year Then ExitLoop(2)
         If $nMth >12 Then $nMth = 12
      Until $nMth = 12
      $nMth = 1
   Next
   $aDays += @Mday
   $aHrs = (($aDays -1) *24) + @Hour
   $aMin = ($aHrs *60) + @Min
   $aSec = ($aMin * 60) + @Sec
   If StringInStr($aMths, ".") Then
      $dMths = StringLeft($aMths, StringInStr($aMths, ".") -1)
      $aMths = _Number_AddSep(Int($dMths)) & StringMid($aMths, StringInStr($aMths, "."))
   Else
      $aMths = _Number_AddSep(Int($aMths))
   EndIf
   $aWks = Round($aDays/7, 2)
   If StringInStr($aWks, ".") Then
      $dWks = StringLeft($aWks, StringInStr($aWks, ".") -1)
      $aWks = _Number_AddSep(Int($dWks)) & StringMid($aWks, StringInStr($aWks, "."))
   Else
      $aWks = _Number_AddSep(Int($aWks))
   EndIf
   $aDays = _Number_AddSep(Int($aDays))
   $aHrs = _Number_AddSep(Int($aHrs))
   $aMin = _Number_AddSep(Int($aMin))
   $aSec = _Number_AddSep(Int($aSec))
   If $cMth = @Mon AND $nDay = @Mday Then $aYrs += 1
   Local $oArray [8] = [$aYrs, $dYrs, $aMths, $aWks, $aDays, $aHrs, $aMin, $aSec]
   Return $oArray
EndFunc   ;<===> _Date_DaysLapsed()

Func _Date_DaysRemaining($iMth, $iDay, $cYr = 0)
   Local $bDate, $cDate, $rDays = 0, $dDiff, $I
   $wYears = ($cYr-1) - (@Year)
   If ($wYears = 0 OR $wYears = 1) AND @Mon < $iMth Then $wYears += 1
   If $wYears > 0 Then
      For $y = @Year + 1 To @Year + $wYears
         For $I = 1 To 12
            $rDays += _DateDaysInMonth($y, $i)
         Next
      Next
      $cYr = 0
   EndIf
   If $cYr = 0 Then $cYr = @Year
   If StringLeft(_DateDiff("D", StringFormat("%u/%02u/%02u", $cYr, @Mon, @Mday), StringFormat("%s/%02u/%02u", $cYr, $iMth, $iDay)), 1) = "-" Then
      $cYr += 1
      For $I = @Mon to 12
         $rDays += _DateDaysInMonth($cYr, $i)
      Next
      If $iMth >= 2 Then
         For $i = 1 To $iMth-1
            $rDays += _DateDaysInMonth($cYr+1, $i)
         Next
      EndIf
      If (NOT _DateIsLeapYear($cYr)) AND $iMth = 2 AND $iDay = 29 Then $rDays -= 1
   Else
      $cMth = @Mon
      For $i = $cMth To $iMth-1
         $rDays += _DateDaysInMonth(@Year, $i)
      Next
      If $I > 12 Then $I = 1
   EndIf
   $dDiff = ($rDays - @Mday) + $iDay
   Return $dDiff
EndFunc   ;<===> _Date_DaysRemaining()

Func _Number_AddSep($iVal, $sSep = ",")
   If (NOT StringIsInt($iVal)) AND (NOT StringIsFloat($iVal)) Then Return SetError(1);; $iVal must be an Integer or a Float
   Local $dVal = ""
   If StringInStr($iVal, ".") Then
      $dVal = StringMid($iVal, StringInStr($iVal, "."))
      $iVal = StringLeft($iVal, StringInStr($iVal, ".") -1)
   EndIf
   Local $oVal = ""
   $cArray = StringSplit($iVal,"")
   For $I = Ubound($cArray)-3 to 1 step -3
      $cArray[$I] = $sSep & $cArray[$I]
   Next
   For $I = 1 To Ubound($cArray)-1
      $oVal &= $cArray[$I]
   Next
   If StringLeft($oVal, 1) = $sSep Then $oVal = StringTrimLeft($oVal, 1)
   Return $oVal & $dVal
EndFunc   ;<===> _Number_AddSep()

Func _Date_BioRhythm($aDays)
   $aDays = StringReplace(StringStripWS($aDays, 8), ",", "")
   If StringInStr($aDays, ".") Then $aDays = Round($aDays, 0)
   $pi = 3.14159265358979323846264338328
   $pScore = Round(100*sin(2*$pi*(180/$pi) * ($aDays/23)), 2)
   $eScore = Round(100*sin(2*$pi*(180/$pi) * ($aDays/28)), 2)
   $iScore = Round(100*sin(2*$pi*(180/$pi) * ($aDays/33)), 2)
   $sScore = Round(100*sin(2*$pi*(180/$pi) * ($aDays/53)), 2)
   $aScore = Round(100*sin(2*$pi*(180/$pi) * ($aDays/48)), 2)
   $aScore2 = Round(100*sin(2*$pi*(180/$pi) * ($aDays/43)), 2)
   $iScore2 = Round(100*sin(2*$pi*(180/$pi) * ($aDays/38)), 2)
   Dim $bArray[7][3] = [ ["Physical",$pScore,"4ab548"], ["Emotional",$eScore,"6ccfff"], ["Intellectual",$iScore,"a657a6"], _
      ["Spiritual", $sScore,"7172c5"], ["Awareness",$aScore,"ffbfc1"], ["Aesthetic", $aScore2,"f9d862"], ["Intuition",$iScore2,"8b3b3a"] ]
   Return $bArray
EndFunc   ;<===> _Date_BioRhythm()

Func CreateChart($Chart_x, $Chart_y, $Chart_w, $Chart_h, $cLnsz, $cBkclr=Default, $chart_Lclr= 0x000000, $mPts = 8)
   $vCenter = $Chart_y + ($Chart_h/2)
   $hL_pos = $vCenter - 1
   $Mrkrs = $Chart_h/ $mPts
   _GUI_CreateBox($Chart_x, $Chart_y -2, $Chart_w, $Chart_h +4, $cLnsz, $cBkclr, $chart_Lclr)
   _GUI_Line_H($Chart_x, $hL_pos, $Chart_w, 2, $chart_Lclr)
   For $I = 1 To $mPts -1
      _GUI_Line_H($Chart_x, $Chart_y + $Mrkrs*$I, $Chart_w, 1, $chart_Lclr)
   Next
   $Bstart = $Chart_x+10
   $bWidth = 30
   For $I = 0 To UBound($brData)-1
      $cClr = StringFormat("0x%s",$brData[$I][2])
      _Chart_Newbar($Bstart, $vCenter, $brData[$I][1], $cClr, $bWidth)
      $Bstart += $bWidth
   Next
EndFunc  ;<==> CreateChart()

Func _GUI_CreateBox($xStart, $yStart, $bWidth, $bHeight, $bThick = 1, $cFill = default, $cLine = 0x000000)
   Local $Fill, $Left, $Top, $Bottom, $Right
   If $cFill <> default Then
      $Fill = GUICtrlCreateLabel("", $xStart, $yStart, $bWidth, $bHeight)
      GUICtrlSetBkColor($Fill, $cFill)
   EndIf
   _GUI_Line_V($xStart, $yStart, $bHeight + $bThick, $bThick, $cLine)
   _GUI_Line_H($xStart, $yStart, $bWidth, $bThick, $cLine)
   _GUI_Line_H($xStart, $yStart + $bHeight, $bWidth, $bThick, $cLine)
   _GUI_Line_V($xStart + $bWidth, $yStart, $bHeight + $bThick, $bThick, $cLine)
EndFunc  ;<==> _GUI_CreateBox()

Func _GUI_Line_H($Line_x, $Line_y, $Line_l, $Line_t = 1, $cLine = 0x000000)
   GUICtrlCreateLabel("", $Line_x, $Line_y, $Line_L, $Line_t)
   GUICtrlSetBkColor( -1, $cLine)
EndFunc  ;<==> _GUI_Line_H()

Func _GUI_Line_V($Line_x, $Line_y, $Line_l, $Line_t = 1, $cLine = 0x000000)
   GUICtrlCreateLabel("", $Line_x, $Line_y, $Line_t, $Line_l)
   GUICtrlSetBkColor( -1, $cLine)
EndFunc  ;<==> _GUI_Line_V()

Func _Chart_Newbar($bar_x, $bar_y, $Bar_Val, $bar_Clr, $Bar_w = 30, $bRatio = 1, $bOrient = 1)
   Local $sp
   If $bOrient = 1 Then
      $sp = $bar_y
      If $bar_Val > 0 Then $sp = $bar_y - $Bar_Val
      $Bar_Val = StringReplace($Bar_Val, "-", "")
      GUICtrlCreateLabel("", $bar_x, $sp, $Bar_w, $bar_Val / $bRatio)
   Else
      $sp = $bar_x
      If $bar_Val > 0 Then $sp = $bar_x - $Bar_Val
      GUICtrlCreateLabel("", $sp, $bar_y, $Bar_w, $bar_Val / $bRatio)
   EndIf
   GUICtrlSetBkColor(-1, $Bar_Clr)
EndFunc  ;<==> _Chart_Newbar()

;

Edit: Maybe on some other Sunday I'll get around to attempting to add BioRhythms to it

Updated April 26, 2008 ( a day early)

Relative positioning is no longer used.

Now includes more data about your birthday as well as BioRhythm information and chart.

It was a good chance to play with some UDF functions I'm working on.

Next update will probably be to create a better looking GUI

Edited by GEOSoft

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!"

Share this post


Link to post
Share on other sites



Apparently I was born on a wednesday, I had no idea :D


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Hmm, This says I was born on Sunday, when my parents say: "Wednesday"

Share this post


Link to post
Share on other sites

Hmm, This says I was born on Sunday, when my parents say: "Wednesday"

Test it on this page as well: link

And if it still turns out to be Sunday, well maybe your parents are becoming senile :D


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Hmm, This says I was born on Sunday, when my parents say: "Wednesday"

Maybe that's when you were concepted :D

Share this post


Link to post
Share on other sites

very nice.. I like this. And it works (my parents agree with it!) LOL


code

Share this post


Link to post
Share on other sites

I do believe the word is Conceived.... :D

Both words are acceptable...

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Test it on this page as well: link

And if it still turns out to be Sunday, well maybe your parents are becoming senile :D

I think Your parents are wrong but You can check by going to

http://www.hf.rim.or.jp/~kaji/cal/cal.cgi?1965

Just change the last 4 characters to your year of birth.

EDIT: BTW thanks for the link. It gave me a couple more ideas.

Edited by GEOSoft

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!"

Share this post


Link to post
Share on other sites

I guess they're wrong :/

Share this post


Link to post
Share on other sites

You could ask for your birth certificate. I just saw mine a couple of days ago (Wednesday?), anyways... yeah.

Share this post


Link to post
Share on other sites

I guess they're wrong :/

The code that returns the Day was written by Jeremy Landes and he wasn't wrong very often.

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!"

Share this post


Link to post
Share on other sites

http://www.paulsadowski.com/BirthData.asp

That gives you ton of info for your birthday

Thanks Swift. Good for a few more ideas.

I now have the formula for calculating biorhythms so that will be the next addition and that isn't happening for a week or so.


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!"

Share this post


Link to post
Share on other sites

This is way cool!! Hope you get bored more often.. LOL :D

Share this post


Link to post
Share on other sites

Wow, this is great :D


[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Share this post


Link to post
Share on other sites

Now updated. See Post #1


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!"

Share this post


Link to post
Share on other sites

Very nice! Love seing statistics about me :D


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Hmm, I run this, and then choose my birthday...and then nothing happens. It wont close etc.

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

Hmm, I run this, and then choose my birthday...and then nothing happens. It wont close etc.

It's running just fine Swift. What version of AutoIt? Did you try to make any changes to it like Including files that I don't have included? Trying to run it by itself or through Scite?

I just thought of something else. Are you running Vista?

I don't see where that should make a difference but I would like to know if it's caused by Vista. Maybe someone else with Vista will weigh in on this.

If it is a Vista issue then you can try adding #RequireAdmin at the top of the script. That is the total extent of support that I will ever provide for Vista since I don't care if something runs in Vista or not.

Edited by GEOSoft

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!"

Share this post


Link to post
Share on other sites

I get the same effect as Swift when trying Nov 10, 1970 or Nov 3, 1977. Choosing another month in either of these years works fine. Maybe something to do with November? Btw, I'm running WinXP and AutoIt v3.2.10.0.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0