![]() |
KnowBrainer Speech Recognition | ![]() |
Topic Title: Sortable Date <DayNumbers> <MonthList> <Year> Topic Summary: Output arbitrary sortable date Created On: 01/08/2020 03:27 PM Status: Post and Reply |
|
![]() |
![]() |
- Edgar | - 01/08/2020 03:27 PM |
![]() |
|
' The lists: ' DayNumbers consists of the integers 1 through 31 ' MonthList consists of all 12 months January...December ' Year can consist of any list of consecutive integers, I use 1900...2050 ' (I create consecutive lists of integers using a spreadsheet) ' I'm in the habit of using military dates: 8 January 2020 would come out sorted as: 2020 01 08 Sub Main Dim integerDayOfTheMonth As Integer Dim stringDayOfTheMonth, stringMonth As String Dim dayFailure As Boolean dayFailure = False integerDayOfTheMonth = CInt(ListVar1) If integerDayOfTheMonth >= 1 And integerDayOfTheMonth <= 31 Then If ListVar2 = "February" Then If integerDayOfTheMonth <= 29 Then' error testing for leap year is not performed stringDayOfTheMonth = ListVar1 Else stringDayOfTheMonth = "UNKNOWN day" dayFailure = True End If ElseIf ListVar2 = "April" Or ListVar2 = "June" Or ListVar2 = "September" Or ListVar2 = "November" Then If integerDayOfTheMonth <= 30 Then stringDayOfTheMonth = ListVar1 Else stringDayOfTheMonth = "UNKNOWN day" dayFailure = True End If Else stringDayOfTheMonth = ListVar1 End If Else stringDayOfTheMonth = "UNKNOWN day" dayFailure = True End If If dayFailure = True Then MsgBox "The date uttered could not be parsed." + vbCr + _ ListVar1 + " " + ListVar2 + " " + ListVar3, 0, "Date Unrecognized" Exit All End If stringDayOfTheMonth = Format (Val (stringDayOfTheMonth), "00") Select Case ListVar2 ' since these are the only items on the list no need for error checking Case "January" stringMonth = "01" Case "February" stringMonth = "02" Case "March" stringMonth = "03" Case "April" stringMonth = "04" Case "May" stringMonth = "05" Case "June" stringMonth = "06" Case "July" stringMonth = "07" Case "August" stringMonth = "08" Case "September" stringMonth = "09" Case "October" stringMonth = "10" Case "November" stringMonth = "11" Case "December" stringMonth = "12" End Select SendKeys ListVar3, 1 SendKeys "{Space}", 1 SendKeys stringMonth, 1 SendKeys "{Space}", 1 SendKeys stringDayOfTheMonth, 1 End Sub ------------------------- -Edgar |
|
|
FuseTalk Standard Edition v4.0 - © 1999-2021 FuseTalk™ Inc. All rights reserved.