Jump to content

Recommended Posts

Posted

is there a way to create a cmd file with text entered in an edit box

so if in the edit box it says

Echo hi

Echo how are you?

the cmd file will be created with

Echo hi

Echo how are you?

as the lines in it

Posted (edited)

Hi, do mean something like this as a crude example ?

#include <GUIConstants.au3>

$Gui = GuiCreate('Edit To CMD', 400, 300)
$Edit = GuiCtrlCreateEdit('', 10, 10, 380, 250)
$Button = GUICtrlCreateButton('Save', 175, 270, 50, 20)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button
            $Buffer = GuiCtrlRead($Edit)
            $Save = FileSaveDialog('Save to..', @ScriptDir, 'CMD File (*.cmd)', 18, 'MyCmd.cmd')
            If @error <> 1 Then
                FileClose(FileWrite(FileOpen($Save, 2), $Buffer))
            EndIf
    EndSelect
Wend

Cheers

Edited by smashly

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
×
×
  • Create New...