Alexandre Posted September 1, 2020 Share Posted September 1, 2020 Hello I under if any one can gvie any ideias how to create a form to search one setup file to run in adicional windown I'm creating a program to user to run several apps in admin mode without admin privelegies and need to browser on setup file to install it. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 1, 2020 Moderators Share Posted September 1, 2020 Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Alexandre Posted September 1, 2020 Author Share Posted September 1, 2020 This is the code mabe by now #include <GUIConstantsEx.au3> AltranAdmin() Func AltranAdmin() ;Change UAC Settings RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA","REG_SZ", "0") ; Create a GUI with various controls. ; Local $hGUI = GUICreate("AltranAdmin", 1920, 100, @DesktopWidth - 300, @DesktopHeight - 300) Local $hGUI = GUICreate("Altran Admin Tool", 300, 300, @DesktopWidth - 400, @DesktopHeight - 400, "$WS_EX_TOPMOST") ; Create a button control. Local $sUserName = "sup-analmeida" Local $sPassword = "Alex01dc01" Local $idButton_Services = GUICtrlCreateButton("Services", 10, 10, 85, 25) Local $idButton_cmd = GUICtrlCreateButton("Cmd", 10, 40, 85, 25) Local $idButton_Close = GUICtrlCreateButton("Close", 10, 70, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $iPID = 0 ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idButton_Services ; Run SERVICES. Run('mmc "services.msc"') Case $idButton_cmd ;Run CMD. ;Run("C:\WINDOWS\system32\cmd.exe") ;Run(@ComSpec & " /c " & 'C:\windows\system32\sysdm.cpl', "", @SW_HIDE) Run("rundll32 sysdm.cpl,EditEnvironmentVariables") EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) ; Close the Notepad process using the PID returned by Run. If $iPID Then ProcessClose($iPID) EndFunc ;==>Example Link to comment Share on other sites More sharing options...
Alexandre Posted September 1, 2020 Author Share Posted September 1, 2020 I need to create another button to search fsetup files nad run it Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted September 1, 2020 Share Posted September 1, 2020 @Alexandre You may want to use Koda to design and build the code for your form, and watch out to the styles you apply to the form, which are not enclosed in double quotes Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Alexandre Posted September 2, 2020 Author Share Posted September 2, 2020 Hello Franceco, Tank you for your reply, i'm new to Koda can you give any help or templado of koda for what i need to do? Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted September 2, 2020 Share Posted September 2, 2020 @Alexandre Where are you having troubles? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Zedna Posted September 2, 2020 Share Posted September 2, 2020 expandcollapse popup#include <GUIConstantsEx.au3> AltranAdmin() Func AltranAdmin() ;Change UAC Settings ;~ RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", "REG_SZ", "0") ; Create a GUI with various controls. ; Local $hGUI = GUICreate("AltranAdmin", 1920, 100, @DesktopWidth - 300, @DesktopHeight - 300) Local $hGUI = GUICreate("Altran Admin Tool", 300, 300, @DesktopWidth - 400, @DesktopHeight - 400, "$WS_EX_TOPMOST") ; Create a button control. Local $sUserName = "sup-analmeida" Local $sPassword = "Alex01dc01" Local $idButton_Services = GUICtrlCreateButton("Services", 10, 10, 85, 25) Local $idButton_cmd = GUICtrlCreateButton("Cmd", 10, 40, 85, 25) Local $idButton_Close = GUICtrlCreateButton("Close", 10, 70, 85, 25) Local $idButton_search = GUICtrlCreateButton("Search", 10, 130, 85, 25) ; added by Zedna ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $iPID = 0 ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idButton_Services ; Run SERVICES. Run('mmc "services.msc"') Case $idButton_cmd ;Run CMD. ;Run("C:\WINDOWS\system32\cmd.exe") ;Run(@ComSpec & " /c " & 'C:\windows\system32\sysdm.cpl', "", @SW_HIDE) Run("rundll32 sysdm.cpl,EditEnvironmentVariables") Case $idButton_search ; added by Zedna $path = FileOpenDialog('Choose setup file', @ScriptDir & "\", "EXE files (*.exe;*.cmd)", 1+2) If @error Then ;~ MsgBox(4096,"","No File chosen") Else Run($path) EndIf EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) ; Close the Notepad process using the PID returned by Run. ;~ If $iPID Then ProcessClose($iPID) EndFunc ;==>AltranAdmin Resources UDF ResourcesEx UDF AutoIt Forum Search 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