Jump to content

Opening other .exe's in a GUI (Button)


snn
 Share

Recommended Posts

I've tried "fileopen", "execute" and "Run" but none of them worked properly.

I'm trying to get something like this done...except something that works. <_<

I've gotten taskmgr.exe to work though.

#include <GUIConstants.au3>

$Form1 = GUICreate("Server Control Panel", 634, 454, 192, 115)
$TeamSpeak = GUICtrlCreateGroup("Team Speak", 8, 8, 289, 65)
$Button1 = GUICtrlCreateButton("Administrator CP", 16, 32, 97, 25, 0)
$Button2 = GUICtrlCreateButton("Start Team Speak", 128, 32, 113, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group1 = GUICtrlCreateGroup("Server Sided Files", 312, 8, 297, 65)
$Button3 = GUICtrlCreateButton("Task Manager ", 320, 32, 97, 25, 0)
$Button4 = GUICtrlCreateButton("Open C:", 432, 32, 73, 25, 0)
$Button5 = GUICtrlCreateButton("Open D:", 520, 32, 73, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label1 = GUICtrlCreateLabel("This control panel is a server management console, to make server management easier.", 8, 416, 440, 17)
$MenuItem1 = GUICtrlCreateMenu("&File")
$MenuItem2 = GUICtrlCreateMenuItem("Close", $MenuItem1)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $MenuItem2
    Exit
Case $Button2
    run( "D:\Billy\Teamspeak\server_windows.exe" )
Case $Button1
    run( "iexplore.exe 'http://localhost:14534/slogin.html'" )
Case $Button5
    FileOpen( "D:\" )
Case $Button4
    FileOpen( "C:\" )
Case $Button3
    run( 'taskmgr.exe' )
EndSwitch
WEnd

Thanks for tips or any help.

Link to comment
Share on other sites

For opening C: and D: ,you'll need explorer.exe ( I think)

so,

run("explorer.exe C:")

Also, if I remember right, I dont think you need the ' ' in the web page one, so

run( "iexplore.exe http://localhost:14534/slogin.html" )

Hope I helped, Cheers

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

Hi, maybe try ShellExecute()

#include <GUIConstants.au3>

$Form1 = GUICreate("Server Control Panel", 634, 454, 192, 115)
$TeamSpeak = GUICtrlCreateGroup("Team Speak", 8, 8, 289, 65)
$Button1 = GUICtrlCreateButton("Administrator CP", 16, 32, 97, 25, 0)
$Button2 = GUICtrlCreateButton("Start Team Speak", 128, 32, 113, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group1 = GUICtrlCreateGroup("Server Sided Files", 312, 8, 297, 65)
$Button3 = GUICtrlCreateButton("Task Manager ", 320, 32, 97, 25, 0)
$Button4 = GUICtrlCreateButton("Open C:", 432, 32, 73, 25, 0)
$Button5 = GUICtrlCreateButton("Open D:", 520, 32, 73, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label1 = GUICtrlCreateLabel("This control panel is a server management console, to make server management easier.", 8, 416, 440, 17)
$MenuItem1 = GUICtrlCreateMenu("&File")
$MenuItem2 = GUICtrlCreateMenuItem("Close", $MenuItem1)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $MenuItem2
            Exit
        Case $Button1
            ShellExecute("http://localhost:14534/slogin.html")
        Case $Button2
            ShellExecute("D:\Billy\Teamspeak\server_windows.exe")
        Case $Button3
            ShellExecute("taskmgr.exe")
        Case $Button4
            ShellExecute("explorer.exe", "/e,C:\")              
        Case $Button5
            ShellExecute("explorer.exe", "/e,D:\")
    EndSwitch
WEnd

Edited by smashly
Link to comment
Share on other sites

Thanks guys. $Button2 (Open teamspeak) and task manager were the only things working.

I'll try the examples you guys have provided and update this post with a result. <_<

Okay I've gotten C: and D: to work thanks to MethodZero, though iexplore isn't working yet.

EDIT2: ShellExecute worked for IE, thanks guys! :)

Edited by snn
Link to comment
Share on other sites

Well, if it comes down to it, you can use:

#include <IE.au3>

_IECreate("http://localhost:14534/slogin.html")

But I dunno it might be a prob with the localhost part of it. im not sure

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

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