Jump to content

Browse files to setup - (Moved)


 Share

Recommended Posts

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

  • Moderators

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

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

#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

 

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