Jump to content

MetroGUI UDF v5.1 - Windows 10 style buttons, toggles, radios, menu etc.


Recommended Posts

On 21.2.2016 at 11:01 PM, legend said:

can you show an example of how to have multiple gui windows, so if you click a button,

it will create a new gui, and when you X it, then it removes the GUI again.

I tried that, but it will make the orginal gui stock, and not able to be moved

 

You can use this example. To call it, just use this:

_GUIDisable($Form1, 0, 30);For better visibility of the second GUI
_SecondGUI()
_GUIDisable($Form1)
Func _SecondGUI()
    $Form2 = _Metro_CreateGUI("Example 2", 500, 300, -1, -1, True, True)

    ;Set variables
    $GUI_HOVER_REG2 = $Form2[1]
    $GUI_CLOSE_BUTTON_GUI2 = $Form2[2]
    $Form2 = $Form2[0]
    GUISetState(@SW_SHOW)
    
    While 1
        _Metro_HoverCheck_Loop($GUI_HOVER_REG2, $Form2);Add hover check in loop
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON_GUI2
                _Metro_GUIDelete($GUI_HOVER_REG2, $Form2)
                _GUI_DragAndResizeUpdate($Form1);Update the first GUI to properly support drag/resize again. (Only needed if you created 2 guis with control buttons(close,minimize,maximize))
                Return 0
        EndSwitch
    WEnd
    
EndFunc   ;==>_SecondGUI

 

On 1.3.2016 at 3:33 PM, lampel said:

how can i add a text edit control (GUICtrlCreateEdit) ???

 

thanks lampel

There is no function for a metro style edit. But you can use "0" as ex-style parameter to make it look modern/flat:

$Edit1 = GUICtrlCreateEdit("", 15, 285, 430, 213, BitOR($ES_AUTOVSCROLL, $ES_READONLY, $WS_VSCROLL), 0)

 

On 8.3.2016 at 10:29 PM, legend said:

Is it really not possible to change the state of a radiobox, but only a toggle and a checkbox,

why would there even be a radiobox in the udf, if you can't check if it's selected or not 0_o

http://prntscr.com/ad909v

I never needed that before. As given in the example, I usually execute what has to be done after the user selects a radio :)

But I will update the UDF today and add that check function + example.

 

21 hours ago, nuhan said:

hi,

i want to use  MetroGUI UDF v3  in my script. I need help to create a message box using  _Metro_MsgBox. but in metro udf MsgBox  contains only one button i need two button in my message box. And also i have to run some code if user click on each button in msgbox. Please help me.

 

As written via PM, this can be done with a custom gui or by simply copying the default metro msgbox function and modifying it. If I find some time, i will try to update the message box function to support the default button types that the normal MsgBox of Autoit also supports. 

Link to post
Share on other sites
  • Replies 280
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Features: Create modern looking borderless and resizable GUIs with control buttons (Close,Maximize/Restore,Minimize, Fullscreen, Menu) True borderless, resizeable GUI with full support fo

I know I disappointed some of you guys with this version as you were waiting for the requested features like Sliders, InputBox, Support for tabbing through controls and other stuff. I spent a lot of t

Version 4.3 - Changelog - 13.07.2016 Bugfixes: Fixed a bug where the fullscreen button was misplaced on different DPI sizes. Fixed a bug where the maximized window was not properly o

Posted Images

2 minutes ago, BBs19 said:

 

You can use this example. To call it, just use this:

_GUIDisable($Form1, 0, 30);For better visibility of the second GUI
_SecondGUI()
_GUIDisable($Form1)
Func _SecondGUI()
    $Form2 = _Metro_CreateGUI("Example 2", 500, 300, -1, -1, True, True)

    ;Set variables
    $GUI_HOVER_REG2 = $Form2[1]
    $GUI_CLOSE_BUTTON_GUI2 = $Form2[2]
    $Form2 = $Form2[0]
    GUISetState(@SW_SHOW)
    
    While 1
        _Metro_HoverCheck_Loop($GUI_HOVER_REG2, $Form2);Add hover check in loop
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON_GUI2
                _Metro_GUIDelete($GUI_HOVER_REG2, $Form2)
                _GUI_DragAndResizeUpdate($Form1);Update the first GUI to properly support drag/resize again. (Only needed if you created 2 guis with control buttons(close,minimize,maximize))
                Return 0
        EndSwitch
    WEnd
    
EndFunc   ;==>_SecondGUI

 

There is no function for a metro style edit. But you can use "0" as ex-style parameter to make it look modern/flat:

$Edit1 = GUICtrlCreateEdit("", 15, 285, 430, 213, BitOR($ES_AUTOVSCROLL, $ES_READONLY, $WS_VSCROLL), 0)

 

I never needed that before. As given in the example, I usually execute what has to be done after the user selects a radio :)

But I will update the UDF today and add that check function + example.

 

As written via PM, this can be done with a custom gui or by simply copying the default metro msgbox function and modifying it. If I find some time, i will try to update the message box function to support the default button types that the normal MsgBox of Autoit also supports. 

Great job, thank you!

Link to post
Share on other sites

