Jump to content
Sign in to follow this  
gil900

Exe Sender tool

Recommended Posts

gil900

Hello,
this tool make it easy to send Commands to exe's like ffmpeg.exe and more

Image and Example of use:

2v8o4ed.jpg

Download:

exe sender by gil 900.rar

Source Code:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Global $set1 = @ScriptDir&"\"&"Settings.ini" , $txt1 = @ScriptDir&"\"&"Saved commands.txt"
Global $ExeFile , $ExeName

MainGui()
LoadSettings()

While 1
    Sleep(50)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $ExeBrowse
            SelectExe()
        Case $SavedCommands_gui
            ShellExecute($txt1)
        Case $SendCommand_gui
            SendToExe()
    EndSwitch
WEnd


Func MainGui()
Global $Form1 = GUICreate("exe sender (made by gil900)", 561, 224, 349, 307)
Global $ExeCommand_gui = GUICtrlCreateEdit("", 16, 80, 513, 73)
$Label1 = GUICtrlCreateLabel("Exe File:", 32, 24, 106, 36)
GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")
Global $ExeBrowse = GUICtrlCreateButton("Browse for exe", 328, 24, 105, 41)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
Global $ExeName_gui = GUICtrlCreateLabel("", 130, 32, 148, 36)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Global $SendCommand_gui = GUICtrlCreateButton("Send Command", 184, 168, 177, 49)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlSetState(-1,$GUI_DISABLE)
$Label2 = GUICtrlCreateLabel("Created by gil900", 248, 8, 86, 17)
Global $SavedCommands_gui = GUICtrlCreateButton("Saved commands", 440, 24, 107, 41)
GUISetState(@SW_SHOW)
EndFunc


Func SendToExe()
    $cmd = GUICtrlRead($ExeCommand_gui)
    If $cmd <> "" Then
        ;ConsoleWrite($ExeFile&" "&$cmd)
        Run($ExeFile&" "&$cmd)
    Else
        MsgBox(0,"ERROR","no command for the exe")
    EndIf
EndFunc

Func LoadSettings()
    $ExeFile = IniRead($set1,"Settings","ExeFile","")
    ReturnExeName($ExeFile)
EndFunc

Func SelectExe()
    $ExeFile = FileOpenDialog("Select the EXE file",@ScriptDir,"Exe Files (*.exe)")
    If Not @error Then
        ;MsgBox(0,"",$ExeFile)
        ReturnExeName($ExeFile)
        If $ExeName <> "" Then
            UpdateSettings($ExeFile)
        EndIf
    EndIf
EndFunc

Func ReturnExeName($file)
    If $file <> "" Then
        $var = StringSplit($file,"\",1)
        $var2 = StringSplit($var[$var[0]],".",1)
        If $var2[0] = 2 Then
            If $var2[2] = "exe" Then 
                $ExeName = $var[$var[0]]
            Else
                $ExeName = ""
            EndIf
        Else
            $ExeName = ""
        EndIf
    EndIf
    If $ExeName <> "" Then
        GUICtrlSetData($ExeName_gui,$ExeName)
        GUICtrlSetState($SendCommand_gui,$GUI_ENABLE)
    EndIf
EndFunc

Func UpdateSettings($file)
    IniWrite($set1,"Settings","ExeFile",$file)
EndFunc

Hope you liked it!
Enjoy!

(Originally posted here)

Edited by gil900

Share this post


Link to post
Share on other sites
wakillon

Can be helpful ! thanks.

But avoid to declare Global variables inside functions.

Suggestions :

A contextual Menu for exefiles could be added...

Why not capture executable output and display it in your gui ?  :)


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
gil900

But avoid to declare Global variables inside functions.

 

I wrote this a long time ago and I did not know that...

Anyway, I'm not going to change the script because there is no reason.

This tool works and is very useful.

It would be a waste of time for me .. If you want, you can improve it.

 

A contextual Menu for exefiles could be added...

It is a good idea. But I do not have time for it .. You are welcome to improve it and add more options!

 

Why not capture executable output and display it in your gui ?  :)

Why yes?

This tool is designed to be very basic and is designed to be used with any type of exe file.

Not all exe files are opening dos window.

It is designed to be just exe sender and no more.

It is designed for people who want to test their scripts and for people who want to send parameters to exe files in easy way..

Thanks for the response :)

Edited by gil900

Share this post


Link to post
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
Sign in to follow this  

×