Sign in to follow this  
Followers 0
Dead_Man

possable to make custom buttons?

10 posts in this topic

like if i made a gui with just one button on it, and when it clicked it executed Run("cmd.exe")

is that possable? :P

Share this post


Link to post
Share on other sites



#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 117, 37, 192, 125)
$Button1 = GUICtrlCreateButton("Notepad", 0, 0, 116, 36)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $Button1
            Run("notepad.exe")
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case Else
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

awsome, thanks, just getting started with the GUI section of auto it

Edited by Dead_Man

Share this post


Link to post
Share on other sites

awsome, thanks, just getting started with the GUI section of auto it

I suggest downloading SciTE/Autoit and use Koda or GuiBuilder, it really simplifies learning about GUI stuff... as well as F1 jumping to the function/macro definition in the included helpfile.

SciTE/Autoit

Share this post


Link to post
Share on other sites

ive been using SciTE for a long ass time, just new to GUI and Koda

Share this post


Link to post
Share on other sites

can anyone tell me how to generate a code like that in Koda?? i can only make a button that does nothing

Share this post


Link to post
Share on other sites

can anyone tell me how to generate a code like that in Koda?? i can only make a button that does nothing

Koda:

=> Tools

=> Generate Code (F9)

=> Insert into SciTE

Exit Koda

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

when i said "like that" i ment adding a code to the button that had the script to open a program

Edited by Dead_Man

Share this post


Link to post
Share on other sites

when i said "like that" i ment adding a code to the button that had the script to open a program

You have to write the code such as:

Case $msg = $Button1
            Run("notepad.exe")
yourself.

:P

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

you can use events too, like in vb:

#include <GUIConstants.au3>

Opt("GUIOnEventMode",1) ;this is the opt to use events
$frmTest = GUICreate("My Form", 415, 307, 292, 192)
$button = GUICtrlCreateButton("Run Notepad", 145, 120, 106, 31, 0)
GUICtrlSetOnEvent($button, "buttonclick")  ;this set a event named "buttonclick" for object $button
;you can use "GuiCtrlSetOnEvent(-1, "buttonclick")" too
GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd
        
Func buttonclick()
    run("notepad.exe")
EndFunc
Edited by gring0

Never judge my awesome brazilian-english language :D:D<-- lol ;P

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