Updated UDF to v3.5

  • Updated Metro Msgbox function to support different button combinations like the default MsgBox function in Autoit.(See Help file for the button combination flags)
  • Added function "_Metro_RadioIsChecked" due to request.
  • Changed default font to Arial because "Calibri Light" is not installed on all Windows 7 computers.
  • Updated example.
Link to post
Share on other sites
On 5/6/2014 at 3:06 AM, BBs19 said:

Features:

  • Create modern looking borderless and resizable GUIs with control buttons (Close,Maximize/Restore,Minimize)
  • Many color schemes/themes included. See MetroThemes.au3 for more details.
  • 2 type of Windows 8/10 style buttons.
  • Metro style checkboxes, radios, toggles and progressbar.
  • All buttons, checkboxes etc. have hover effects!
  • Windows 10 style modern MsgBox.


Example(Image): 

1.png.26f122bd1cde2d6226fd0b0e22072181.p

Hover effect of the control buttons:

2.png.77d74cdc1b71db39a3050459e908cca9.p

Windows 10-Style MsgBox:

3.png.c97a5309bcec9e06fbce528a98dbb926.p

 

Example:

#NoTrayIcon
#include "MetroGUI_UDF.au3"


;=======================================================================Creating the GUI===============================================================================
;Set Theme
_SetTheme("DarkTeal") ;See MetroThemes.au3 for selectable themes or to add more

;Create resizable Metro GUI
$Form1 = _Metro_CreateGUI("Example", 500, 300, -1, -1, True, True); Returns an array, see below how to use it:

;Set a variable name for the Hover-Reg Array that contains all the needed data for the hover effects. You will be needing this for almost every action. Name it wisely.
$GUI_HOVER_REG = $Form1[1]

;Set variables for the handles of the GUI-Control buttons (Close/Maximize/Restore/Minimize)
$GUI_CLOSE_BUTTON = $Form1[2]
$GUI_MAXIMIZE_BUTTON = $Form1[3]
$GUI_RESTORE_BUTTON = $Form1[4]
$GUI_MINIMIZE_BUTTON = $Form1[5]

;Set GUI/Form handle from the _Metro_CreateGUI return array.
$Form1 = $Form1[0]
;======================================================================================================================================================================

;Create Metro Buttons
$Button1 = _Metro_CreateButton($GUI_HOVER_REG, "Button Style 1", 105, 250, 130, 40)
$Button2 = _Metro_CreateButtonEx($GUI_HOVER_REG, "Button Style 2", 255, 250, 130, 40)

;Create Checkbox
$Checkbox1 = _Metro_CreateCheckbox($GUI_HOVER_REG, "Checkbox 1", 30, 70, 125, 30)
_Metro_CheckboxCheck($GUI_HOVER_REG, $Checkbox1)

;Create 2 Radios that are assigned to Radio Group 1
$Radio1 = _Metro_CreateRadio($GUI_HOVER_REG, 1, "Radio 1", 180, 70, 100, 26)
$Radio2 = _Metro_CreateRadio($GUI_HOVER_REG, 1, "Radio 2", 180, 110, 100, 26)
_Metro_RadioCheck($GUI_HOVER_REG, 1, $Radio1)

;Create Toggle
$Toggle1 = _Metro_CreateToggle($GUI_HOVER_REG, "Toggle 1", 320, 70, 130, 22)

;Create Progressbar
$Progress1 = _Metro_CreateProgress(100, 180, 300, 26)

;Set resizing options for the controls
GUICtrlSetResizing($Button1, 768 + 8)
GUICtrlSetResizing($Button2, 768 + 8)
GUICtrlSetResizing($Checkbox1, 768 + 2 + 32)
GUICtrlSetResizing($Radio1, 768 + 2 + 32)
GUICtrlSetResizing($Radio2, 768 + 2 + 32)
GUICtrlSetResizing($Toggle1, 768 + 2 + 32)
GUICtrlSetResizing($Progress1[0], 768 + 2 + 32)


GUISetState(@SW_SHOW)


