Jump to content

I want make GUI for AutoIt v3


CoooL
 Share

Recommended Posts

Maybe...

#cs ----------------------------------------------------------------------------
    
    AutoIt Version: 3.2.10.0
    Author:         myName
    
    SpeedFan 4.33
    
    Script Function:
    Template AutoIt script.
    
#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <GUIConstants.au3>

Opt("TrayIconDebug", 1)
Opt("SendKeyDelay", 200)

; Executable file name
Dim $EXECUTABLE = "installspeedfan433.exe" 
; Installation folder
Dim $INSTALLLOCATION = @ProgramFilesDir & "\SpeedFan" 

; create the GUI
$GUI = GUICreate("SpeedFan Install")
$Label = GUICtrlCreateLabel("Welcome the the SppedFan Auto-installer", 20, 20, 300, 25)
$Input = GUICtrlCreateInput("Please input your name", 50, 150, 150, 25)
$Button = GUICtrlCreateButton("&Go", 200, 190, 45, 30)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case - 3
            Exit
        Case $Button
            $info = GUICtrlRead($Input)
            Install($info)
    EndSwitch
WEnd


Func Install($name)
    
    If FileExists($INSTALLLOCATION & "\speedfan.exe") Then
        MsgBox(0x40010, @ScriptName, "Please uninstall previous version of SpeedFan before using this script", 4)
        Exit
    Else
        MsgBox(0x0, @ScriptName, $name & " Please press OK to start installation      ")
        Exit ; this exit is only for testing
    EndIf

    ; Run the installer
    Run($EXECUTABLE)

    ; Please, read carefully:
    WinWaitActive("SpeedFan Setup: License Agreement", "Please, read carefully:")
    ControlClick("SpeedFan Setup: License Agreement", "", "Button2")

    ; License Agreement
    WinWaitActive("SpeedFan Setup: Installation Options", "Components")
    ControlClick("SpeedFan Setup: Installation Options", "", "Button2")

    ; Install directory
    WinWaitActive("SpeedFan Setup: Installation Folder", "Install directory")
    ControlSetText("SpeedFan Setup", "", "Edit1", "")
    Sleep(1000)
    ControlSetText("SpeedFan Setup", "", "Edit1", $INSTALLLOCATION)
    ControlClick("SpeedFan Setup: Installation Folder", "", "Button2")

    ; Completed
    WinWaitActive("SpeedFan Setup: Completed", "Completed")
    ControlClick("SpeedFan Setup: Completed", "", "Button2")

EndFunc   ;==>Install

8)

NEWHeader1.png

Link to comment
Share on other sites

If I understand your trying to make a GUI for a user to install that right?

Well just like what Valuater coded, all you really need to do is set the GUI and a couple buttons, along with their variables, maybe a couple options.

To really understand it look for GUI functions and such in the helpfile, thats how I learned to make a usable GUI, the examples explain a lot of it.

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