hendrikhe Posted May 3, 2017 Share Posted May 3, 2017 (edited) Hello, If I open the my "GUI" program and press "Flush DNS" button it will not execute dnsflush.exe . It only works if I remove #RequireAdmin, no error message :/ GUI: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Test", 615, 437, 192, 124) $FlushDNS = GUICtrlCreateButton("Flush DNS", 24, 56, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $FlushDNS RunWait(@ScriptDir & '\dnsflush.exe') EndSwitch WEnd dnsflush.exe: #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=dnsflush.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> MsgBox(0, "Output", "test") Edited May 3, 2017 by hendrikhe Link to comment Share on other sites More sharing options...
Floops Posted May 3, 2017 Share Posted May 3, 2017 What happens when you put #RequireAdmin in your main script? Link to comment Share on other sites More sharing options...
hendrikhe Posted May 3, 2017 Author Share Posted May 3, 2017 That will work, but in this case I could run the second script directly (it works if I dont execute from GUI). But I want to add some buttons in this GUI later and some can be executed by a normal user and others will need admin. And since the normal user will have access to this GUI and dont want this user executing Admin scripts. Link to comment Share on other sites More sharing options...
jpm Posted May 3, 2017 Share Posted May 3, 2017 Just use ShellExecuteWait(@ScriptDir & '\dnsflush.exe') Link to comment Share on other sites More sharing options...
hendrikhe Posted May 3, 2017 Author Share Posted May 3, 2017 thats it! thank you 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