Rawox Posted May 24, 2010 Share Posted May 24, 2010 (edited) Hi,I wanted to create a really simple script for an upcoming LAN-party.I already set up a LAN TeamSpeak 3 Server and when I run 'ts3server_win64.exe' it's up and running. (opens cmd and works)But whenever I try ShellExecute ( $TSPath & "ts3server_win64.exe" ) The cmd pops up for a split second and disappears, which also causes the fact the server doesn't run -.-'Why is this?Thanks in advance, RawoxNote: ts3server_win64.exe needs permission from an adminstrator, but it gets it. Edited May 24, 2010 by Rawox Link to comment Share on other sites More sharing options...
jaberwacky Posted May 24, 2010 Share Posted May 24, 2010 Look in the helpfile entry for ShellExecute about "showflags". Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
bo8ster Posted May 25, 2010 Share Posted May 25, 2010 You can add #RequireAdmin to your script or use RunAs. You will want to use /K when instead of /C when using RunAs. I'm not sure if @SW_MAXIMIZE = Maximized window will work with ShellExecute as when the program terminates, it will disappear. The /K with RunAs will keep the cmd window open after the program has terminated. Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
somdcomputerguy Posted May 25, 2010 Share Posted May 25, 2010 (edited) ShellExecute ( $TSPath & "ts3server_win64.exe" ) Either $TSPath has to end with a backslash, or the string (ts3server_win64.exe) has to begin with one. Edited May 25, 2010 by somdcomputerguy - Bruce /*somdcomputerguy */Â If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Rawox Posted May 25, 2010 Author Share Posted May 25, 2010 (edited) Either $TSPath has to end with a backslash, or the string (ts3server_win64.exe) has to begin with one. That already is Global $TSPath = "C:\Program Files (x86)\TeamSpeak 3 Server\" RunAs will also not work because this does the same... I don't have to think about admin rights because I set the properties of the executable to always run as administrator. And this also doesn't work: ShellExecute ( $TSPath & "ts3server_win64.exe", "", "", "", @SW_MAXIMIZE ) It just pops up and goes away immediatly Edited May 25, 2010 by Rawox Link to comment Share on other sites More sharing options...
bo8ster Posted May 25, 2010 Share Posted May 25, 2010 That already is Global $TSPath = "C:\Program Files (x86)\TeamSpeak 3 Server\" RunAs will also not work because this does the same... I don't have to think about admin rights because I set the properties of the executable to always run as administrator. And this also doesn't work: ShellExecute ( $TSPath & "ts3server_win64.exe", "", "", "", @SW_MAXIMIZE ) It just pops up and goes away immediatly Try something like this Global $TSPath = '"C:\Program Files (x86)\TeamSpeak 3 Server\"' Run (@ComSpec & " /K " & "ts3server_win64.exe", $TSPath) Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
Rawox Posted May 25, 2010 Author Share Posted May 25, 2010 Try something like this Global $TSPath = '"C:\Program Files (x86)\TeamSpeak 3 Server\"' Run (@ComSpec & " /K " & "ts3server_win64.exe", $TSPath) Thanks man! Never got that @ComSpec, seems it's quite useful. It only displays another cmd prompt but I'll just hide that Link to comment Share on other sites More sharing options...
bo8ster Posted May 26, 2010 Share Posted May 26, 2010 Thanks man! Never got that @ComSpec, seems it's quite useful.It only displays another cmd prompt but I'll just hide that If you don't want the cmd window to persist put in /C instead of /K. Go to a cmd window and type "cmd /?" to find out more. I suspect adding the extra quotes fixed the root cause of your issues. @ComSpec is defined in the help file. Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now