Jump to content

Command Tests


James
 Share

Recommended Posts

I was just watching WarGames :P

Films like that always get me going with stuff. So I decided to make this, its a command test that I made. You type in the commands:

exit

notepad

paint

cmd

A voice speaks the command when you have typed it in, thanks to BigDod for that.

#cs
Name: Command Tests
Description: Run commands with a voice reader
CreditL BugDod - Voice help
#ce

#include <GUIConstants.au3>

Dim $voice = ObjCreate("Sapi.SpVoice")

Func Speak($Text, $Rate, $Vol)
$voice.Rate = $Rate
$voice.Volume = $Vol
$voice.Speak($Text)
EndFunc


$CMDTests = GUICreate("Command Tests", 633, 250, 193, 115)
$Group1 = GUICtrlCreateGroup("", 8, 8, 617, 193)
$HelpCommands = GUICtrlCreateEdit("", 16, 24, 601, 169, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, StringFormat("Help:\r\nThe commands for this are:\r\n\r\n* exit\r\n* notepad\r\n* paint\r\n* cmd"))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Commands = GUICtrlCreateInput("", 8, 208, 505, 21)
$SetCommand = GUICtrlCreateButton("Send Command", 520, 208, 105, 25, 0)
GUISetState(@SW_SHOW)

Speak("Welcome to Command Tests. Type in commands to make them run.", 1, 100)

; Set the commands
$cexit = "exit"
$cnotp = "notepad"
$cpait = "paint"
$ccomd = "cmd"

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $SetCommand or $ $Commands
            $exitcommand = GuiCtrlRead($Commands)
            If $exitcommand = $cexit Then
                Speak("Exit", 1, 100)
                Exit
            EndIf
            If $exitcommand = $cnotp Then
                Speak("Notepad", 1, 100)
                Run("notepad.exe")
            EndIf
            If $exitcommand = $cpait Then
                Speak("Paint", 1, 100)
                Run("mspaint.exe")
            EndIf
            If $exitcommand = $ccomd Then
                Speak("Command Prompt", 1, 100)
                Run("cmd.exe")
            EndIf
    EndSwitch
WEnd

Secure

Edited by Secure_ICT
Link to comment
Share on other sites

57 views, no replies?

Secure

I know you feel, my last script I posted here has close to 70 view and no replies... I like your code. I think you should make a way so that the user can insert whatever functions they want, they could add a directory of the program they wanted and in another inputbox they could type the name of the program. Just an idea...

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

  • 1 month later...

Its very nice... But can you

-bind the ENTER key to the Send Command button?

-Make it possible to add stuff like Piano Man said.

-Make it possible to typ when you run it, not that you have to wait untill the voice said her line

Very nice though... Nice & simple :whistle:

Link to comment
Share on other sites

-bind the ENTER key to the Send Command button?

#cs
Name: Command Tests
Description: Run commands with a voice reader
CreditL BugDod - Voice help
#ce

#include <GUIConstants.au3>

Dim $voice = ObjCreate("Sapi.SpVoice")

Func Speak($Text, $Rate, $Vol)
$voice.Rate = $Rate
$voice.Volume = $Vol
$voice.Speak($Text)
EndFunc


$CMDTests = GUICreate("Command Tests", 633, 250, 193, 115)
$Group1 = GUICtrlCreateGroup("", 8, 8, 617, 193)
$HelpCommands = GUICtrlCreateEdit("", 16, 24, 601, 169, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, StringFormat("Help:\r\nThe commands for this are:\r\n\r\n* exit\r\n* notepad\r\n* paint\r\n* cmd"))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Commands = GUICtrlCreateInput("", 8, 208, 505, 21)
$SetCommand = GUICtrlCreateButton("Send Command", 520, 208, 105, 25, 0)
GUISetState(@SW_SHOW)

Speak("Welcome to Command Tests. Type in commands to make them run.", 1, 100)

; Set the commands
$cexit = "exit"
$cnotp = "notepad"
$cpait = "paint"
$ccomd = "cmd"

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $SetCommand OR $Commands
            $exitcommand = GuiCtrlRead($Commands)
            If $exitcommand = $cexit Then
                Speak("Exit", 1, 100)
                Exit
            EndIf
            If $exitcommand = $cnotp Then
                Speak("Notepad", 1, 100)
                Run("notepad.exe")
            EndIf
            If $exitcommand = $cpait Then
                Speak("Paint", 1, 100)
                Run("mspaint.exe")
            EndIf
            If $exitcommand = $ccomd Then
                Speak("Command Prompt", 1, 100)
                Run("cmd.exe")
            EndIf
    EndSwitch
WEnd

Untested.

Link to comment
Share on other sites

  • 1 month later...

-bind the ENTER key to the Send Command button?

CODE
#cs

Name: Command Tests