While 1
    _Metro_HoverCheck_Loop($GUI_HOVER_REG, $Form1);This hover check has to be added to the main While loop, otherwise the hover effects won't work.
    $nMsg = GUIGetMsg()
    Switch $nMsg
        
        ;=========================================Control-Buttons===========================================
        Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON
            _Metro_GUIDelete($GUI_HOVER_REG, $Form1)
            Exit
        Case $GUI_MAXIMIZE_BUTTON
            GUISetState(@SW_MAXIMIZE)
        Case $GUI_RESTORE_BUTTON
            GUISetState(@SW_RESTORE)
        Case $GUI_MINIMIZE_BUTTON
            GUISetState(@SW_MINIMIZE)
            ;===================================================================================================
            
        Case $Button2
            _GUIDisable($Form1, 0, 30);For better visibility of the MsgBox on top of the first GUI.
            _Metro_MsgBox(0, "Metro MsgBox Example", "Button 2 clicked.", 400, 12, $Form1)
            _GUIDisable($Form1)
            
        Case $Button1
            _GUIDisable($Form1, 0, 30)
            _Metro_MsgBox(0, "Metro MsgBox Example", "Press ok to set progressbar.", 350, 13, $Form1)
            _GUIDisable($Form1)
            For $i = 0 To 85 Step +2
                Sleep(1)
                _Metro_SetProgress($Progress1, $i)
            Next
            _GUIDisable($Form1, 0, 30)
            Local $Select_YesNo = _Metro_MsgBox(4, "Metro MsgBox Example", "Select yes to create a second GUI.", 350, 13, $Form1)
            If $Select_YesNo = "Yes" Then _SecondGUI()
            _GUIDisable($Form1)
            
        Case $Toggle1
            If _Metro_ToggleIsChecked($GUI_HOVER_REG, $Toggle1) Then
                _Metro_ToggleUnCheck($GUI_HOVER_REG, $Toggle1)
                ConsoleWrite("Toggle unchecked!" & @CRLF)
            Else
                _Metro_ToggleCheck($GUI_HOVER_REG, $Toggle1)
                ConsoleWrite("Toggle checked!" & @CRLF)
            EndIf
            
        Case $Checkbox1
            If _Metro_CheckboxIsChecked($GUI_HOVER_REG, $Checkbox1) Then
                _Metro_CheckboxUnCheck($GUI_HOVER_REG, $Checkbox1)
                ConsoleWrite("Checkbox unchecked!" & @CRLF)
            Else
                _Metro_CheckboxCheck($GUI_HOVER_REG, $Checkbox1)
                ConsoleWrite("Checkbox checked!" & @CRLF)
            EndIf
            
        Case $Radio1
            _Metro_RadioCheck($GUI_HOVER_REG, 1, $Radio1)
            ConsoleWrite("Radio 1 selected!" & @CRLF)
            
        Case $Radio2
            _Metro_RadioCheck($GUI_HOVER_REG, 1, $Radio2)
            ConsoleWrite("Radio 2 selected = " & _Metro_RadioIsChecked($GUI_HOVER_REG, 1, $Radio2) & @CRLF)
    EndSwitch
WEnd



Func _SecondGUI()
    $Form2 = _Metro_CreateGUI("Example 2", 800, 600, -1, -1, True, True)

    ;Set variables for a second gui
    $GUI_HOVER_REG2 = $Form2[1]
    $GUI_CLOSE_BUTTON_GUI2 = $Form2[2]
    $Form2 = $Form2[0]
    GUISetState(@SW_SHOW)
    
    While 1
        _Metro_HoverCheck_Loop($GUI_HOVER_REG2, $Form2);Add hover check in loop
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON_GUI2
                _Metro_GUIDelete($GUI_HOVER_REG2, $Form2);Delete GUI/release resources
                _GUI_DragAndResizeUpdate($Form1);Update the first GUI to properly support drag/resize again. (Only needed if you created 2 guis with control buttons(close,minimize,maximize))
                Return 0
        EndSwitch
    WEnd
    
EndFunc   ;==>_SecondGUI

 

Credits: UEZ, for the function to create buttons with text using GDIPlus.

Changelog v3.5:

  • Updated Metro Msgbox function to support different button combinations like the default MsgBox function in Autoit.(See Help file for the button combination flags)
  • Added function "_Metro_RadioIsChecked" due to request.
  • Changed default font to Arial because "Calibri Light" is not installed on all Windows 7 computers.
  • Updated example.

 

Download UDF:

 

MetroGUI UDF v3.5.zip

hi  , when i try to use _Metro_MsgBox   error message shows - "warning: $MSGBOX_HOVER_REG: possibly used before declaration." where is the problem? Thanks in advance for your help.

Link to post
Share on other sites
  • 4 weeks later...

Well, same problem as above...

I check the syntax, fine... compile fine... when I run the binary compiled, returns an error of a variable used before declaration on line 11674. I already checked most includes the UDF uses, none of the files return syntax problems. It's like a dead end... sadly.

Windows 10 Pro 64 Bits here, latest version of SciTE and compiling x86 of course.

UPDATE 1:
I used Exe2Aut to decompile my script and check said line:
 

_gdiplus_fontdispose($hfont)

Still, there's no variable being used without declaration...

UPDATE 2:

Seems the progress bar functions in this UDF are not compatible with updates made in the GDIPlus, like these functions in the MetroGUI UDF:

Local $ProgressBGPen = _GDIPlus_PenCreate($Progress[5], 2)

In the GDIPlus the function doesn't receive parameters as called:
 

Func _GDIPlus_PenCreate($iARGB = 0xFF000000, $nWidth = 1, $iUnit = 2)
    Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipCreatePen1", "dword", $iARGB, "float", $nWidth, "int", $iUnit, "handle*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    If $aResult[0] Then Return SetError(10, $aResult[0], 0)

    Return $aResult[4]
EndFunc

The strange part, is the example script runs just fine... I'll attach my test script if anyone is kind to point out where's my stupid error.

UPDATE 3:

Well, it worked after I removed the GUI creation from inside a function, why? I really don't know... now I can't make the label show up.

UPDATE 4:

It worked okay now. Declare the variable that will handle the MetroGUI object at the start of the script with a 0 if you want different functions to handle it.

I left all the updates if someone needs the "thought process" to solve the problem.

Edited by LFCavalcanti
Update

--

"There is a way out of every box, a solution to every puzzle; it's just a matter of finding it." - Picard, Jean-Luc

Link to post
Share on other sites

UDF V4 will be coming in the next 2 weeks :)

