Jump to content

Basic button function not working


 Share

Recommended Posts

Not sure what I'm missing besides the ability to code... I am attempting to write a simple application to remotely launch apps as local system. I want to use psexec to launch the code but for some reason I cant even get the button to launch a simple msgbox (button_3). Any guidance is greatly appreciated.

This is my first shot at something a little more complex than a script to launch another script.

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

#include <GuiConstants.au3>

GuiCreate("Run Remote Apps", 301, 239,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input_1 = GuiCtrlCreateInput("", 70, 40, 150, 30)
$Label_2 = GuiCtrlCreateLabel("Remote Computer", 100, 10, 90, 20)
$Button_3 = GuiCtrlCreateButton("Explorer", 10, 90, 80, 30)
$Button_4 = GuiCtrlCreateButton("CMD", 110, 90, 80, 30)
$Button_5 = GuiCtrlCreateButton("Regedit", 210, 90, 80, 30)
$Button_6 = GuiCtrlCreateButton("MSCONFIG", 10, 140, 80, 30)
$Button_7 = GuiCtrlCreateButton("Install VNC", 110, 140, 80, 30)
$Button_8 = GuiCtrlCreateButton("MMC Console", 210, 140, 80, 30)
$Button_9 = GuiCtrlCreateButton("Add/Remove", 10, 190, 80, 30)
$Button_10 = GuiCtrlCreateButton("Acct Mgr", 110, 190, 80, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    ;EndSelect      
    If $msg = $Button_3 Then
        msgbox(0,"x","x")
        ;Run(@ComSpec "/c psexec -s -i \\" & $Input_1 & '"c:\program files\internet explorer\iexplore.exe"')
        ExitLoop

Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

Link to comment
Share on other sites

While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Button_3
             msgbox(0,"x","x")
            $ReadInput = GuiCtrlRead($Input_1) ; <-- To use $Input_1 value you need to get it's value first
            Run(@ComSpec "/c psexec -s -i \\" & $ReadInput & '"c:\program files\internet explorer\iexplore.exe"')
        Case $msg = $Button_4
            ;Do stuff
        Case $msg = $Button_5
            ;Do stuff
        Case $msg = $Button_6
            ;Do stuff
        Case $msg = $Button_7
            ;Do stuff
        Case $msg = $Button_8
            ;Do stuff
        Case $msg = $Button_9
            ;Do stuff
        Case $msg = $Button_10
            ;Do stuff           
    EndSelect
WEnd

Edited by smashly
Link to comment
Share on other sites

Thank you.

Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

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...