Jump to content

Command Interpreter


JustinReno
 Share

Recommended Posts

I made a simple command line interpreter with some functions. There isn't much to it.

Commands:

Help : Shows all commands.

Exit : Exits the program

Shutdown : Shutdown the computer.

Play : Plays a sound (Play C:\Windows\Media\Notify.wav)

GeneratePassword : Generates simple to complex passwords (GeneratePassword LENGTH) (GeneratePassword 100)

FileCreate : Creates a text file (FileCreate C:\Test.txt TEXTGOESHERE!) (FileCreate C:\Test.txt Hey!) No spaces can be in the text!

Run : Runs a program/document/picture (Run C:\Image.bmp)

Flash! (Undocumented)

HotKeySet("{Enter}", "_Send")

$GUI = GUICreate("Command Interpreter", 587, 306)
GUISetFont(10, 800, 0, "MS Sans Serif")
$Edit = GUICtrlCreateEdit("", 0, 0, 585, 305, 4288 + 0x00200000)
GUICtrlSetLimit($Edit, 100000)
GUICtrlSetFont($Edit, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor($Edit, 0xFFFFFF)
GUICtrlSetBkColor($Edit, 0x000000)
GUISetState(@SW_SHOW, $GUI)

While 1
    Switch GUIGetMsg()
        Case - 3
            Exit
    EndSwitch
WEnd

Func _Send()
    If GUICtrlRead($Edit) = "Exit" Then Exit
    If GUICtrlRead($Edit) = "Help" Then GUICtrlSetData($Edit, "Exit, Shutdown, Play, GeneratePassword, FileCreate, Run")
    If GUICtrlRead($Edit) = "Shutdown" Then Shutdown(1)
    If StringInStr(GUICtrlRead($Edit), "Play") Then
        $GetSoundPath = StringSplit(GUICtrlRead($Edit), " ")
        SoundPlay($GetSoundPath[2], 0)
        GUICtrlSetData($Edit, "")
    EndIf
    If StringInStr(GUICtrlRead($Edit), "GeneratePassword") Then
        $GetPasswordLength = StringSplit(GUICtrlRead($Edit), " ")
        GUICtrlSetData($Edit, "")
        GUICtrlSetData($Edit, _GeneratePassword($GetPasswordLength[2]))
    EndIf
    If StringInStr(GUICtrlRead($Edit), "FileCreate") Then
        $GetFilePath = StringSplit(GUICtrlRead($Edit), " ")
        FileWrite($GetFilePath[2], $GetFilePath[3])
        ShellExecute($GetFilePath[2])
        GUICtrlSetData($Edit, "")
    EndIf
    If StringInStr(GUICtrlRead($Edit), "Run") Then
        $GetFilePath = StringSplit(GUICtrlRead($Edit), " ")
        ShellExecute($GetFilePath[2])
        GUICtrlSetData($Edit, "")
    EndIf
    If GUICtrlRead($Edit) = "Flash!" Then _Flicker()
EndFunc

Func _GeneratePassword($I_Length)
    Local $Password
    $GetCharacters = StringSplit("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()", "")
    For $I = 1 To $I_Length
        $Password &= $GetCharacters[Random(1, 71, 1)]
    Next
    Return $Password
EndFunc

Func _Flicker()
    $GUI = GUICreate("", @DesktopWidth + 100, @DesktopHeight + 100, -1, -1, 0x80000000)
    GUISetState(@SW_SHOW, $GUI)
    For $I = 1 To 1000
        GUISetBkColor(Random(0, 10000000000, 1), $GUI)
    Next
    GUIDelete($GUI)
EndFunc

Comments are really appreciated. Thanks. :)

Edited by JustinReno
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...