New features(finished already):

  • Usage of the UDF got much easier,  using/declaring a variable for GUI_HOVER_REG is no longer required and therefore it is not needed for all actions anymore.
  • Full support for high dpi screens / automated scaling of the gui and all metro controls for a sharp looking GUI with 4k screens
  • 2 new modern checkbox types
  • 2 new modern toggles
  • Control buttons with inactivity colors (to indicate that the window is inactive)
  • Hover effects now also work when the gui is inactive but visible.
  • Many bug fixes.

And some other things I planned like a Windows 10 style menu but didn't find time yet and also don't know if I can implement them.

 

Preview

 

Edited by BBs19
Link to post
Share on other sites

Hi!

I've used your UDF on a project I'm developing...

I made some changes for two things:

  1.  Create a GUI that can me moved but not resized.
  2.  Option to create only the Minimize and Close buttons and another with all Control Buttons(as default in the UDF).

* The updated source file is attached bellow.

 

 _Metro_CreateGUI

I've changed the parameters, removing the "$AllowResize" , adding "$TypeOption" and "$ControlButtons".

See the comments:

Spoiler

; #FUNCTION# ====================================================================================================================
; Name ..........: _Metro_CreateGUI
; Description ...: Creates a borderless Metro-Style GUI
; Syntax ........: _Metro_CreateGUI($Title, $Width, $Height[, $Left = -1[, $Top = -1[, $TypeOption = 0[,
;                  $ControlButtons = True[, $ParentGUI = ""]]]]])
; Parameters ....: $Title               - Title of the window.
;                  $Width               - Width
;                  $Height              - Height
;                  $Left                - [optional] Left position. Default is -1.
;                  $Top                 - [optional] Top position. Default is -1.
;
;                  $TypeOption        - [optional] Borderless window that allows drag, resize and also keeps the AeroSnap functions working. Default is 0.
;                                                    0 - Popup style, no resize, move or maximize
;                                                    1 - Move but no resize or maximize, but with AeroSnap
;                                                    2 - All features with AeroSnap
;                   [NOTE]: Can only be called for one GUI. If you create a second GUI with this option, you have to call _GUI_DragAndResizeUpdate($GUI) for your previous GUI after closing the second one.
;
;                  $ControlButtons      - [optional] Adds Close,Maximize/Restore and Minimize buttons to the GUI. Default is 0.
;                                                     0 - No Control Buttons
;                                                     1 - Minimize and Close Buttons
;                                                     2 - All control Buttons
;                    [NOTE]: Remember to only implement the apropriate array references for the Hover Loop and actions.
;
;                  $ParentGUI           - [optional] Parent GUI/Window, This makes sure, there are not multiple windows of your program in the taskbar.
; Return values .: Array[6]
;                   [0] = Handle to the created GUI.
;                   [1] = Array for GUI_HOVER_REG. This is very important. Without this you won't be having working hover effects. Name the variable wisely. For example $GUI_HOVER_REG.
;                   [2] = Handle for the $GUI_CLOSE_BUTTON (Only if created with $ControlButtons = True)
;                   [3] = Handle for the $GUI_MAXIMIZE_BUTTON (Only if created with $ControlButtons = True)
;                   [4] = Handle for the $GUI_RESTORE_BUTTON (Only if created with $ControlButtons = True)
;                   [5] = Handle for the $GUI_MINIMIZE_BUTTON (Only if created with $ControlButtons = True)
; Example .......: $Form1 = _Metro_CreateGUI("Example", 500, 300, -1, -1, True, True)
; ===============================================================================================================================

I've marked the code I've changed with the Regions:
## UPDATED RESIZE ##
## UPDATED CONTROL BUTTONS CALL ##

_Metro_CreateControlButtons

Also, for simple shortage of time, I change the function "_Metro_CreateControlButtons", now there's two functions, one called "_Metro_CreateControlButtonsAll", that creates all Control Buttons and another called "_Metro_CreateControlButtonsCloseMini" that creates only the Minimize and Close buttons.

I kept the same array references across all functions, so the same array position for the minimize button is used even if the maximize is not present.

MetroGUI_UDF.au3

--

"There is a way out of every box, a solution to every puzzle; it's just a matter of finding it." - Picard, Jean-Luc

Link to post
Share on other sites
  • 2 weeks later...
On 4.5.2016 at 10:31 PM, LFCavalcanti said:

Hi!

I've used your UDF on a project I'm developing...

I made some changes for two things:

  1.  Create a GUI that can me moved but not resized.
  2.  Option to create only the Minimize and Close buttons and another with all Control Buttons(as default in the UDF).

* The updated source file is attached bellow.

 

 _Metro_CreateGUI

I've changed the parameters, removing the "$AllowResize" , adding "$TypeOption" and "$ControlButtons".

See the comments:

  Reveal hidden contents

