Sign in to follow this  
Followers 0
HackerZer0

GUI... help me plz...

5 posts in this topic

how could i make this script run somthing when somthing was typed into the input box?

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 85,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input_1 = GuiCtrlCreateInput("", 30, 30, 220, 30)
$Button_2 = GuiCtrlCreateButton("Send", 280, 30, 90, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

for example... i want it to run notepad, but only if i type "notepad" if i type anything else i want to have a msgbox pop up...

im really new to the gui part of autoit plz help me

Share this post


Link to post
Share on other sites



#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

GUICreate("MyGUI", 392, 85, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input_1 = GUICtrlCreateInput("", 30, 30, 220, 30)
$Button_2 = GUICtrlCreateButton("Send", 280, 30, 90, 30)

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_2
            If GUICtrlRead($Input_1) = "Notepad" Then
                MsgBox(0,"notepad", "typed")
            Else
                MsgBox(0,"Something else", "typed")
            EndIf
        Case Else
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

ok one more question...

how would i make the script read the input from the box, and execute it as if it were a line in an autoit script?

example:

i type

Run("notepad.exe")

and click "Send"

i want it to run notepad,

-OR-

if i type

WinSetTrans("Untitled - Notepad", "", 178)

I want it to change the transparency...

THX : )

Share this post


Link to post
Share on other sites

Something like this might help:

CODE
;$UserInputBox is the input box you created

$RunInput = GUICtrlRead($UserInputBox,1)

If $RunInput = "" Then

MsgBox(160,"Input Required","Please enter path and name of program you wish to run")

Else

$PathVerify = FileExists($RunInput)

IF $PathVerify = 1 Then

Run($RunInput)

Else

MsgBox(16,"Error","Invalid File / Path does not exist")

EndIf

EndIf

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  
Followers 0