Jump to content

Recommended Posts

Posted

Hi guys,

I'm relatively new to AutoIt, been messing around with it for a week or so.

I have searched forums for an answer - maybe my terms aren't right or something, but I couldn't garner much information on it. Basically, I'm trying to create a GUI interface similiar to nLite (pics below)

Posted Image

Posted Image

Posted Image

Posted Image

I have made my GUI forms in Koda and put them into an AU3 file. My plan was to make the two forms functions, and call those functions from the main program. Doesn't seem to work properly at all.

I'm including the code here too:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$VersionNumber = "1.0"
$WebsiteAddress = "blahblah.net"
Global $PageNumber = 0

$GUI_ONE = GUICreate("NPW7Lite", 627, 444, 192, 123, -1, BitOR($WS_EX_TRANSPARENT,$WS_EX_WINDOWEDGE))
FirstPage()
$GUI_TWO = GUICreate("NPW7Lite", 627, 444, 192, 123, -1, BitOR($WS_EX_TRANSPARENT,$WS_EX_WINDOWEDGE,$WS_OVERLAPPEDWINDOW))
SecondPage()

func FirstPage()
    $Pic1 = GUICtrlCreatePic("C:\Users\Master\Desktop\nplogo.jpg", 0, 0, 150, 400, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Pic2 = GUICtrlCreatePic("C:\Users\Master\Desktop\Back.jpg", 150, 0, 475, 400, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Title = GUICtrlCreateLabel("Welcome to NPW7Lite", 160, 8, 326, 49)
    GUICtrlSetFont(-1, 24, 400, 0, "Segoe UI")
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    $TextBlock = GUICtrlCreateEdit("", 160, 56, 449, 161, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY), 0)
    GUICtrlSetData(-1, StringFormat("This wizard will guide you through the process of building a custom Windows 7 \r\ninstallation.\r\n\r\nSupported OS:\r\n\r\n - Windows 7 [All Editions]"))
    GUICtrlSetBkColor(-1,0xffffff)
    GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
    $AboutGroup = GUICtrlCreateGroup("About", 160, 312, 449, 73)
    GUICtrlSetBkColor(-1,0xffffff)
    GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
        $WebsiteAddress = GUICtrlCreateLabel($WebsiteAddress, 392, 352, 150, 17)
        GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
        GUICtrlSetBkColor(-1,0xffffff)
        $VersionNumber = GUICtrlCreateLabel($VersionNumber, 392, 328, 78, 17)
        GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
        GUICtrlSetBkColor(-1,0xffffff)
        $Version = GUICtrlCreateLabel("Version", 320, 328, 40, 17)
        GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
        GUICtrlSetBkColor(-1,0xffffff)
        $Website = GUICtrlCreateLabel("Website", 320, 352, 44, 17)
        GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
        GUICtrlSetBkColor(-1,0xffffff)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $NextButton = GUICtrlCreateButton("Next", 317, 408, 75, 25, $WS_GROUP)
    GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
    $CancelButton = GUICtrlCreateButton("Cancel", 544, 408, 75, 25, $WS_GROUP)
    GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
    BackButtonCheck()
    GUISetState(@SW_SHOW)
    
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $CancelButton
                Exit
        ;CHECKS TO SEE IF NEXT BUTTON HAS BEEN CLICKED
            Case $NextButton
                GUISetState(@SW_HIDE)
                Return
        EndSwitch
    WEnd
EndFunc

Func SecondPage()
    $PageNumber = $PageNumber + 1

    $Header = GUICtrlCreatePic("", 0, 0, 626, 50, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Path = GUICtrlCreateInput("", 65, 168, 409, 23)
    GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
    $Button4 = GUICtrlCreateButton("Browse", 486, 166, 75, 25, $WS_GROUP)
    GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
    $CaptionText = GUICtrlCreateLabel("Locating Windows 7 Source", 96, 141, 132, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
    $Pic1 = GUICtrlCreatePic("C:\Users\Master\Desktop\Icon.jpg", 64, 128, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Label1 = GUICtrlCreateLabel("Product Name:", 80, 208, 75, 17)
    $Label2 = GUICtrlCreateLabel("Language:", 80, 232, 55, 17)
    $Label3 = GUICtrlCreateLabel("Service Pack:", 80, 256, 71, 17)
    $Label4 = GUICtrlCreateLabel("Version:", 80, 280, 42, 17)
    $Label5 = GUICtrlCreateLabel("Path:", 80, 304, 29, 17)
    $Label6 = GUICtrlCreateLabel("Size:", 80, 328, 27, 17)
    $SourceProductName = GUICtrlCreateLabel("", 176, 208, 200, 17)
    $SourceLanguage = GUICtrlCreateLabel("", 176, 232, 200, 17)
    $SourceServicePack = GUICtrlCreateLabel("", 176, 256, 200, 17)
    $SourceVersion = GUICtrlCreateLabel("", 176, 280, 200, 17)
    $SourcePath = GUICtrlCreateLabel("", 176, 304, 200, 17)
    $SourceSize = GUICtrlCreateLabel("", 176, 328, 200, 17)
    $NextButton = GUICtrlCreateButton("Next", 317, 408, 75, 25, $WS_GROUP)
    GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
    $CancelButton = GUICtrlCreateButton("Cancel", 544, 408, 75, 25, $WS_GROUP)
    GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
    BackButtonCheck()
    GUISetState(@SW_SHOW)

EndFunc

Func BackButtonCheck()
    If $PageNumber > 0 Then
        $BackButton = GUICtrlCreateButton("Back", 234, 408, 75, 25, $WS_GROUP)
        GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
    Else
        $BackButton = GUICtrlCreateButton("Back", 234, 408, 75, 25, BitOR($WS_GROUP,$WS_DISABLED))
        GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
    EndIf
EndFunc

Func NextButtonCheck()
    If $PageNumber < 6 Then
        $NextButton = GUICtrlCreateButton("Next", 317, 408, 75, 25, $WS_GROUP)
        GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
    Else
        $NextButton = GUICtrlCreateButton("Next", 317, 408, 75, 25, $WS_GROUP)
        GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
    EndIf
EndFunc

#cs
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $CancelButton
            Exit
    ;CHECKS TO SEE IF OK BUTTON HAS BEEN CLICKED
        Case $NextButton
            GUISetState(@SW_HIDE)
            Return
    EndSwitch
WEnd
#ce
Posted (edited)

Sorry, me not native english written either ;]. Let me rephrase it. Can you explain what or where it's going wrong?

Basically, it opens the first GUI screen, which looks like this:

Posted Image

You click on Next, you see the next screen for a split second and it exits

Hope that helps

Oh and also, there's an error in the code, should look like the following

$GUI_TWO = GUICreate("NPW7Lite", 627, 444, 192, 123, -1, BitOR($WS_EX_TRANSPARENT,$WS_EX_WINDOWEDGE))

Its near the top, just before the call to SecondPage()

Edited by niteshade
Posted (edited)

you have a return in with the button...

EDIT

i deleted my double post... my bad... well... stupid dialups problem

Edited by CodyBarrett
Posted

No problem, you could keep it outside but then there would be a scope issues. Id you still unsure what variable scope is you should read about it under Local or Dim or Global in the help file which will take you to the Keyword Reference and explain what is their scope meaning. If you already know, ignore me. ;]

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
×
×
  • Create New...