; #FUNCTION# ====================================================================================================================
; Name ..........: _Metro_CreateGUI
; Description ...: Creates a borderless Metro-Style GUI
; Syntax ........: _Metro_CreateGUI($Title, $Width, $Height[, $Left = -1[, $Top = -1[, $TypeOption = 0[,
;                  $ControlButtons = True[, $ParentGUI = ""]]]]])
; Parameters ....: $Title               - Title of the window.
;                  $Width               - Width
;                  $Height              - Height
;                  $Left                - [optional] Left position. Default is -1.
;                  $Top                 - [optional] Top position. Default is -1.
;
;                  $TypeOption        - [optional] Borderless window that allows drag, resize and also keeps the AeroSnap functions working. Default is 0.
;                                                    0 - Popup style, no resize, move or maximize
;                                                    1 - Move but no resize or maximize, but with AeroSnap
;                                                    2 - All features with AeroSnap
;                   [NOTE]: Can only be called for one GUI. If you create a second GUI with this option, you have to call _GUI_DragAndResizeUpdate($GUI) for your previous GUI after closing the second one.
;
;                  $ControlButtons      - [optional] Adds Close,Maximize/Restore and Minimize buttons to the GUI. Default is 0.
;                                                     0 - No Control Buttons
;                                                     1 - Minimize and Close Buttons
;                                                     2 - All control Buttons
;                    [NOTE]: Remember to only implement the apropriate array references for the Hover Loop and actions.
;
;                  $ParentGUI           - [optional] Parent GUI/Window, This makes sure, there are not multiple windows of your program in the taskbar.
; Return values .: Array[6]
;                   [0] = Handle to the created GUI.
;                   [1] = Array for GUI_HOVER_REG. This is very important. Without this you won't be having working hover effects. Name the variable wisely. For example $GUI_HOVER_REG.
;                   [2] = Handle for the $GUI_CLOSE_BUTTON (Only if created with $ControlButtons = True)
;                   [3] = Handle for the $GUI_MAXIMIZE_BUTTON (Only if created with $ControlButtons = True)
;                   [4] = Handle for the $GUI_RESTORE_BUTTON (Only if created with $ControlButtons = True)
;                   [5] = Handle for the $GUI_MINIMIZE_BUTTON (Only if created with $ControlButtons = True)
; Example .......: $Form1 = _Metro_CreateGUI("Example", 500, 300, -1, -1, True, True)
; ===============================================================================================================================

I've marked the code I've changed with the Regions:
## UPDATED RESIZE ##
## UPDATED CONTROL BUTTONS CALL ##

_Metro_CreateControlButtons

Also, for simple shortage of time, I change the function "_Metro_CreateControlButtons", now there's two functions, one called "_Metro_CreateControlButtonsAll", that creates all Control Buttons and another called "_Metro_CreateControlButtonsCloseMini" that creates only the Minimize and Close buttons.

I kept the same array references across all functions, so the same array position for the minimize button is used even if the maximize is not present.

MetroGUI_UDF.au3

Hi, I have added an option to create the control buttons within an extra function in the upcoming UDF v4. It will automatically hide the control buttons that are not selected. You will be able to select even one button only. I will upload the new UDF after I have updated the comments in the UDF etc. I also need to check for bugs and fix them, some are really time consuming as they require lots of workarounds. I will need 2-3 days, i don't have much time at the moment.

 

Link to post
Share on other sites
On 13/05/2016 at 7:26 PM, BBs19 said:

Hi, I have added an option to create the control buttons within an extra function in the upcoming UDF v4. It will automatically hide the control buttons that are not selected. You will be able to select even one button only. I will upload the new UDF after I have updated the comments in the UDF etc. I also need to check for bugs and fix them, some are really time consuming as they require lots of workarounds. I will need 2-3 days, i don't have much time at the moment.

 

Great!

I did these modifications to suit my needs and shared them, maybe someone wants to use as I did, maybe not.

Time is a limited resource... haha

I'm using the UDF in this: https://github.com/LFCavalcanti/intermix

--

"There is a way out of every box, a solution to every puzzle; it's just a matter of finding it." - Picard, Jean-Luc

Link to post
Share on other sites

Changelog v4:

Note: There are many changes in this version and it will not work with the syntax used in the old v3.5 UDF.

New features:

  • Full High-DPI support for 4k screens. - Automated scaling of the gui and all buttons, checkboxes etc. created with the metro UDF style. (See example and comments on how to use)
  • Using the UDF is now easier than ever, many things have been simplified! It is also no longer required to use a HOVER_REG variable when creating buttons etc.
  • 2 new modern checkbox styles
  • 2 new modern toggle styles
  • Fullscreen GUI toggle button like in Windows 10 apps
  • Easy to use menu that slides in from left (like menus in Android and Windows 10 calculator app)
  • Added button enable/disable functions to give a button a grayed out look when it is disabled.
  • Control buttons now indicate that the window is inactive by their color

Improved:

  • Creating control buttons is now seperated from the main gui create function, this allows selecting which control buttons to create and which to hide completley.
  • Hovering over control buttons while window is inactive now also works
  • Many other small changes that I don't remember anymore :D 
  • Many bug fixes.

 

Download: 

 

Edited by BBs19
Link to post
Share on other sites
6 hours ago, legend said:

It's a great new update :)

 

What would be really cool would be a gui editor, like a koda metro edition :D

I might try to create a very very simple one in future, but nothing like Koda. I think that would be too time consuming now :D

You can also just use KODA to create your GUI with the correct size etc. and afterwards replace the default Autoit functions with my UDF. Functions for creating buttons etc. are now mostly the same as the default Autoit functions, if not easier in some cases :) It is mostly find&replace.

