Announcement

Collapse
No announcement yet.

Voice Command help Please

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Voice Command help Please

    hey guys i need help develop a script to read from a Excel spread sheet. i got it to where it reads from the sheet. the sheet contains my work schedule. i just don't under stand add voice commands and stuff like that. voice command are as the fallowing (do i work today|Do i work tomorrow|do i work on the ##) this what i have so far.

    Sub Main
    Dim myDateString
    myDateString = LongDate
    'Determine the day of April 19, 1964
    MyDay = Day(myDateString)
    'Determine the day today
    MyDay = Day(now)+1
    Dim xlApp
    Dim xlBook
    Dim xlSheet

    Set xlApp = CreateObject("Excel.Application")
    xlApp.visible = False
    Set xlBook = xlApp.Workbooks.open("I:\Documents\Data.XLSX")
    Set xlSheet = xlBook.Worksheets("WorkSchedule")
    if xlSheet.Cells((MyDay), 1).Value = "NA" then
    hs.speak ("you dont have work today ")
    else
    hs.speak ("You have to work today at ") & xlSheet.Cells((MyDay), 1).Value
    end if
    strComputer = "."
    strProcessToKill = "EXCEL.exe"

    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")

    Set colProcess = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")

    count = 0
    For Each objProcess in colProcess
    objProcess.Terminate()
    count = count + 1
    Next

    End Sub



    Thank you for any help

    #2
    What happens when you run the script? Do you get errors?

    It looks to be relatively close to working if all that is erroring is the speak commands

    Originally posted by ~Ghost~ View Post
    hs.speak ("you dont have work today ")
    Should work OK

    hs.speak ("You have to work today at ") & xlSheet.Cells((MyDay), 1).Value
    try changing it to

    hs.speak("You have to work today at " & xlSheet.Cells((MyDay), 1).Value)

    Comment


      #3
      no errors just need to figure out how to get it to understand multiple commands i don't know were to start

      ~Ghost~

      Comment


        #4
        Right sorry I thought you wanted speech, I get it now. It has been some time since I delved into the arts of VR so this is from memory. I am not sure you can do your last one and would need to defer to someone who knew alot about it, it is the variable that I think you are going to struggle with as I believe that HS can only match known voice commands.

        You are going to have to do a bit more in your script, I would suggest setting a device on the basis of whether you are in work or not today. I would then also set a device on the basis of being in work tommorow.

        I think the easiest way would be to create an event and fill in the voice commands field. When you set up your event with the voice command then run the main part and then at the bottom of the script you can find out which voice command triggered it by testing hs.LastVoiceCommand and finding whether you said tommorow or today. Test for either and then do whatever you want, speech/actions etc.

        Comment

        Working...
        X