Description: Run commands with a voice reader

CreditL BugDod - Voice help

#ce

#include <GUIConstants.au3>

Dim $voice = ObjCreate("Sapi.SpVoice")

Func Speak($Text, $Rate, $Vol)

$voice.Rate = $Rate

$voice.Volume = $Vol

$voice.Speak($Text)

EndFunc

$CMDTests = GUICreate("Command Tests", 633, 250, 193, 115)

$Group1 = GUICtrlCreateGroup("", 8, 8, 617, 193)

$HelpCommands = GUICtrlCreateEdit("", 16, 24, 601, 169, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL))

GUICtrlSetData(-1, StringFormat("Help:\r\nThe commands for this are:\r\n\r\n* exit\r\n* notepad\r\n* paint\r\n* cmd"))

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Commands = GUICtrlCreateInput("", 8, 208, 505, 21)

$SetCommand = GUICtrlCreateButton("Send Command", 520, 208, 105, 25, 0)

GUISetState(@SW_SHOW)

Speak("Welcome to Command Tests. Type in commands to make them run.", 1, 100)

; Set the commands

$cexit = "exit"

$cnotp = "notepad"

$cpait = "paint"

$ccomd = "cmd"

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $SetCommand OR $Commands

$exitcommand = GuiCtrlRead($Commands)

If $exitcommand = $cexit Then

Speak("Exit", 1, 100)

Exit

EndIf

If $exitcommand = $cnotp Then

Speak("Notepad", 1, 100)

Run("notepad.exe")

EndIf

If $exitcommand = $cpait Then

Speak("Paint", 1, 100)

Run("mspaint.exe")

EndIf

If $exitcommand = $ccomd Then

Speak("Command Prompt", 1, 100)

Run("cmd.exe")

EndIf

EndSwitch

WEnd

Untested.

lol holy crap...126 notepads opened up before i could stop it :whistle: it seems to want to keep going by itself...
Link to comment
Share on other sites

  • 3 weeks later...

Hey,

Just to fix that problem with the continuous opening of programs. Chip forgot to set the Input back to emtpy otherwise the program keeps reading the input text.

[scroll]

#cs
Name: Command Tests
Description: Run commands with a voice reader
CreditL BugDod - Voice help
#ce

#include <GUIConstants.au3>

Dim $voice = ObjCreate("Sapi.SpVoice")

Func Speak($Text, $Rate, $Vol)
$voice.Rate = $Rate
$voice.Volume = $Vol
$voice.Speak($Text)
EndFunc

$CMDTests = GUICreate("Command Tests", 633, 250, 193, 115)
$Group1 = GUICtrlCreateGroup("", 8, 8, 617, 193)
$HelpCommands = GUICtrlCreateEdit("", 16, 24, 601, 169, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, StringFormat("Help:\r\nThe commands for this are:\r\n\r\n* exit\r\n* notepad\r\n* paint\r\n* cmd"))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Commands = GUICtrlCreateInput("", 8, 208, 505, 21)
$SetCommand = GUICtrlCreateButton("Send Command", 520, 208, 105, 25, 0)
GUISetState(@SW_SHOW)

Speak("Welcome to Command Tests. Type in commands to make them run.", 1, 100)

; Set the commands
$cexit = "exit"
$cnotp = "notepad"
$cpait = "paint"
$ccomd = "cmd"

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $SetCommand OR $Commands
            $exitcommand = GuiCtrlRead($Commands)
            If $exitcommand = $cexit Then
                Speak("Exit", 1, 100)
                GUICtrlSetData($Commands, "")
                Exit
            EndIf
            If $exitcommand = $cnotp Then
                Speak("Notepad", 1, 100)
                GUICtrlSetData($Commands, "")
                Run("notepad.exe")
            EndIf
            If $exitcommand = $cpait Then
                Speak("Paint", 1, 100)
                GUICtrlSetData($Commands, "")
                Run("mspaint.exe")
            EndIf
            If $exitcommand = $ccomd Then
                Speak("Command Prompt", 1, 100)
                GUICtrlSetData($Commands, "")
                Run("cmd.exe")
            EndIf
    EndSwitch
WEnd
[/scroll]

Its just so that if anyone finds it and cannot fix it then they know how to.

Secure

Edited by Secure_ICT
Link to comment
Share on other sites

This reads from the command line and tells you what it is as soon as you press enter.

Opt("WinTitleMatchMode",4)

Dim $voice = ObjCreate("Sapi.SpVoice")
$voice.Rate = 1
$voice.Volume = 100

$Text = ""
While 1
    While WinExists("Classname=#32770","OK")
        $Text = ControlGetText("Classname=#32770","OK",1001)
        Sleep(25)
    WEnd
    If $Text Then $voice.Speak($Text)
    $Text = ""
    Sleep(100)
WEnd
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...