Edit: Updated the function overview section in the UDF file to show all user functions ordered in categories for easy usage. I previously forgot to add the new functions to that list. You can just redownload from the same page.

Edited by BBs19
Link to post
Share on other sites

@BBs19 this is awesome!! but in the quick review that I made I found a bug, the steps to get it are:

  1. Open the example script
  2. Click the button style 1
  3. Yes to create the second GUI
  4. Minimize the second GUI
  5. It becomes a white bar in the bottom corner without any button (I have only test it on one computer (Win7 x64, last Autoit stable version)
  6. If I press Windows+DownArrow both GUIs minimize but after restore them now the GUI 1 have the original Windows Title Bar

Other than that I love the new features.

Thanks! 

Link to post
Share on other sites
22 hours ago, KarlosTHG said:

@BBs19 this is awesome!! but in the quick review that I made I found a bug, the steps to get it are:

  1. Open the example script
  2. Click the button style 1
  3. Yes to create the second GUI
  4. Minimize the second GUI
  5. It becomes a white bar in the bottom corner without any button (I have only test it on one computer (Win7 x64, last Autoit stable version)
  6. If I press Windows+DownArrow both GUIs minimize but after restore them now the GUI 1 have the original Windows Title Bar

Other than that I love the new features.

Thanks! 

Hi, thanks for the report. 

My fault, creating a second GUI with control buttons and with a parent of course doesn't make sense. By setting a parent, the second gui is prevented from appearing in the taskbar as an extra window, so if you minimize it, it will appear as a small window with minimize, maximize and close buttons in Windows, but drawing of these default buttons is prevented and therefore only a white field appears.

In summary, if you have 2 GUIs with control buttons like minimize and maximize, then no parent window should be set for the second gui so it can appear in the taskbar as a second window.

 

;Local $Form2 = _Metro_CreateGUI("Example 2", 800, 600, -1, -1, True,$Form1);OLD
Local $Form2 = _Metro_CreateGUI("Example 2", 800, 600, -1, -1, True);Fixed

I found other bugs while testing on Windows 7 with 2 monitors today at work.

  • Fullscreen toggle sends the GUI only to the first monitor and not the monitor that the window is on at the moment. -> Fixed now
  • Fullscreen toggle will cause the screen to not refresh properly on Windows 7. -> Fixed now
  • Windows 7 basic theme is not compabile with the GUI, the upper corners are rounded which makes the GUI look strange. -> Workaround implemented
  • Windows 7 basic and classic theme will cause the first GUIs non-client arena(close,minimize,maximize..) to redraw again when the second gui is minimized. -> Workaround implemented
  • The upper 2 lines of the fullscreen toggle (restore) button don't look straight on all dpi sizes. - I seriously hate GDI Plus and math, i suck at both :D will check this tomorrow.
  • Starting the script from within Scite Portable version will cause hover to not work anymore. - Not sure if this is a real bug or if I can fix it without removing the newly added feature "Hovering over control buttons while window is inactive now also works".

I will update the UDF later tomorrow after properly testing at work on a Windows 7 machine.

Edited by BBs19
Link to post
Share on other sites

Version 4.0.1 - Changelog:

Fixed bugs:

  • Fullscreen toggle sends the GUI only to the first monitor and not the monitor that the window is on at the moment.
  • Fullscreen toggle will cause the screen to not refresh properly on Windows 7. 
  • Windows 7 basic theme makes the GUI look strange with rounded corners on top.
  • Windows 7 basic and classic theme will cause the first GUIs non-client arena(controlbar) to show up when a second GUI is minimized.
  • Fullscreen toggle buttons arrow lines are not straight when using different DPI settings.
  • Starting the script from within Scite Portable version will cause hover to not work anymore.

 

Download:

 

 

Let me know if you find any other bugs :) 

Link to post
Share on other sites
  • 3 weeks later...

I'm using this UDF now and I think it's great. However, I would like to know if there is a way to set a timeout for the msgbox and also if there is a way to enable the toggle once a function is called or launched. Does anybody know???

 

Edited by Mannyfresh15
Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By WilliamasKumeliukas
      2021.07.15 News: Project is NOT dead! I am still very devoted into accomplishing this project, I am spending my every bit of energy that is left end of the day (when there is any) on this project and it really does challenge my knowledge in AutoIT language but I won't give up  
       
      Hi,
      I started this project alone in May 2020 as project in my spare time at work, I'm working for a IT company that started opening their services to residential customers few months ago and now my position in the company kind of drifted in the doom and gloom world of repetitive tasks like: Reinstallation + Configuration of Windows 10.
      The procedure is very repetitive and I started feeling like being a robot which is the main reason I started this project.
       
      ==============================FAQ==================================
      1. Q: Do you want this project to be accomplished with the usage of AutoIT ONLY or 3rd party tools / Scripts (BATCH / POWERSHELL / VB) ? A: No, if I cannot find a way using AutoIT to accomplish a task I will move to my Plan B which consist of automating an 3rd party tool to accomplish the affected task until a solution is found. 2. Q: What do I get from helping/collaborating in this project? A: I will personally take the responsability to mention you in the credits of this project. 3. Q: If I have more questions, can I ask? A: Certainly! feel free to ask any questions related to this project! 4. Q: What is the main goal of this project? A: Automating Windows 10 configuration without user interaction needed (as much as possible) ______________________________________________________________________________________________________________________________
      Current progression of the project (more will be added in future)
      « Blue = Info || Yellow = Unfinished/Untested || Purple = Could be better || Green = Done ||Red = Not Yet Started »
      ***Very early Stage ***
      Connect Network Attached Storage(NAS) (Work but missing configuration in GUI - AutoIT only)
      Download & Install up to 600+ softwares (Tested & Working - using 3rd party tool + Powershell)
       Auto prediction of Apps name of text typed inside input (Tested & Working - AutoIT Only)
      Change OEM Informations (Tested & Working -  AutoIT)
      Disable ScreenSaver (Work but require testing AutoIT only)
      Change Computer Name (Work but require testing AutoIT only) 
      Show Computer Information and Smart status on GUI (Tested & Working - AutoIT Only)
      Change .pdf / .pdfxml from Edge to Adobe Reader DC (Tested & Working - using 3rd party tool)
      Change Edge to Google Chrome as Default Browser (Tested & Working - using 3rd party tool)
      Windows Updater (Seems to work but require further testing - AutoIT only)
      Install Office 365 / 2013 + Activation (To Do)
      Add L2TP VPN Configuration in Windows Built-in VPN (To Do)
      Save / Load tasks configuration profile in (.ini file) to avoid repeating same configuration twice (In progress - AutoIT Only)
      (EXPERIMENTAL) Install Apps from Microsoft Store with UIAutomation UDF made by: @junkew(Work if you know what your doing)
         P.S: Installing Apps from Microsoft Store will require usage of  UIA spy tool made by @LarsJ which you can download & learn how to use it on UIA Spy Tool thread.
      ***  If this project interest you, Reply here This will greatly help me to see if you'd like this project to become real  ***
       
      Download: W10-Configurator.zip  (2021-07-19) 
      Project Website: W10-Configurator on GitHub 
      ______________________________________________________________________________________________________________________________
      Best Regards,
      ~WilliamasKumeliukas
    • By beautifulsoup
      Hi All,
      I'm not sure if its possible that I'm trying to achieve, I've looked into https://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/AutoIt3Wrapper.html and such resources for help, but I cant really find the answer to my question.
      So upon compiling the script in SciTE, the exe file is given a Description under file Properties>Details. I understand, that  one can enter info manually there and it can even implement the version automatically with each compilation.
       
      What I'm trying to achieve is to somehow include the "@ScriptName" in the Details>File Description Field. But as I see no variable can be taken after "#" in this case.
       
      Do You think its achievable? (Win 10)
       
      Much obliged for taking time on reading this.
       
      Kind Regards,
      Brave


    • By IndianSage
      Hi,
      I have a specific situation:
      Is it possible to run autoit script/.exe as a task which in turn is automating a desktop user interactive application on windows 10 where user will not be logged in - at best I can get user locked? 
      If so how will this work or is there any tool available to do this?
      I am trying z-cron task scheduler but it runs only some part also I tried windows 10 task schedule with option to allow task to run which is user interactive type but that too does not work.
      Looking forward to hear from you to help me out of this situation.
      Thanks,
       
    • By therks
      So I have no example code currently because I'm not sure where to even start.
      We're using the parental controls on the computer and the kids each have their own user profiles with limited time. The problem we're encountering is when their time runs out, or if they just hit Win+L and leave the computer, their games are still running in the background. I was hoping to write up a quick AutoIt script and throw it in a recurring scheduled task to just sign off any of the kid's profiles that's not currently active. I found some suggestions to use "query session" and then "logoff [user]" in the command line (which it seems I could easily automate with AutoIt) but that's only available on Win Pro and this system is running Home (and I even tried copying the query.exe from a Pro system but it errors out). Is there some AutoIt equivalent to the query and logoff functions or am I stuck?
      Edit: I'm adding some clarification to exactly what I'm hoping to get out of this script.
      I'd like to setup a scheduled task that runs outside of the current user (perhaps under the SYSTEM account?) in case NO user is currently active, that will detect which users are currently signed in. If users from a predefined list are not currently active, sign them off entirely.
      So let me give two examples:
      Example #1:
      - I am logged in, but not active (I left my browser open and locked the computer) - Nephew A is logged in, but not active (his time ran out while his game was running and the computer auto-locked) - Nephew B is logged in, and currently playing a game When script runs, ignore my profile (leave it signed in), log out Nephew A (closing his game), and ignore Nephew B because he's actively using the computer. Example #2:
      - I am logged in - Nephew A is logged in - Nephew B is logged in - No users are currently active (Windows is sitting on the choose user / sign in screen) When script runs, ignore my profile, log out Nephew A and Nephew B.  
      I would perceive pseudo code, going as such:
      $aChildUsers = [ 'NephewA', 'NephewB' ] $aUserList = GetSignedInUsers() For $i = 0 to UBound($aUserList)-1 If Not UserIsActive($aUserList[$i]) Then For $j = 0 to UBound($aChildUsers)-1 If $aUserList[$i] = $aChildUsers[$j] Then LogOffUser($aUserList[$i]) Next EndIf Next Obviously, GetSignedInUsers(), UserIsActive(), LogOffUser() are not real functions. What I'm searching for is something of their equivalent.
      Thanks for your time!
    • By paw
      I use SetSoundDevice to control my audio devices but the UI was either
       
      blurry like this:
      or unusable like this:

      so I made this horrible thing to add scaling to the GUI:
      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Res_HiDpi=y #AutoIt3Wrapper_AU3Check_Parameters=-w 3 -w 4 -w 5 #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/sf /sv /rm #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <File.au3> ;~ _convertGUI("") If $CmdLine[0] <> 0 Then _convertGUI($CmdLine[1]) Func _convertGUI($sFilePath) If $sFilePath <> "" Then Local $aArray = FileReadToArray($sFilePath) Else ;TEST DATA Local $aArray[6] = ['$H_Res_Language = GUICtrlCreateProgress(5, 120, 210 + 25, 480, 20, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE)) ; $CBS_DROPDOWNLIST)', _ 'Local $h_Ok = GUICtrlCreateButton("Ok", 72, 224, 81, 33, 0)', _ 'GUICreate($Warning_TiTle, 700, 310, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_MINIMIZEBOX)', _ 'GUICtrlCreateLabel("Output type: ", 30, 130, 65, 20) ;, $SS_RIGHT)', _ '$H_FieldNameEdit = GUICtrlCreateEdit($INP_FieldNameEdit, 100,260+25, 500, 150 - 25) ;comment', 'Local $H_CANCEL = GUICtrlCreateGraphic("Cancel", 224, 224, 97, 33, 0)'] EndIf Local $hTimer = TimerInit(), $iGUIElementCount = 0, $sResult = "", $sFileName = "", $sDrive = "", $sDir = "", $sExtension = "" If @Compiled Then _PathSplit($sFilePath, $sDrive, $sDir, $sFileName, $sExtension) $sFileName = StringRegExpReplace($sFilePath, "^.*\\", "") EndIf For $i = 0 To (UBound($aArray) - 1) If StringRegExp($aArray[$i], "GUICtrlCreate|GUICreate") Then $sResult = _splitComma($aArray[$i]) If Not @error Then $aArray[$i] = $sResult $iGUIElementCount += 1 EndIf Next ConsoleWrite("t = " & TimerDiff($hTimer) & " GUI elements = " & $iGUIElementCount & " lines = " & (UBound($aArray) - 1) & @CRLF) If $sFileName <> "" Then Local $hFile = FileOpen("edited." & $sFileName, 2) _FileWriteFromArray("edited." & $sFileName, $aArray) FileClose($hFile) EndIf Exit EndFunc ;==>_convertGUI Func _splitComma($sString) Local $sSplitResult = "", $sTrimmedR = "", $sTrimmedL = "" Local $aSplit = StringSplit($sString, ',') If Not @error Then $sTrimmedR = "" $sTrimmedL = "" For $j = 1 To $aSplit[0] If StringRegExp($aSplit[1], "(?:.GUICtrlCreateGraphic|GUICtrlCreateProgress|GUICtrlCreateSlider|GUICtrlCreateTab|GUICtrlCreateTreeView)") Then If $j = 1 Then While StringLeft($aSplit[$j], 1) <> '(' $sTrimmedL &= StringLeft($aSplit[$j], 1) $aSplit[$j] = StringTrimLeft($aSplit[$j], 1) WEnd $aSplit[$j] = StringTrimLeft($aSplit[$j], 1) EndIf EndIf If $j = $aSplit[0] Then While StringRight($aSplit[$j], 1) <> ')' $sTrimmedR &= StringRight($aSplit[$j], 1) $aSplit[$j] = StringTrimRight($aSplit[$j], 1) WEnd $aSplit[$j] = StringTrimRight($aSplit[$j], 1) EndIf If StringRegExp($aSplit[$j], "[0-9]") And $aSplit[$j] <> -1 And $aSplit[$j] <> 0 And $aSplit[$j] <> 1 And Not StringInStr($aSplit[$j], ')') Then If StringRegExp($aSplit[$j], "\-|\+") Then ;put parenthesis around + or - $aSplit[$j] = '(' & $aSplit[$j] & ")*$g_DPI" Else $aSplit[$j] = $aSplit[$j] & "*$g_DPI" EndIf EndIf If $j < $aSplit[0] Then $sSplitResult &= $aSplit[$j] & ',' ElseIf $j = $aSplit[0] Then $sSplitResult &= $aSplit[$j] & ')' Else $sSplitResult &= $aSplit[$j] EndIf Next If $sTrimmedR <> "" Then $sSplitResult &= StringReverse($sTrimmedR) If $sTrimmedL <> "" Then $sSplitResult = $sTrimmedL & '(' & $sSplitResult Else SetError(1) Return EndIf ConsoleWrite($sSplitResult & @CRLF) Return $sSplitResult EndFunc ;==>_splitComma
      And now it looks good: 
      but it doesn't work on everything, for example the "GUICtrlCreateLabel("Output type: ", 30, 130, 65, 20) ;, $SS_RIGHT)" (from the autoit3wrapper gui)
      because the comment contains a parenthesis and it would break completely if there were variables as parameters..
      Is there some kind of parser around that I could use instead or maybe someone who has already done something like this?
×
×
  • Create New...