Jump to content
BBs19

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

Recommended Posts

BBs19
17 hours ago, Mannyfresh15 said:

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

 

Hi, there is no timeout function built in, but I don't think that will be a problem. I will add it the next time when I fix some bugs and upload a new version.

I am not sure what u mean by "enable the toggle once a function is called or launched", why wouldn't it be possible to enable it from a function? All you have to do is add "_Metro_ToggleCheck($Toggle1)" to your function.

Share this post


Link to post
Share on other sites
Mannyfresh15
1 hour ago, BBs19 said:

Hi, there is no timeout function built in, but I don't think that will be a problem. I will add it the next time when I fix some bugs and upload a new version.

I am not sure what u mean by "enable the toggle once a function is called or launched", why wouldn't it be possible to enable it from a function? All you have to do is add "_Metro_ToggleCheck($Toggle1)" to your function.

Well let try to explain this...

I'm writing a script which has a function and inside that function is a while loop I want to be able to toggle the toggle in the main GUI on and off while in the loop and cheek if the toggle has changed to turn the toggle function on/off while in there ...I haven't been able to achieve that. However, I can toggle the toggle before such function is called. I hope I have explained my self well enough.

 

P.S. I have achieved it with regular checkbox but a nice toggle would be nice. (: I haven't checked your new checkbox although they look nice. Will try them soon.

Edited by Mannyfresh15

Share this post


Link to post
Share on other sites
BBs19
15 minutes ago, Mannyfresh15 said:

Well let try to explain this...

I'm writing a script which has a function and inside that function is a while loop I want to be able to toggle the toggle in the main GUI on and off while in the loop and cheek if the toggle has changed to turn the toggle function on/off while in there ...I haven't been able to achieve that. However, I can toggle the toggle before such function is called. I hope I have explained my self well enough.

 

P.S. I have achieved it with checkbox but a nice toggle would be nice. (:

Well then u have to do the same that you would do in your main while loop:

Func _YourFunctionWithWhileLoop()
    While 1
        _Metro_HoverCheck_Loop($Form1);To make sure that the hover effects still work
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $Toggle1
                If _Metro_ToggleIsChecked($Toggle1) Then
                    _Metro_ToggleUnCheck($Toggle1)
                    ConsoleWrite("Toggle unchecked!" & @CRLF)
                Else
                    _Metro_ToggleCheck($Toggle1)
                    ConsoleWrite("Toggle checked!" & @CRLF)
                EndIf
        EndSwitch
    WEnd
EndFunc

If you use anything like a msgbox or sleep function etc. that will pause your script, then it won't work. 

Share this post


Link to post
Share on other sites
Mannyfresh15
1 hour ago, BBs19 said:

Well then u have to do the same that you would do in your main while loop:

Func _YourFunctionWithWhileLoop()
    While 1
        _Metro_HoverCheck_Loop($Form1);To make sure that the hover effects still work
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $Toggle1
                If _Metro_ToggleIsChecked($Toggle1) Then
                    _Metro_ToggleUnCheck($Toggle1)
                    ConsoleWrite("Toggle unchecked!" & @CRLF)
                Else
                    _Metro_ToggleCheck($Toggle1)
                    ConsoleWrite("Toggle checked!" & @CRLF)
                EndIf
        EndSwitch
    WEnd
EndFunc

If you use anything like a msgbox or sleep function etc. that will pause your script, then it won't work. 

It works!!! However, it gets stuck I have to click it many times sometimes in order to toggle it on/off. I'm not using sleep not anything that would make the script pause... Anyway thank you so much for your help I really appreciated.

 

Share this post


Link to post
Share on other sites
Mannyfresh15

I also would like to know if there is a way to make the Metro GUIs draggable but not resizable.

Share this post


Link to post
Share on other sites
BBs19
16 hours ago, Mannyfresh15 said:

It works!!! However, it gets stuck I have to click it many times sometimes in order to toggle it on/off. I'm not using sleep not anything that would make the script pause... Anyway thank you so much for your help I really appreciated.

 

Can you show me your code? It is really hard to understand what you are trying to do there, as it is working fine for me.

 

12 hours ago, Mannyfresh15 said:

I also would like to know if there is a way to make the Metro GUIs draggable but not resizable.

There are many different ways to do that, see here: https://www.autoitscript.com/wiki/Moving_and_Resizing_PopUp_GUIs#Moving_a_.24WS_POPUP_GUI

You can also use an internal function of my UDF. Just add this to your script:

$GLOBAL_MAIN_GUI = $Form1 ; ($Form1 should be replaced by the variable name of your created GUI)
GUIRegisterMsg(0x0201, "INTERNAL_WM_LBUTTONDOWN")


 

Share this post


Link to post
Share on other sites
Mannyfresh15
12 hours ago, BBs19 said:

Can you show me your code? It is really hard to understand what you are trying to do there, as it is working fine for me.

 

There are many different ways to do that, see here: https://www.autoitscript.com/wiki/Moving_and_Resizing_PopUp_GUIs#Moving_a_.24WS_POPUP_GUI

You can also use an internal function of my UDF. Just add this to your script:

$GLOBAL_MAIN_GUI = $Form1 ; ($Form1 should be replaced by the variable name of your created GUI)
GUIRegisterMsg(0x0201, "INTERNAL_WM_LBUTTONDOWN")


 

Yes here is an example code excuse the DIRTY code since I'm a beginner plus I have borrowed part of it ): Anyway I have notice that "Abort" button has the same problem while in the loop and if I used regular GUI that is not Metro  works just fine. Please let me know if you need a sample code of a regular GUI so you can see it works fine.

#include-once

#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>
#include <Timers.au3>
#include <Sound.au3>
#include <MetroGUI_UDF.au3>


#NoTrayIcon

;!Highly recommended for improved overall performance and responsiveness of the GUI effects etc.! (after compiling):
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/so /rm /pe

;Required if you want High DPI scaling enabled. (Also requries _Metro_EnableHighDPIScaling())
#AutoIt3Wrapper_Res_HiDpi=y


$Form1 = ""


$Checked = False

$timer = ""

$RED = 1

$sec = @SEC

 $Tiempo = ""

$Alarm =  "C:\Users\Admin\Downloads\BOMB_SIREN-BOMB_SIREN-247265934.wav" ;Replace this with your own .wav file. you already knew this what the heck



; Setting Time Variables
$5m =  300000
$10m = 600000
$15m = 900250
$30m = 1800500
$45m = 2700750
$1h = 3601000


$GLOBAL_MAIN_GUI = $Form1 ; ($Form1 should be replaced by the variable name of your created GUI)
GUIRegisterMsg(0x0201, "INTERNAL_WM_LBUTTONDOWN")


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

;Enable high DPI support: Detects the users DPI settings and resizes GUI and all controls to look perfectly sharp.
_Metro_EnableHighDPIScaling() ; Note: Requries "#AutoIt3Wrapper_Res_HiDpi=y" for compiling. To see visible changes without compiling, you have to disable dpi scaling in compatibility settings of Autoit3.exe

;Create resizable Metro GUI
$GLOBAL_MAIN_GUI = _Metro_CreateGUI("My app",  484, 209, 255, 124,False)


;Add/create control buttons to the gui
$Control_Buttons = _Metro_AddControlButtons(True, False, True, False, False) ;CloseBtn = True, MaximizeBtn = True, MinimizeBtn = True, FullscreenBtn = True, MenuBtn = True

;Set variables for the handles of the GUI-Control buttons. (Above function always returns an array this size and in this order, no matter which buttons are selected.
$GUI_CLOSE_BUTTON = $Control_Buttons[0]
GUICtrlSetTip($GUI_CLOSE_BUTTON , "Close")
$GUI_MAXIMIZE_BUTTON = $Control_Buttons[1]
;GUICtrlSetTip($GUI_MAXIMIZE_BUTTON , "Minimizar")
$GUI_RESTORE_BUTTON = $Control_Buttons[2]
$GUI_MINIMIZE_BUTTON = $Control_Buttons[3]
$GUI_FULLSCREEN_BUTTON = $Control_Buttons[4]
$GUI_FSRestore_BUTTON = $Control_Buttons[5]
$GUI_MENU_BUTTON = $Control_Buttons[6]
GUICtrlSetTip($GUI_MENU_BUTTON , "Menu")
;======================================================================================================================================================================

;Create  Buttons
$Button1 = _Metro_CreateButton("start", 206, 177, 75, 25)
$Button2 = _Metro_CreateButton("Abort", 380, 177, 75, 25)

;Create Toggle
$Toggle1 = _Metro_CreateToggle ("Alarm", 10, 147,120,34)
GUICtrlSetTip($Toggle1 , "On/Off")



#Region ### START Koda GUI section ### Form=

$Label1 = GUICtrlCreateLabel("My Timer", 45, 119, 366, 33, $SS_CENTER)
GUICtrlSetColor($Label1,0xFFFFFF)
GUICtrlSetFont(-1, 16, 0, 0, "Impact")

; Create a combobox control.
$idComboBox = GUICtrlCreateCombo("Select Time", 110, 181, 90, 21)
GUICtrlSetTip(-1, "Select Time")
; Add additional items to the combobox.
GUICtrlSetData($idComboBox, "5 Minutes|10 Minutes|15 Minutes|30 Minutes|45 Minutes|1 Hour", "Select Time")
;
$Label2 = GUICtrlCreateLabel("How much Time?", 4, 183, 100, 25, $SS_CENTER)
GUICtrlSetColor(-1,0xFFFFFF)
$Inputtimer = GUICtrlCreateInput("00:00:00", 380, 147, 75, 20, BitOr($SS_CENTER, $ES_READONLY))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
   _Metro_HoverCheck_Loop($GLOBAL_MAIN_GUI)
    $nMsg = GUIGetMsg()
    Switch $nMsg

ExitLoop
Exit

         case $Button1

            startTimer ()



             Case $Button2

            exit

         Case  $GUI_CLOSE_BUTTON


              ExitLoop
               Exit

    Case $GUI_MINIMIZE_BUTTON
            GUISetState(@SW_MINIMIZE)




              Case $Toggle1

         If _Metro_ToggleIsChecked($Toggle1) Then
            _Metro_ToggleUnCheck($Toggle1)
            $Checked = False

        Else
                _Metro_ToggleCheck($Toggle1)

                $Checked = True


            EndIf


                EndSwitch


WEnd




Func startTimer  ()

$Comboread = GUICtrlRead($idComboBox, 0)
if $Comboread = 0 Then

MsgBox($MB_SYSTEMMODAL, "Warning ",  "You Haven't Selected Any Time",10)
Return
Else


if $Comboread =  "5 Minutes" Then $Tiempo = $5m
if $Comboread =  "10 Minutes" Then $Tiempo = $10m
if $Comboread =  "15 Minutes" Then $Tiempo = $15m
if $Comboread =  "30 Minutes" Then $Tiempo = $30m
if $Comboread =  "45 Minutes" Then $Tiempo = $45m
if $Comboread =  "1 Hour" Then $Tiempo = $1h


     ;setting warning labels
      $lbl_text = GUICtrlCreateLabel("Notice", 190, 149, 85, 17,$SS_CENTER)
    ;GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
GUICtrlSetColor($lbl_text,0xff0000)  ; Red
GUICtrlSetFont($lbl_text,9,700)
;
 $lbl_text2 = GUICtrlCreateLabel("Timer will stop in:", 250, 150, 125, 20, $SS_CENTER)
;GUICtrlSetResizing(-1, )
GUICtrlSetColor(-1,0xFFFFFF)

   ; call ("startTimer2 ")


EndIf


;Checking if timer is greater than 0
   If TimerDiff($timer) > 0 Then
$timer = TimerInit()


EndIf




   While( TimerDiff($timer)  < $Tiempo) and (GUIGetMsg() <> $Button2)



;Setting Toggle
_Metro_HoverCheck_Loop($Form1);To make sure that the hover effects still work
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $Toggle1
                If _Metro_ToggleIsChecked($Toggle1) Then
                    _Metro_ToggleUnCheck($Toggle1)

                    $Checked = False
                Else
                    _Metro_ToggleCheck($Toggle1)

                    $Checked = True
                 EndIf

                 Case $GUI_MINIMIZE_BUTTON
            GUISetState(@SW_MINIMIZE)

        EndSwitch



$seconds = TimerDiff($timer)/1000
$diff = $seconds - ($Tiempo/1000)
;
$minutes = Int($diff / 60)
$secondsRem = $diff - ($minutes * 60)
;
$hours = Int($minutes / 60)
$minutes =  $minutes - ($hours * 60)

;
$hours =  $hours * -1
$minutes = $minutes * -1
$secondsRem = $secondsRem * -1

;

$time = StringFormat("%02d", $hours) & ":" & StringFormat("%02d", $minutes) & ":" & StringFormat("%02d", $secondsRem)
;
GUICtrlSetData($Inputtimer, $time)



;Checks if timer is higher than 3mins and If toggle is on plays Sound
if   TimerDiff($timer) > $Tiempo - 180000 And $Checked = True  Then  _SoundPlay ($Alarm,0) ;MsgBox(0,"Aviso","Alarma",5)


;Checks if timer is higher than 3mins and If toggle is off checked stops Sound

if   TimerDiff($timer) > $Tiempo - 180000 And $Checked = False Then  _SoundStop ($Alarm)






; Blinking Text





        If @SEC <> $sec Then
            $sec = @SEC
            If $RED Then
                GUICtrlSetColor($lbl_text,0xffffff)
            Else
                GUICtrlSetColor($lbl_text,0xff0000)
            EndIf
            $RED = Not $RED
         EndIf




WEnd





$Readtimer = GUICtrlRead ($Inputtimer,0)
if $Readtimer = "00:00:00" then
 MsgBox($MB_ICONWARNING, "Notice", "Time is Up!",15)

_SoundStop ($Alarm)



Else
 _SoundStop ($Alarm)
GUICtrlSetData($Inputtimer, "00:00:00")
GUICtrlDelete ($lbl_text2)
GUICtrlDelete ($lbl_text)

EndIf



   EndFunc

 

And your

 

$GLOBAL_MAIN_GUI = $Form1 ; ($Form1 should be replaced by the variable name of your created GUI)
GUIRegisterMsg(0x0201, "INTERNAL_WM_LBUTTONDOWN")

Works Just Fine I hope I can get a solution for the toggle and the button problem

Edited by Mannyfresh15

Share this post


Link to post
Share on other sites
BBs19
21 hours ago, Mannyfresh15 said:

Works Just Fine I hope I can get a solution for the toggle and the button problem

This was somehow causing the problem:

While( TimerDiff($timer)  < $Tiempo) and (GUIGetMsg() <> $Button2)

 

Try with this:

#NoTrayIcon
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>
#include <Timers.au3>
#include <Sound.au3>
#include <MetroGUI_UDF.au3>

;!Highly recommended for improved overall performance and responsiveness of the GUI effects etc.! (after compiling):
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/so /rm /pe

;Required if you want High DPI scaling enabled. (Also requries _Metro_EnableHighDPIScaling())
#AutoIt3Wrapper_Res_HiDpi=y

$Checked = False
$timer = ""
$RED = 1
$sec = @SEC
$Tiempo = ""
$Alarm = "C:\Users\Admin\Downloads\BOMB_SIREN-BOMB_SIREN-247265934.wav" ;Replace this with your own .wav file. you already knew this what the heck

; Setting Time Variables
$5m = 300000
$10m = 600000
$15m = 900250
$30m = 1800500
$45m = 2700750
$1h = 3601000

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

;Enable high DPI support: Detects the users DPI settings and resizes GUI and all controls to look perfectly sharp.
_Metro_EnableHighDPIScaling() ; Note: Requries "#AutoIt3Wrapper_Res_HiDpi=y" for compiling. To see visible changes without compiling, you have to disable dpi scaling in compatibility settings of Autoit3.exe

;Create resizable Metro GUI
$GLOBAL_MAIN_GUI = _Metro_CreateGUI("My app", 484, 209, 255, 124, False)

;Add/create control buttons to the gui
$Control_Buttons = _Metro_AddControlButtons(True, False, True, False, False) ;CloseBtn = True, MaximizeBtn = True, MinimizeBtn = True, FullscreenBtn = True, MenuBtn = True

;Set variables for the handles of the GUI-Control buttons. (Above function always returns an array this size and in this order, no matter which buttons are selected.
$GUI_CLOSE_BUTTON = $Control_Buttons[0]
GUICtrlSetTip($GUI_CLOSE_BUTTON, "Close")
$GUI_MAXIMIZE_BUTTON = $Control_Buttons[1]
;GUICtrlSetTip($GUI_MAXIMIZE_BUTTON , "Minimizar")
$GUI_RESTORE_BUTTON = $Control_Buttons[2]
$GUI_MINIMIZE_BUTTON = $Control_Buttons[3]
$GUI_FULLSCREEN_BUTTON = $Control_Buttons[4]
$GUI_FSRestore_BUTTON = $Control_Buttons[5]
$GUI_MENU_BUTTON = $Control_Buttons[6]
GUICtrlSetTip($GUI_MENU_BUTTON, "Menu")
;======================================================================================================================================================================

;Create  Buttons
$Button1 = _Metro_CreateButton("start", 206, 177, 75, 25)
$Button2 = _Metro_CreateButton("Abort", 380, 177, 75, 25)

;Create Toggle
$Toggle1 = _Metro_CreateToggle("Alarm", 10, 147, 120, 34)
GUICtrlSetTip($Toggle1, "On/Off")

#Region ### START Koda GUI section ### Form=
$Label1 = GUICtrlCreateLabel("My Timer", 45, 119, 366, 33, $SS_CENTER)
GUICtrlSetColor($Label1, 0xFFFFFF)
GUICtrlSetFont(-1, 16, 0, 0, "Impact")

; Create a combobox control.
$idComboBox = GUICtrlCreateCombo("Select Time", 110, 181, 90, 21)
GUICtrlSetTip(-1, "Select Time")
; Add additional items to the combobox.
GUICtrlSetData($idComboBox, "5 Minutes|10 Minutes|15 Minutes|30 Minutes|45 Minutes|1 Hour", "Select Time")
;
$Label2 = GUICtrlCreateLabel("How much Time?", 4, 183, 100, 25, $SS_CENTER)
GUICtrlSetColor(-1, 0xFFFFFF)
$Inputtimer = GUICtrlCreateInput("00:00:00", 380, 147, 75, 20, BitOR($SS_CENTER, $ES_READONLY))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

GUIRegisterMsg(0x0201, "INTERNAL_WM_LBUTTONDOWN")

While 1
    _Metro_HoverCheck_Loop($GLOBAL_MAIN_GUI)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Button1
            startTimer()
        Case $Button2
            Exit
        Case $GUI_CLOSE_BUTTON
            ExitLoop
            Exit
        Case $GUI_MINIMIZE_BUTTON
            GUISetState(@SW_MINIMIZE)
        Case $Toggle1
            If _Metro_ToggleIsChecked($Toggle1) Then
                _Metro_ToggleUnCheck($Toggle1)
                $Checked = False
            Else
                _Metro_ToggleCheck($Toggle1)
                $Checked = True
            EndIf
    EndSwitch
WEnd

Func startTimer()

    $Comboread = GUICtrlRead($idComboBox, 0)
    If $Comboread = 0 Then
        MsgBox($MB_SYSTEMMODAL, "Warning ", "You Haven't Selected Any Time", 10)
        Return
    Else
        If $Comboread = "5 Minutes" Then $Tiempo = $5m
        If $Comboread = "10 Minutes" Then $Tiempo = $10m
        If $Comboread = "15 Minutes" Then $Tiempo = $15m
        If $Comboread = "30 Minutes" Then $Tiempo = $30m
        If $Comboread = "45 Minutes" Then $Tiempo = $45m
        If $Comboread = "1 Hour" Then $Tiempo = $1h
        ;setting warning labels
        $lbl_text = GUICtrlCreateLabel("Notice", 190, 149, 85, 17, $SS_CENTER)
        ;GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
        GUICtrlSetColor($lbl_text, 0xff0000) ; Red
        GUICtrlSetFont($lbl_text, 9, 700)
        ;
        $lbl_text2 = GUICtrlCreateLabel("Timer will stop in:", 250, 150, 125, 20, $SS_CENTER)
        ;GUICtrlSetResizing(-1, )
        GUICtrlSetColor(-1, 0xFFFFFF)
        ; call ("startTimer2 ")
    EndIf

    ;Checking if timer is greater than 0
    If TimerDiff($timer) > 0 Then
        $timer = TimerInit()
    EndIf

    While (TimerDiff($timer) < $Tiempo)
        ;Setting Toggle
        _Metro_HoverCheck_Loop($GLOBAL_MAIN_GUI) ;To make sure that the hover effects still work
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $Toggle1
                If _Metro_ToggleIsChecked($Toggle1) Then
                    _Metro_ToggleUnCheck($Toggle1)
                    $Checked = False
                Else
                    _Metro_ToggleCheck($Toggle1)
                    $Checked = True
                EndIf
            Case $GUI_MINIMIZE_BUTTON
                GUISetState(@SW_MINIMIZE)
            Case $Button2
                ExitLoop
            Case $GUI_CLOSE_BUTTON
                Exit
        EndSwitch

        $seconds = TimerDiff($timer) / 1000
        $diff = $seconds - ($Tiempo / 1000)
        ;
        $minutes = Int($diff / 60)
        $secondsRem = $diff - ($minutes * 60)
        ;
        $hours = Int($minutes / 60)
        $minutes = $minutes - ($hours * 60)

        ;
        $hours = $hours * -1
        $minutes = $minutes * -1
        $secondsRem = $secondsRem * -1

        $time = StringFormat("%02d", $hours) & ":" & StringFormat("%02d", $minutes) & ":" & StringFormat("%02d", $secondsRem)
        ;
        GUICtrlSetData($Inputtimer, $time)

        ;Checks if timer is higher than 3mins and If toggle is on plays Sound
        If TimerDiff($timer) > $Tiempo - 180000 And $Checked = True Then _SoundPlay($Alarm, 0) ;MsgBox(0,"Aviso","Alarma",5)

        ;Checks if timer is higher than 3mins and If toggle is off checked stops Sound

        If TimerDiff($timer) > $Tiempo - 180000 And $Checked = False Then _SoundStop($Alarm)

        ; Blinking Text

        If @SEC <> $sec Then
            $sec = @SEC
            If $RED Then
                GUICtrlSetColor($lbl_text, 0xffffff)
            Else
                GUICtrlSetColor($lbl_text, 0xff0000)
            EndIf
            $RED = Not $RED
        EndIf

    WEnd

    $Readtimer = GUICtrlRead($Inputtimer, 0)
    If $Readtimer = "00:00:00" Then
        MsgBox($MB_ICONWARNING, "Notice", "Time is Up!", 15)
        _SoundStop($Alarm)
    Else
        _SoundStop($Alarm)
        GUICtrlSetData($Inputtimer, "00:00:00")
        GUICtrlDelete($lbl_text2)
        GUICtrlDelete($lbl_text)
    EndIf

EndFunc   ;==>startTimer

 

Edited by BBs19

Share this post


Link to post
Share on other sites
Dreamfire

Hi BBs19,

What would be the font setting to use in order to maintain overall consistency with the created controls (checkbox/radio/toggle).
I'd like to for example add a label control but want the text to look the same as your controls.

Share this post


Link to post
Share on other sites
BBs19
7 hours ago, Dreamfire said:

Hi BBs19,

What would be the font setting to use in order to maintain overall consistency with the created controls (checkbox/radio/toggle).
I'd like to for example add a label control but want the text to look the same as your controls.

 

Hi, the default font is mostly Segoe UI, only Buttons are set to Arial. You can change the default font of course, just look at the the MetroGUI_UDF.au3 file for syntax, the example file i posted is kept pretty easy without much customization:)

Edited by BBs19

Share this post


Link to post
Share on other sites
Mannyfresh15
On 6/12/2016 at 6:18 AM, BBs19 said:

This was somehow causing the problem:

While( TimerDiff($timer)  < $Tiempo) and (GUIGetMsg() <> $Button2)

 

Try with this:

#NoTrayIcon
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>
#include <Timers.au3>
#include <Sound.au3>
#include <MetroGUI_UDF.au3>

;!Highly recommended for improved overall performance and responsiveness of the GUI effects etc.! (after compiling):
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/so /rm /pe

;Required if you want High DPI scaling enabled. (Also requries _Metro_EnableHighDPIScaling())
#AutoIt3Wrapper_Res_HiDpi=y

$Checked = False
$timer = ""
$RED = 1
$sec = @SEC
$Tiempo = ""
$Alarm = "C:\Users\Admin\Downloads\BOMB_SIREN-BOMB_SIREN-247265934.wav" ;Replace this with your own .wav file. you already knew this what the heck

; Setting Time Variables
$5m = 300000
$10m = 600000
$15m = 900250
$30m = 1800500
$45m = 2700750
$1h = 3601000

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

;Enable high DPI support: Detects the users DPI settings and resizes GUI and all controls to look perfectly sharp.
_Metro_EnableHighDPIScaling() ; Note: Requries "#AutoIt3Wrapper_Res_HiDpi=y" for compiling. To see visible changes without compiling, you have to disable dpi scaling in compatibility settings of Autoit3.exe

;Create resizable Metro GUI
$GLOBAL_MAIN_GUI = _Metro_CreateGUI("My app", 484, 209, 255, 124, False)

;Add/create control buttons to the gui
$Control_Buttons = _Metro_AddControlButtons(True, False, True, False, False) ;CloseBtn = True, MaximizeBtn = True, MinimizeBtn = True, FullscreenBtn = True, MenuBtn = True

;Set variables for the handles of the GUI-Control buttons. (Above function always returns an array this size and in this order, no matter which buttons are selected.
$GUI_CLOSE_BUTTON = $Control_Buttons[0]
GUICtrlSetTip($GUI_CLOSE_BUTTON, "Close")
$GUI_MAXIMIZE_BUTTON = $Control_Buttons[1]
;GUICtrlSetTip($GUI_MAXIMIZE_BUTTON , "Minimizar")
$GUI_RESTORE_BUTTON = $Control_Buttons[2]
$GUI_MINIMIZE_BUTTON = $Control_Buttons[3]
$GUI_FULLSCREEN_BUTTON = $Control_Buttons[4]
$GUI_FSRestore_BUTTON = $Control_Buttons[5]
$GUI_MENU_BUTTON = $Control_Buttons[6]
GUICtrlSetTip($GUI_MENU_BUTTON, "Menu")
;======================================================================================================================================================================

;Create  Buttons
$Button1 = _Metro_CreateButton("start", 206, 177, 75, 25)
$Button2 = _Metro_CreateButton("Abort", 380, 177, 75, 25)

;Create Toggle
$Toggle1 = _Metro_CreateToggle("Alarm", 10, 147, 120, 34)
GUICtrlSetTip($Toggle1, "On/Off")

#Region ### START Koda GUI section ### Form=
$Label1 = GUICtrlCreateLabel("My Timer", 45, 119, 366, 33, $SS_CENTER)
GUICtrlSetColor($Label1, 0xFFFFFF)
GUICtrlSetFont(-1, 16, 0, 0, "Impact")

; Create a combobox control.
$idComboBox = GUICtrlCreateCombo("Select Time", 110, 181, 90, 21)
GUICtrlSetTip(-1, "Select Time")
; Add additional items to the combobox.
GUICtrlSetData($idComboBox, "5 Minutes|10 Minutes|15 Minutes|30 Minutes|45 Minutes|1 Hour", "Select Time")
;
$Label2 = GUICtrlCreateLabel("How much Time?", 4, 183, 100, 25, $SS_CENTER)
GUICtrlSetColor(-1, 0xFFFFFF)
$Inputtimer = GUICtrlCreateInput("00:00:00", 380, 147, 75, 20, BitOR($SS_CENTER, $ES_READONLY))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

GUIRegisterMsg(0x0201, "INTERNAL_WM_LBUTTONDOWN")

While 1
    _Metro_HoverCheck_Loop($GLOBAL_MAIN_GUI)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Button1
            startTimer()
        Case $Button2
            Exit
        Case $GUI_CLOSE_BUTTON
            ExitLoop
            Exit
        Case $GUI_MINIMIZE_BUTTON
            GUISetState(@SW_MINIMIZE)
        Case $Toggle1
            If _Metro_ToggleIsChecked($Toggle1) Then
                _Metro_ToggleUnCheck($Toggle1)
                $Checked = False
            Else
                _Metro_ToggleCheck($Toggle1)
                $Checked = True
            EndIf
    EndSwitch
WEnd

Func startTimer()

    $Comboread = GUICtrlRead($idComboBox, 0)
    If $Comboread = 0 Then
        MsgBox($MB_SYSTEMMODAL, "Warning ", "You Haven't Selected Any Time", 10)
        Return
    Else
        If $Comboread = "5 Minutes" Then $Tiempo = $5m
        If $Comboread = "10 Minutes" Then $Tiempo = $10m
        If $Comboread = "15 Minutes" Then $Tiempo = $15m
        If $Comboread = "30 Minutes" Then $Tiempo = $30m
        If $Comboread = "45 Minutes" Then $Tiempo = $45m
        If $Comboread = "1 Hour" Then $Tiempo = $1h
        ;setting warning labels
        $lbl_text = GUICtrlCreateLabel("Notice", 190, 149, 85, 17, $SS_CENTER)
        ;GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
        GUICtrlSetColor($lbl_text, 0xff0000) ; Red
        GUICtrlSetFont($lbl_text, 9, 700)
        ;
        $lbl_text2 = GUICtrlCreateLabel("Timer will stop in:", 250, 150, 125, 20, $SS_CENTER)
        ;GUICtrlSetResizing(-1, )
        GUICtrlSetColor(-1, 0xFFFFFF)
        ; call ("startTimer2 ")
    EndIf

    ;Checking if timer is greater than 0
    If TimerDiff($timer) > 0 Then
        $timer = TimerInit()
    EndIf

    While (TimerDiff($timer) < $Tiempo)
        ;Setting Toggle
        _Metro_HoverCheck_Loop($GLOBAL_MAIN_GUI) ;To make sure that the hover effects still work
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $Toggle1
                If _Metro_ToggleIsChecked($Toggle1) Then
                    _Metro_ToggleUnCheck($Toggle1)
                    $Checked = False
                Else
                    _Metro_ToggleCheck($Toggle1)
                    $Checked = True
                EndIf
            Case $GUI_MINIMIZE_BUTTON
                GUISetState(@SW_MINIMIZE)
            Case $Button2
                ExitLoop
            Case $GUI_CLOSE_BUTTON
                Exit
        EndSwitch

        $seconds = TimerDiff($timer) / 1000
        $diff = $seconds - ($Tiempo / 1000)
        ;
        $minutes = Int($diff / 60)
        $secondsRem = $diff - ($minutes * 60)
        ;
        $hours = Int($minutes / 60)
        $minutes = $minutes - ($hours * 60)

        ;
        $hours = $hours * -1
        $minutes = $minutes * -1
        $secondsRem = $secondsRem * -1

        $time = StringFormat("%02d", $hours) & ":" & StringFormat("%02d", $minutes) & ":" & StringFormat("%02d", $secondsRem)
        ;
        GUICtrlSetData($Inputtimer, $time)

        ;Checks if timer is higher than 3mins and If toggle is on plays Sound
        If TimerDiff($timer) > $Tiempo - 180000 And $Checked = True Then _SoundPlay($Alarm, 0) ;MsgBox(0,"Aviso","Alarma",5)

        ;Checks if timer is higher than 3mins and If toggle is off checked stops Sound

        If TimerDiff($timer) > $Tiempo - 180000 And $Checked = False Then _SoundStop($Alarm)

        ; Blinking Text

        If @SEC <> $sec Then
            $sec = @SEC
            If $RED Then
                GUICtrlSetColor($lbl_text, 0xffffff)
            Else
                GUICtrlSetColor($lbl_text, 0xff0000)
            EndIf
            $RED = Not $RED
        EndIf

    WEnd

    $Readtimer = GUICtrlRead($Inputtimer, 0)
    If $Readtimer = "00:00:00" Then
        MsgBox($MB_ICONWARNING, "Notice", "Time is Up!", 15)
        _SoundStop($Alarm)
    Else
        _SoundStop($Alarm)
        GUICtrlSetData($Inputtimer, "00:00:00")
        GUICtrlDelete($lbl_text2)
        GUICtrlDelete($lbl_text)
    EndIf

EndFunc   ;==>startTimer

 

You're badass! all those problems have been taken care of thanks to you (:

Now I just got into a little problem setting up a picture as a background will make overlapping controls not work check my example below

 

#NoTrayIcon
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>
#include <Timers.au3>
#include <Sound.au3>
#include <MetroGUI_UDF.au3>

;!Highly recommended for improved overall performance and responsiveness of the GUI effects etc.! (after compiling):
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/so /rm /pe

;Required if you want High DPI scaling enabled. (Also requries _Metro_EnableHighDPIScaling())
#AutoIt3Wrapper_Res_HiDpi=y

$Checked = False
$timer = ""
$RED = 1
$sec = @SEC
$Tiempo = ""
$Alarm = "C:\Users\Admin\Downloads\BOMB_SIREN-BOMB_SIREN-247265934.wav" ;Replace this with your own .wav file. you already knew this what the heck

; Setting Time Variables
$5m = 300000
$10m = 600000
$15m = 900250
$30m = 1800500
$45m = 2700750
$1h = 3601000

InetGet ("http://imgur.com/download/C5CE14x/" ,@TempDir & "\Samplepic.jpg")

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

;Enable high DPI support: Detects the users DPI settings and resizes GUI and all controls to look perfectly sharp.
_Metro_EnableHighDPIScaling() ; Note: Requries "#AutoIt3Wrapper_Res_HiDpi=y" for compiling. To see visible changes without compiling, you have to disable dpi scaling in compatibility settings of Autoit3.exe

;Create resizable Metro GUI
$GLOBAL_MAIN_GUI = _Metro_CreateGUI("My app", 484, 209, 255, 124, False)

$Pic1 = GUICtrlCreatePic(@TempDir & "\Samplepic.jpg", 10, 0, 460, 119, $SS_NOTIFY,$GUI_WS_EX_PARENTDRAG)
;GuiCtrlSetState(-1,$GUI_DISABLE) If I uncomment this others controls will work but drag will not. ):
;Create an Array containing menu button names
Dim $MenuButtonsArray[4] = ["Settings", "About", "Contact", "Exit"]

;Add/create control buttons to the gui
$Control_Buttons = _Metro_AddControlButtons(True, False, True, False, True) ;CloseBtn = True, MaximizeBtn = True, MinimizeBtn = True, FullscreenBtn = True, MenuBtn = True

;Set variables for the handles of the GUI-Control buttons. (Above function always returns an array this size and in this order, no matter which buttons are selected.
$GUI_CLOSE_BUTTON = $Control_Buttons[0]
GUICtrlSetTip($GUI_CLOSE_BUTTON, "Close")
$GUI_MAXIMIZE_BUTTON = $Control_Buttons[1]
;GUICtrlSetTip($GUI_MAXIMIZE_BUTTON , "Minimizar")
$GUI_RESTORE_BUTTON = $Control_Buttons[2]
$GUI_MINIMIZE_BUTTON = $Control_Buttons[3]
$GUI_FULLSCREEN_BUTTON = $Control_Buttons[4]
$GUI_FSRestore_BUTTON = $Control_Buttons[5]
$GUI_MENU_BUTTON = $Control_Buttons[6]
GUICtrlSetTip($GUI_MENU_BUTTON, "Menu")
;======================================================================================================================================================================

;Create  Buttons
$Button1 = _Metro_CreateButton("start", 206, 177, 75, 25)
$Button2 = _Metro_CreateButton("Abort", 380, 177, 75, 25)

;Create Toggle
$Toggle1 = _Metro_CreateToggle("Alarm", 10, 147, 120, 34)
GUICtrlSetTip($Toggle1, "On/Off")

#Region ### START Koda GUI section ### Form=
$Label1 = GUICtrlCreateLabel("My Timer", 45, 119, 366, 33, $SS_CENTER,$GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor($Label1, 0xFFFFFF)
GUICtrlSetFont(-1, 16, 0, 0, "Impact")

; Create a combobox control.
$idComboBox = GUICtrlCreateCombo("Select Time", 110, 181, 90, 21)
GUICtrlSetTip(-1, "Select Time")
; Add additional items to the combobox.
GUICtrlSetData($idComboBox, "5 Minutes|10 Minutes|15 Minutes|30 Minutes|45 Minutes|1 Hour", "Select Time")
;
$Label2 = GUICtrlCreateLabel("How much Time?", 4, 183, 100, 25, $SS_CENTER,$GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor(-1, 0xFFFFFF)
$Inputtimer = GUICtrlCreateInput("00:00:00", 380, 147, 75, 20, BitOR($SS_CENTER, $ES_READONLY))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

GUIRegisterMsg(0x0201, "INTERNAL_WM_LBUTTONDOWN")

While 1
    _Metro_HoverCheck_Loop($GLOBAL_MAIN_GUI)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Button1
            startTimer()
        Case $Button2
            Exit
        Case $GUI_CLOSE_BUTTON
            ExitLoop
            Exit
        Case $GUI_MINIMIZE_BUTTON
            GUISetState(@SW_MINIMIZE)
        Case $Toggle1
            If _Metro_ToggleIsChecked($Toggle1) Then
                _Metro_ToggleUnCheck($Toggle1)
                $Checked = False
            Else
                _Metro_ToggleCheck($Toggle1)
                $Checked = True
             EndIf

            Case $GUI_MENU_BUTTON
            Local $MenuSelect = _Metro_MenuStart($GLOBAL_MAIN_GUI, $GUI_MENU_BUTTON, 150, $MenuButtonsArray) ; Opens the metro Menu. See decleration of $MenuButtonsArray above.
            Switch $MenuSelect ;Above function returns the index number of the button from the provided buttons array.
                Case "0"
                    ConsoleWrite("Returned 0 = Settings button clicked." & @CRLF)
                Case "1"
                    ConsoleWrite("Returned 1 = About button clicked." & @CRLF)
                Case "2"
                    ConsoleWrite("Returned 2 = Contact button clicked." & @CRLF)
                Case "3"
                    ConsoleWrite("Returned 3 = Exit button clicked." & @CRLF)
                    Exit

    EndSwitch

    EndSwitch
WEnd

Func startTimer()

    $Comboread = GUICtrlRead($idComboBox, 0)
    If $Comboread = 0 Then
        MsgBox($MB_SYSTEMMODAL, "Warning ", "You Haven't Selected Any Time", 10)
        Return
    Else
        If $Comboread = "5 Minutes" Then $Tiempo = $5m
        If $Comboread = "10 Minutes" Then $Tiempo = $10m
        If $Comboread = "15 Minutes" Then $Tiempo = $15m
        If $Comboread = "30 Minutes" Then $Tiempo = $30m
        If $Comboread = "45 Minutes" Then $Tiempo = $45m
        If $Comboread = "1 Hour" Then $Tiempo = $1h
        ;setting warning labels
        $lbl_text = GUICtrlCreateLabel("Attention!", 180, 149, 80, 17, $SS_CENTER,$GUI_WS_EX_PARENTDRAG)
        ;GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
        GUICtrlSetColor($lbl_text, 0xff0000) ; Red
        GUICtrlSetFont($lbl_text, 9, 700)
        ;
        $lbl_text2 = GUICtrlCreateLabel("Timer will stop in:", 250, 150, 125, 20, $SS_CENTER,$GUI_WS_EX_PARENTDRAG)
        ;GUICtrlSetResizing(-1, )
        GUICtrlSetColor(-1, 0xFFFFFF)
        ; call ("startTimer2 ")
    EndIf

    ;Checking if timer is greater than 0
    If TimerDiff($timer) > 0 Then
        $timer = TimerInit()
    EndIf

    While (TimerDiff($timer) < $Tiempo)
        ;Setting Toggle
        _Metro_HoverCheck_Loop($GLOBAL_MAIN_GUI) ;To make sure that the hover effects still work
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $Toggle1
                If _Metro_ToggleIsChecked($Toggle1) Then
                    _Metro_ToggleUnCheck($Toggle1)
                    $Checked = False
                Else
                    _Metro_ToggleCheck($Toggle1)
                    $Checked = True
                EndIf
            Case $GUI_MINIMIZE_BUTTON
                GUISetState(@SW_MINIMIZE)
            Case $Button2
                ExitLoop
            Case $GUI_CLOSE_BUTTON
                Exit
        EndSwitch

        $seconds = TimerDiff($timer) / 1000
        $diff = $seconds - ($Tiempo / 1000)
        ;
        $minutes = Int($diff / 60)
        $secondsRem = $diff - ($minutes * 60)
        ;
        $hours = Int($minutes / 60)
        $minutes = $minutes - ($hours * 60)

        ;
        $hours = $hours * -1
        $minutes = $minutes * -1
        $secondsRem = $secondsRem * -1

        $time = StringFormat("%02d", $hours) & ":" & StringFormat("%02d", $minutes) & ":" & StringFormat("%02d", $secondsRem)
        ;
        GUICtrlSetData($Inputtimer, $time)

        ;Checks if timer is higher than 3mins and If toggle is on plays Sound
        If TimerDiff($timer) > $Tiempo - 180000 And $Checked = True Then _SoundPlay($Alarm, 0) ;MsgBox(0,"Aviso","Alarma",5)

        ;Checks if timer is higher than 3mins and If toggle is off checked stops Sound

        If TimerDiff($timer) > $Tiempo - 180000 And $Checked = False Then _SoundStop($Alarm)

        ; Blinking Text

        If @SEC <> $sec Then
            $sec = @SEC
            If $RED Then
                GUICtrlSetColor($lbl_text, 0xffffff)
            Else
                GUICtrlSetColor($lbl_text, 0xff0000)
            EndIf
            $RED = Not $RED
        EndIf

    WEnd

    $Readtimer = GUICtrlRead($Inputtimer, 0)
    If $Readtimer = "00:00:00" Then
        MsgBox($MB_ICONWARNING, "Notice", "Time is Up!", 15)
        _SoundStop($Alarm)
    Else
        _SoundStop($Alarm)
        GUICtrlSetData($Inputtimer, "00:00:00")
        GUICtrlDelete($lbl_text2)
        GUICtrlDelete($lbl_text)
    EndIf

EndFunc   ;==>startTimer

 

I having Problems with this:

$Pic1 = GUICtrlCreatePic(@TempDir & "\Samplepic.jpg", 10, 0, 460, 119, $SS_NOTIFY,$GUI_WS_EX_PARENTDRAG)
;GuiCtrlSetState(-1,$GUI_DISABLE) If I uncomment this others controls will work but drag will not. ):

 I don't wanna sound like if I'm getting advantage of you but I really would like to get some help on this because I have no problem with regular GUI but I really want to use Metro GUIs and you know you're the expert. (: 

Edited by Mannyfresh15

Share this post


Link to post
Share on other sites
pndhcm280-

How can i change the font in the menu ?

qUEJYLQ.png

Share this post


Link to post
Share on other sites
BBs19
On 13.6.2016 at 9:41 PM, Mannyfresh15 said:

You're badass! all those problems have been taken care of thanks to you (:

Now I just got into a little problem setting up a picture as a background will make overlapping controls not work check my example below

$Pic1 = GUICtrlCreatePic(@TempDir & "\Samplepic.jpg", 10, 0, 460, 119, $SS_NOTIFY,$GUI_WS_EX_PARENTDRAG)
;GuiCtrlSetState(-1,$GUI_DISABLE) If I uncomment this others controls will work but drag will not. ):

 I don't wanna sound like if I'm getting advantage of you but I really would like to get some help on this because I have no problem with regular GUI but I really want to use Metro GUIs and you know you're the expert. (: 

 

Try this:

#NoTrayIcon
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>
#include <Timers.au3>
#include <Sound.au3>
#include <MetroGUI_UDF.au3>

;!Highly recommended for improved overall performance and responsiveness of the GUI effects etc.! (after compiling):
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/so /rm /pe

;Required if you want High DPI scaling enabled. (Also requries _Metro_EnableHighDPIScaling())
#AutoIt3Wrapper_Res_HiDpi=y

$Checked = False
$timer = ""
$RED = 1
$sec = @SEC
$Tiempo = ""
$Alarm = "C:\Users\Admin\Downloads\BOMB_SIREN-BOMB_SIREN-247265934.wav" ;Replace this with your own .wav file. you already knew this what the heck

; Setting Time Variables
$5m = 300000
$10m = 600000
$15m = 900250
$30m = 1800500
$45m = 2700750
$1h = 3601000

InetGet("http://imgur.com/download/C5CE14x/", @TempDir & "\Samplepic.jpg")

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

;Enable high DPI support: Detects the users DPI settings and resizes GUI and all controls to look perfectly sharp.
_Metro_EnableHighDPIScaling() ; Note: Requries "#AutoIt3Wrapper_Res_HiDpi=y" for compiling. To see visible changes without compiling, you have to disable dpi scaling in compatibility settings of Autoit3.exe

;Create resizable Metro GUI
$GLOBAL_MAIN_GUI = _Metro_CreateGUI("My app", 484, 209, 255, 124, False)

$Pic1 = GUICtrlCreatePic(@TempDir & "\Samplepic.jpg", 10, 0, 460, 119, 0, $GUI_WS_EX_PARENTDRAG)

;Create an Array containing menu button names
Dim $MenuButtonsArray[4] = ["Settings", "About", "Contact", "Exit"]

;Add/create control buttons to the gui
$Control_Buttons = _Metro_AddControlButtons(True, False, True, False, True) ;CloseBtn = True, MaximizeBtn = True, MinimizeBtn = True, FullscreenBtn = True, MenuBtn = True

;Set variables for the handles of the GUI-Control buttons. (Above function always returns an array this size and in this order, no matter which buttons are selected.
$GUI_CLOSE_BUTTON = $Control_Buttons[0]
GUICtrlSetTip($GUI_CLOSE_BUTTON, "Close")
$GUI_MAXIMIZE_BUTTON = $Control_Buttons[1]
;GUICtrlSetTip($GUI_MAXIMIZE_BUTTON , "Minimizar")
$GUI_RESTORE_BUTTON = $Control_Buttons[2]
$GUI_MINIMIZE_BUTTON = $Control_Buttons[3]
$GUI_FULLSCREEN_BUTTON = $Control_Buttons[4]
$GUI_FSRestore_BUTTON = $Control_Buttons[5]
$GUI_MENU_BUTTON = $Control_Buttons[6]
GUICtrlSetTip($GUI_MENU_BUTTON, "Menu")
;======================================================================================================================================================================


;Create  Buttons
$Button1 = _Metro_CreateButton("start", 206, 177, 75, 25)
$Button2 = _Metro_CreateButton("Abort", 380, 177, 75, 25)

;Create Toggle
$Toggle1 = _Metro_CreateToggle("Alarm", 10, 147, 120, 34)
GUICtrlSetTip($Toggle1, "On/Off")

#Region ### START Koda GUI section ### Form=
$Label1 = GUICtrlCreateLabel("My Timer", 45, 119, 366, 33, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor($Label1, 0xFFFFFF)
GUICtrlSetFont(-1, 16, 0, 0, "Impact")

; Create a combobox control.
$idComboBox = GUICtrlCreateCombo("Select Time", 110, 181, 90, 21)
GUICtrlSetTip(-1, "Select Time")
; Add additional items to the combobox.
GUICtrlSetData($idComboBox, "5 Minutes|10 Minutes|15 Minutes|30 Minutes|45 Minutes|1 Hour", "Select Time")
;
$Label2 = GUICtrlCreateLabel("How much Time?", 4, 183, 100, 25, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor(-1, 0xFFFFFF)
$Inputtimer = GUICtrlCreateInput("00:00:00", 380, 147, 75, 20, BitOR($SS_CENTER, $ES_READONLY))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

;~ GUIRegisterMsg(0x0201, "INTERNAL_WM_LBUTTONDOWN")

While 1
    _Metro_HoverCheck_Loop($GLOBAL_MAIN_GUI)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_PRIMARYDOWN
            DllCall("user32.dll", "int", "ReleaseCapture")
            DllCall("user32.dll", "long", "SendMessage", "hwnd", $GLOBAL_MAIN_GUI, "int", 0x00A1, "int", 2, "int", 0)
        Case $Button1
            startTimer()
        Case $Button2
            Exit
        Case $GUI_CLOSE_BUTTON
            ExitLoop
            Exit
        Case $GUI_MINIMIZE_BUTTON
            GUISetState(@SW_MINIMIZE)
        Case $Toggle1
            If _Metro_ToggleIsChecked($Toggle1) Then
                _Metro_ToggleUnCheck($Toggle1)
                $Checked = False
            Else
                _Metro_ToggleCheck($Toggle1)
                $Checked = True
            EndIf

        Case $GUI_MENU_BUTTON
            Local $MenuSelect = _Metro_MenuStart($GLOBAL_MAIN_GUI, $GUI_MENU_BUTTON, 150, $MenuButtonsArray) ; Opens the metro Menu. See decleration of $MenuButtonsArray above.
            Switch $MenuSelect ;Above function returns the index number of the button from the provided buttons array.
                Case "0"
                    ConsoleWrite("Returned 0 = Settings button clicked." & @CRLF)
                Case "1"
                    ConsoleWrite("Returned 1 = About button clicked." & @CRLF)
                Case "2"
                    ConsoleWrite("Returned 2 = Contact button clicked." & @CRLF)
                Case "3"
                    ConsoleWrite("Returned 3 = Exit button clicked." & @CRLF)
                    Exit

            EndSwitch

    EndSwitch
WEnd

Func startTimer()

    $Comboread = GUICtrlRead($idComboBox, 0)
    If $Comboread = 0 Then
        MsgBox($MB_SYSTEMMODAL, "Warning ", "You Haven't Selected Any Time", 10)
        Return
    Else
        If $Comboread = "5 Minutes" Then $Tiempo = $5m
        If $Comboread = "10 Minutes" Then $Tiempo = $10m
        If $Comboread = "15 Minutes" Then $Tiempo = $15m
        If $Comboread = "30 Minutes" Then $Tiempo = $30m
        If $Comboread = "45 Minutes" Then $Tiempo = $45m
        If $Comboread = "1 Hour" Then $Tiempo = $1h
        ;setting warning labels
        $lbl_text = GUICtrlCreateLabel("Attention!", 180, 149, 80, 17, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
        ;GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
        GUICtrlSetColor($lbl_text, 0xff0000) ; Red
        GUICtrlSetFont($lbl_text, 9, 700)
        ;
        $lbl_text2 = GUICtrlCreateLabel("Timer will stop in:", 250, 150, 125, 20, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
        ;GUICtrlSetResizing(-1, )
        GUICtrlSetColor(-1, 0xFFFFFF)
        ; call ("startTimer2 ")
    EndIf

    ;Checking if timer is greater than 0
    If TimerDiff($timer) > 0 Then
        $timer = TimerInit()
    EndIf

    While (TimerDiff($timer) < $Tiempo)
        ;Setting Toggle
        _Metro_HoverCheck_Loop($GLOBAL_MAIN_GUI) ;To make sure that the hover effects still work
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $Toggle1
                If _Metro_ToggleIsChecked($Toggle1) Then
                    _Metro_ToggleUnCheck($Toggle1)
                    $Checked = False
                Else
                    _Metro_ToggleCheck($Toggle1)
                    $Checked = True
                EndIf
            Case $GUI_MINIMIZE_BUTTON
                GUISetState(@SW_MINIMIZE)
            Case $Button2
                ExitLoop
            Case $GUI_CLOSE_BUTTON
                Exit
        EndSwitch

        $seconds = TimerDiff($timer) / 1000
        $diff = $seconds - ($Tiempo / 1000)
        ;
        $minutes = Int($diff / 60)
        $secondsRem = $diff - ($minutes * 60)
        ;
        $hours = Int($minutes / 60)
        $minutes = $minutes - ($hours * 60)

        ;
        $hours = $hours * -1
        $minutes = $minutes * -1
        $secondsRem = $secondsRem * -1

        $time = StringFormat("%02d", $hours) & ":" & StringFormat("%02d", $minutes) & ":" & StringFormat("%02d", $secondsRem)
        ;
        GUICtrlSetData($Inputtimer, $time)

        ;Checks if timer is higher than 3mins and If toggle is on plays Sound
        If TimerDiff($timer) > $Tiempo - 180000 And $Checked = True Then _SoundPlay($Alarm, 0) ;MsgBox(0,"Aviso","Alarma",5)

        ;Checks if timer is higher than 3mins and If toggle is off checked stops Sound

        If TimerDiff($timer) > $Tiempo - 180000 And $Checked = False Then _SoundStop($Alarm)

        ; Blinking Text

        If @SEC <> $sec Then
            $sec = @SEC
            If $RED Then
                GUICtrlSetColor($lbl_text, 0xffffff)
            Else
                GUICtrlSetColor($lbl_text, 0xff0000)
            EndIf
            $RED = Not $RED
        EndIf

    WEnd

    $Readtimer = GUICtrlRead($Inputtimer, 0)
    If $Readtimer = "00:00:00" Then
        MsgBox($MB_ICONWARNING, "Notice", "Time is Up!", 15)
        _SoundStop($Alarm)
    Else
        _SoundStop($Alarm)
        GUICtrlSetData($Inputtimer, "00:00:00")
        GUICtrlDelete($lbl_text2)
        GUICtrlDelete($lbl_text)
    EndIf

EndFunc   ;==>startTimer

 

12 hours ago, pndhcm280- said:

How can i change the font in the menu ?

qUEJYLQ.png

I forgot to add that option, i will add it with the next update. Just open the MetroGUI_UDF.au3 file and change the "$Font = ":

Func _Internal_CreateMButton($Text, $Left, $Top, $Width, $Height, $BG_Color = $GUIThemeColor, $Font_Color = $FontThemeColor, $Font = "Arial", $Fontsize = 9, $FontStyle = 1, $FrameColor = "0xFFFFFF")

You can change a lot of things in the UDF file, for some things i don't want to add an option as it makes it too complicated to set 10 parameters to create a simple button etc.

  • Like 1

Share this post


Link to post
Share on other sites
Mannyfresh15
11 minutes ago, BBs19 said:

 

Try this:

#NoTrayIcon
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>
#include <Timers.au3>
#include <Sound.au3>
#include <MetroGUI_UDF.au3>

;!Highly recommended for improved overall performance and responsiveness of the GUI effects etc.! (after compiling):
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/so /rm /pe

;Required if you want High DPI scaling enabled. (Also requries _Metro_EnableHighDPIScaling())
#AutoIt3Wrapper_Res_HiDpi=y

$Checked = False
$timer = ""
$RED = 1
$sec = @SEC
$Tiempo = ""
$Alarm = "C:\Users\Admin\Downloads\BOMB_SIREN-BOMB_SIREN-247265934.wav" ;Replace this with your own .wav file. you already knew this what the heck

; Setting Time Variables
$5m = 300000
$10m = 600000
$15m = 900250
$30m = 1800500
$45m = 2700750
$1h = 3601000

InetGet("http://imgur.com/download/C5CE14x/", @TempDir & "\Samplepic.jpg")

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

;Enable high DPI support: Detects the users DPI settings and resizes GUI and all controls to look perfectly sharp.
_Metro_EnableHighDPIScaling() ; Note: Requries "#AutoIt3Wrapper_Res_HiDpi=y" for compiling. To see visible changes without compiling, you have to disable dpi scaling in compatibility settings of Autoit3.exe

;Create resizable Metro GUI
$GLOBAL_MAIN_GUI = _Metro_CreateGUI("My app", 484, 209, 255, 124, False)

$Pic1 = GUICtrlCreatePic(@TempDir & "\Samplepic.jpg", 10, 0, 460, 119, 0, $GUI_WS_EX_PARENTDRAG)

;Create an Array containing menu button names
Dim $MenuButtonsArray[4] = ["Settings", "About", "Contact", "Exit"]

;Add/create control buttons to the gui
$Control_Buttons = _Metro_AddControlButtons(True, False, True, False, True) ;CloseBtn = True, MaximizeBtn = True, MinimizeBtn = True, FullscreenBtn = True, MenuBtn = True

;Set variables for the handles of the GUI-Control buttons. (Above function always returns an array this size and in this order, no matter which buttons are selected.
$GUI_CLOSE_BUTTON = $Control_Buttons[0]
GUICtrlSetTip($GUI_CLOSE_BUTTON, "Close")
$GUI_MAXIMIZE_BUTTON = $Control_Buttons[1]
;GUICtrlSetTip($GUI_MAXIMIZE_BUTTON , "Minimizar")
$GUI_RESTORE_BUTTON = $Control_Buttons[2]
$GUI_MINIMIZE_BUTTON = $Control_Buttons[3]
$GUI_FULLSCREEN_BUTTON = $Control_Buttons[4]
$GUI_FSRestore_BUTTON = $Control_Buttons[5]
$GUI_MENU_BUTTON = $Control_Buttons[6]
GUICtrlSetTip($GUI_MENU_BUTTON, "Menu")
;======================================================================================================================================================================


;Create  Buttons
$Button1 = _Metro_CreateButton("start", 206, 177, 75, 25)
$Button2 = _Metro_CreateButton("Abort", 380, 177, 75, 25)

;Create Toggle
$Toggle1 = _Metro_CreateToggle("Alarm", 10, 147, 120, 34)
GUICtrlSetTip($Toggle1, "On/Off")

#Region ### START Koda GUI section ### Form=
$Label1 = GUICtrlCreateLabel("My Timer", 45, 119, 366, 33, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor($Label1, 0xFFFFFF)
GUICtrlSetFont(-1, 16, 0, 0, "Impact")

; Create a combobox control.
$idComboBox = GUICtrlCreateCombo("Select Time", 110, 181, 90, 21)
GUICtrlSetTip(-1, "Select Time")
; Add additional items to the combobox.
GUICtrlSetData($idComboBox, "5 Minutes|10 Minutes|15 Minutes|30 Minutes|45 Minutes|1 Hour", "Select Time")
;
$Label2 = GUICtrlCreateLabel("How much Time?", 4, 183, 100, 25, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor(-1, 0xFFFFFF)
$Inputtimer = GUICtrlCreateInput("00:00:00", 380, 147, 75, 20, BitOR($SS_CENTER, $ES_READONLY))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

;~ GUIRegisterMsg(0x0201, "INTERNAL_WM_LBUTTONDOWN")

While 1
    _Metro_HoverCheck_Loop($GLOBAL_MAIN_GUI)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_PRIMARYDOWN
            DllCall("user32.dll", "int", "ReleaseCapture")
            DllCall("user32.dll", "long", "SendMessage", "hwnd", $GLOBAL_MAIN_GUI, "int", 0x00A1, "int", 2, "int", 0)
        Case $Button1
            startTimer()
        Case $Button2
            Exit
        Case $GUI_CLOSE_BUTTON
            ExitLoop
            Exit
        Case $GUI_MINIMIZE_BUTTON
            GUISetState(@SW_MINIMIZE)
        Case $Toggle1
            If _Metro_ToggleIsChecked($Toggle1) Then
                _Metro_ToggleUnCheck($Toggle1)
                $Checked = False
            Else
                _Metro_ToggleCheck($Toggle1)
                $Checked = True
            EndIf

        Case $GUI_MENU_BUTTON
            Local $MenuSelect = _Metro_MenuStart($GLOBAL_MAIN_GUI, $GUI_MENU_BUTTON, 150, $MenuButtonsArray) ; Opens the metro Menu. See decleration of $MenuButtonsArray above.
            Switch $MenuSelect ;Above function returns the index number of the button from the provided buttons array.
                Case "0"
                    ConsoleWrite("Returned 0 = Settings button clicked." & @CRLF)
                Case "1"
                    ConsoleWrite("Returned 1 = About button clicked." & @CRLF)
                Case "2"
                    ConsoleWrite("Returned 2 = Contact button clicked." & @CRLF)
                Case "3"
                    ConsoleWrite("Returned 3 = Exit button clicked." & @CRLF)
                    Exit

            EndSwitch

    EndSwitch
WEnd

Func startTimer()

    $Comboread = GUICtrlRead($idComboBox, 0)
    If $Comboread = 0 Then
        MsgBox($MB_SYSTEMMODAL, "Warning ", "You Haven't Selected Any Time", 10)
        Return
    Else
        If $Comboread = "5 Minutes" Then $Tiempo = $5m
        If $Comboread = "10 Minutes" Then $Tiempo = $10m
        If $Comboread = "15 Minutes" Then $Tiempo = $15m
        If $Comboread = "30 Minutes" Then $Tiempo = $30m
        If $Comboread = "45 Minutes" Then $Tiempo = $45m
        If $Comboread = "1 Hour" Then $Tiempo = $1h
        ;setting warning labels
        $lbl_text = GUICtrlCreateLabel("Attention!", 180, 149, 80, 17, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
        ;GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
        GUICtrlSetColor($lbl_text, 0xff0000) ; Red
        GUICtrlSetFont($lbl_text, 9, 700)
        ;
        $lbl_text2 = GUICtrlCreateLabel("Timer will stop in:", 250, 150, 125, 20, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
        ;GUICtrlSetResizing(-1, )
        GUICtrlSetColor(-1, 0xFFFFFF)
        ; call ("startTimer2 ")
    EndIf

    ;Checking if timer is greater than 0
    If TimerDiff($timer) > 0 Then
        $timer = TimerInit()
    EndIf

    While (TimerDiff($timer) < $Tiempo)
        ;Setting Toggle
        _Metro_HoverCheck_Loop($GLOBAL_MAIN_GUI) ;To make sure that the hover effects still work
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $Toggle1
                If _Metro_ToggleIsChecked($Toggle1) Then
                    _Metro_ToggleUnCheck($Toggle1)
                    $Checked = False
                Else
                    _Metro_ToggleCheck($Toggle1)
                    $Checked = True
                EndIf
            Case $GUI_MINIMIZE_BUTTON
                GUISetState(@SW_MINIMIZE)
            Case $Button2
                ExitLoop
            Case $GUI_CLOSE_BUTTON
                Exit
        EndSwitch

        $seconds = TimerDiff($timer) / 1000
        $diff = $seconds - ($Tiempo / 1000)
        ;
        $minutes = Int($diff / 60)
        $secondsRem = $diff - ($minutes * 60)
        ;
        $hours = Int($minutes / 60)
        $minutes = $minutes - ($hours * 60)

        ;
        $hours = $hours * -1
        $minutes = $minutes * -1
        $secondsRem = $secondsRem * -1

        $time = StringFormat("%02d", $hours) & ":" & StringFormat("%02d", $minutes) & ":" & StringFormat("%02d", $secondsRem)
        ;
        GUICtrlSetData($Inputtimer, $time)

        ;Checks if timer is higher than 3mins and If toggle is on plays Sound
        If TimerDiff($timer) > $Tiempo - 180000 And $Checked = True Then _SoundPlay($Alarm, 0) ;MsgBox(0,"Aviso","Alarma",5)

        ;Checks if timer is higher than 3mins and If toggle is off checked stops Sound

        If TimerDiff($timer) > $Tiempo - 180000 And $Checked = False Then _SoundStop($Alarm)

        ; Blinking Text

        If @SEC <> $sec Then
            $sec = @SEC
            If $RED Then
                GUICtrlSetColor($lbl_text, 0xffffff)
            Else
                GUICtrlSetColor($lbl_text, 0xff0000)
            EndIf
            $RED = Not $RED
        EndIf

    WEnd

    $Readtimer = GUICtrlRead($Inputtimer, 0)
    If $Readtimer = "00:00:00" Then
        MsgBox($MB_ICONWARNING, "Notice", "Time is Up!", 15)
        _SoundStop($Alarm)
    Else
        _SoundStop($Alarm)
        GUICtrlSetData($Inputtimer, "00:00:00")
        GUICtrlDelete($lbl_text2)
        GUICtrlDelete($lbl_text)
    EndIf

EndFunc   ;==>startTimer

 

 

 

Once again you're badass... It worked like a charm!  Man, you really know what you're doing... Thanks for everything.

Share this post


Link to post
Share on other sites
KarlosTHG

@BBs19 I found something that can be considered a bug in some cases: if you set the $AllowResize option to false when creating a GUI and then use the _GUI_DragAndResizeUpdate it will override the $AllowResize option to true, in some scenarios this may not be intended.

Other bug is that when you do a WinMove() on the just created GUI changing its size before you call GUISetState(@SW_SHOW) the white border is drawn with the old size of the window (please see attached picture)

Thanks!

Regards

error gui.JPG

Edited by KarlosTHG
Added new bug

Share this post


Link to post
Share on other sites
t0nZ

First of all I love this UDF !

One question: what about Combo controls ?

 

Share this post


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

@BBs19 I found something that can be considered a bug in some cases: if you set the $AllowResize option to false when creating a GUI and then use the _GUI_DragAndResizeUpdate it will override the $AllowResize option to true, in some scenarios this may not be intended.

Other bug is that when you do a WinMove() on the just created GUI changing its size before you call GUISetState(@SW_SHOW) the white border is drawn with the old size of the window (please see attached picture)

Thanks!

Regards

Hi, as the name says, the function is intended for resize and drag, therefore i don't know why you would use it if you set $AllowResize to false. I didn't add a seperate function to enable drag only, but i can sure do that if that is what you were trying to do. 

The other one I can't explain, because i don't know how WinMove works in Windows and why it is not resizing the border correctly if the window is not set visible first. But I don't know why it would be a problem... If you set the size/pos while creating, then u won't have the problem. You can also use GUISetState(@SW_HIDE) first, then resize and then set @SW_SHOW. 

 

7 hours ago, t0nZ said:

First of all I love this UDF !

One question: what about Combo controls ?

 

That is too much work man :D I think it would be possible, but it wouldn't be 100% a modern style, as it requires scrollbars and those look bad on older Windows versions. Creating a custom scrollbar is not on my todo list...

Besides that, imo comboboxes look pretty modern on Windows 8 and above. 

 

Share this post


Link to post
Share on other sites
t0nZ

OK got it.

It's true, actually the combobox is not much used in windows 10, there are a few examples with a very small number of items, I have counted a maximum of seven items and without scrollbars, maybe Microsoft has abandoned scrollbars in comboboxes ?

autoplayhero.png

Maybe you can think a combobox limited to ten items and without scrollbars, only an idea I can survive without....:sweating:

Anyway thank you for the good job.

Edited by t0nZ

Share this post


Link to post
Share on other sites
KarlosTHG

hi @BBs19, I'm still working with your awesome UDF, and found some things:

  1. The window cannot be minimized by clicking it on the taskbar as other windows do.
  2. When you try to assign a color to a button background you can not use the hex value directly, it is necessary to pass it as a string, I just found this by reviewing the code.

Thanks man!

Share this post


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

hi @BBs19, I'm still working with your awesome UDF, and found some things:

  1. The window cannot be minimized by clicking it on the taskbar as other windows do.
  2. When you try to assign a color to a button background you can not use the hex value directly, it is necessary to pass it as a string, I just found this by reviewing the code.

Thanks man!

1. Yes this seems to be the case with all WS_POPUP windows. I haven't noticed this before. I will consider creating the non resizable GUI the same way like the the resizable one (preventing the borders from being drawn). However im not sure how this will impact compatibility, I still haven't tested my UDF on all Windows versions. The WS_POPUP version is more reliable than the borderless GUI version.

2. The GDIPlus functions work with ARGB colors. example: "0xFF000000". So the usual RGB hex colors of the Autoit functions don't work here anyways. I can add a workaround to make it work with hex colors, i just didn't see any need for it.

Share this post


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

  • Similar Content

    • sadakathullah
      By sadakathullah
      Hi All, I am new to AutoIT and exploring options to use it in my organization. I tried couple of examples and it is fantastic. I am trying to run restrictions test in a pc to see if certain options are disabled like print screen, mstsc etc. I could not get a hang of it. Any help is much appreciated.
    • somebadhat
      By somebadhat
      THANKS TO RASIM, MARTIN, AND BOOMINGRANNY FOR TEACHING ME HOW TO DO THIS. 
      SCRIPT ONE WORKS ON MY PLATFORM.  IT CREATED THE ATTACHMENTS.
      IMPROVEMENTS ARE WELCOMED. 
      SEE BOLD TEXT BELOW.
      PURPOSE:
      WRITE AN AUTOIT3 SCRIPT THAT WHEN RUN IN A WINDOWS SCHEDULED TASK WILL PRODUCE SCREENSHOTS OF THE DESKTOP, START MENU, QUICK ACCESS MENU, AND DEVICE MANAGER WITHOUT INTERACTION.  IF MULTIPLE SHOTS ARE REQUIRED THE SHOTS CAN BE COMBINED STACKED OR SIDE-BY-SIDE.  SCRIPTS ARE WRITTEN TO RUN ON WINDOWS 10.0.17134.286 PRO 64-BIT IN AN ACCOUNT WITH ADMIN PRIVILEGES IN A WINDOW WITH ADMIN PRIVILEGES AND AUTOIT3 v3.3.14.5
      PROCEDURE:
      WHAT ARE THE COORDINATES OF THE SCREENSHOTS?
      WHERE DO YOU WANT TO CREATE THE SHOTS?
      WHAT DO YOU WANT TO CALL THE SHOTS?
      TAKE THE SHOTS.
      PROCESS THE SHOTS:
      WHERE ARE THEY? WHAT ARE THEY CALLED? WHERE DO YOU WANT THEM TO GO? WHAT DO YOU WANT TO CALL THEM? DO YOU WANT THEM STACKED, SIDE-BY-SIDE, OR NEITHER? TWEAK TO ELIMINATE ERRORS.
      RESULTS: SCRIPT TWO I'VE INCORPORATED THE SUGGESTION OF @BOOMINGRANNY AND MADE A SECOND SCRIPT.  MY WAY OF FINDING THE SHOT COORDINATES OF THE DEVICE MANAGER DID NOT WORK WHEN STARTING THE DEVICE MANAGER THIS WAY . #include <Coordinates.au3> finds incorrect coordinates.  They are shifted down ~50px.  Does not work on menus exposed by right clicking or the start menu. WORK NEEDS TO BE DONE TO ELIMINATE THE BLACK BAR WHEN THE SHOTS ARE NOT THE SAME HEIGHT and ARE BEING DISPLAYED SIDE-BY-SIDE. 
      SEE    If $Position = "right"
      CONCLUSION:
      UNFINISHED AS OF THIS TIME.
      MAKE ROBUST.  A ROBUST SCRIPT FAILS LESS THAN 1% OF THE TIME AND RUNS ON WINDOWS 10 64-BIT THROUGH WINDOWS XP 32-BIT SP0 IN AN ACCOUNT WITH STANDARD/USER/LIMITED PRIVILEGES IN A WINDOW WITH STANDARD/USER/LIMITED PRIVILEGES.   IT WOULD BE NICE TO MAKE THE SCRIPT FASTER AND LIGHTER.

      RESULTS ATTACHED. SCRIPT ONE:
      ;; AUTOIT3 v3.3.14.5 SCRIPT ;; PURPOSE: ; WRITE AN AUTOIT3 SCRIPT THAT WHEN RUN IN A WINDOWS SCHEDULED TASK WILL PRODUCE SCREENSHOTS OF THE WINDOWS 10 DESKTOP, START MENU, QUICK ACCESS MENU, AND DEVICE MANAGER WITHOUT INTERACTION. ;; SEE https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin/ ;; MUST BE RUN WITH ADMIN PRIVILEDGES. NOT ROBUST YET. ;; SCREENSHOT WIN10 DESKTOP, QUICK ACCESS, DEVICE MANAGER AND START MENU. ;; MULTIPLE SHOTS JOINED STACKED, SIDE-BY-SIDE, OR NEITHER. SEE SIDE-BY-SIDE ;; WORK NEEDS TO BE DONE TO ELIMINATE THE BLACK BAR WHEN THE SHOTS ARE NOT THE SAME HEIGHT AND ARE BEING DISPLAYED SIDE-BY-SIDE. ;; MY GUESS THE EASIEST THING TO DO WOULD BE TO TURN IT WHITE. ;; YOU WILL HAVE TO TELL IT WHERE YOUR TASKBAR EXPLORER SHORTCUT IS. SEE MouseClick ( "right", 74, 748, 1, 0) ;; YOU WILL HAVE TO TELL IT WHERE TO PROCESS AND MOVE THE SHOTS. SEE MULTIPLE OF $ZDIR, $ZNAME, FQPN SEE $outputFile ;; ;; IMPROVEMENTS ARE WELCOMED ;; FIND LIST OF ENVIRONMENT VARIABLES NAMES ;; AUTOIT3 HELP File ;; "C:\Program Files (x86)\AutoIt3\AutoIt.chm" ;; SEARCH FOR MACRO REFERENCE AND MACRO REFERENCE - DIRECTORY ;; THANKS TO RASIM, MARTIN, AND BOOMINGRANNY AT AUTOITSCRIPT.COM ; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/ ; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/?do=findComment&comment=581214 ; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/?do=findComment&comment=581372 ; https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin/ ; https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin//?do=findComment&comment=1407181 ;; "C:\Program Files (x86)\AutoIt3\AutoIt3_x64.exe" "F:\MYAPPS\WINDOWS\screenshots1.au3" ;; Screenshot Win10 desktop, quick access, device manager, start menu. Automated. Shots stacked or side-by-side. Requires admin. ; BEGIN How to get 4 Screen Coordinates just by dragging a Rectangle ; download Coordinates.au3 https://www.autoitscript.com/forum/applications/core/interface/file/attachment.php?id=59228 ; END How to get 4 Screen Coordinates just by dragging a Rectangle ; BEGIN CAPTURE ; https://www.autoitscript.com/forum/topic/8377-capture-screen-dll/ ; Capture full screen ; Fist parameter - filename, last - jpeg quality. #include <ScreenCapture.au3> ; BEGIN THE FOLLOWING REQUIRED TO SHOOT THE ENTIRE DEVICE MANAGER IN ONE SHOT ; https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin//?do=findComment&comment=1407181 ; credit for the screenshot scrolling code goes to monoscout999 #include <ScrollBarsConstants.au3> #include <WindowsConstants.au3> #include <process.au3> #include <GuiTreeView.au3> #include <GuiScrollBars.au3> #include <WinAPISysWin.au3> ; END THE FOLLOWING REQUIRED TO SHOOT THE ENTIRE DEVICE MANAGER IN ONE SHOT ; BETTER RESULTS IF AT LEASE ONE EXPLORER WINDOW IS OPEN Run("explorer.exe", "", @SW_SHOWMINIMIZED) ; Run( @comspec & " /c start explorer.exe","", @SW_SHOWMINIMIZED) ; Run( @comspec & " /c start explorer.exe","", @SW_HIDE) WinWait("My Computer") ; WinActivate("My Computer") ; WinSetState("My Computer", "", @SW_MAXIMIZE) ; wake the monitor, show the desktop, wait X milliseconds ; Send(" ") send( "#d" ) Sleep( 500 ) ; QUICK ACCESS ; https://www.autoitscript.com/autoit3/docs/functions/MouseClick.htm MouseClick ( "right", 74, 748, 1, 0 ) ; right click windows explorer shortcut on taskbar to open context menu Sleep( 250 ) send("{PGDN}") ; expose the most pinned items Sleep( 250 ) send("{down}") ; expose the most pinned items $ZDIR=@homeDrive & "\Users\Default\Desktop\UPDATE" ;where does the screenshot go $ZNAME="\quick-access.jpg" ;what will its name be $ZTOPX=0 $ZTOPY=0 $ZBOTTOMX=250 $ZBOTTOMY=615 Sleep( 500 ) ScreenShot() ; Sleep( 2000 ) MouseClick ( "left", 74, 748, 1, 0 ) ; left click windows explorer shortcut on taskbar to close context menu send( "#d" ) ; show desktop ; exit ; START MENU Sleep( 500 ) send("{LWIN}") ;OPEN START MENU $ZDIR=@tempDir ;where does the screenshot go $ZNAME="\start-menu1.jpg" ;what will its name be $ZTOPX=315 $ZTOPY=139 $ZBOTTOMX=1285 $ZBOTTOMY=660 Sleep( 1250 ) ScreenShot() ; BEGIN WEAK POINT send("{tab}"); COMBINING TABS BREAKS SCRIPT Sleep( 120 ) send("{tab}") Sleep( 120 ) send("{tab}") Sleep( 500 ) send("{down 8}"); move to the bottom of the start menu to take the next screenshot. operates on the first column of shortcuts. will only go to the bottom of it. add send("{right}") after the last tab to operate on another column. ; END WEAK POINT ; $ZDIR=@tempDir ;where does the screenshot go $ZNAME="\start-menu2.jpg" ;what will its name be $ZTOPX=315 $ZTOPY=409 $ZBOTTOMX=1285 $ZBOTTOMY=730 Sleep( 125 ) ScreenShot() send("{LWIN}") ; CLOSE THE START MENU ; DESKTOP $ZDIR=@homeDrive & "\Users\Default\Desktop\UPDATE" ;where does the screenshot go $ZNAME="\desktop.jpg" ;what will its name be $ZTOPX=0 $ZTOPY=0 $ZBOTTOMX=-1 $ZBOTTOMY=-1 Sleep( 125 ) ScreenShot() ; BEGIN OPEN DEVICE MANAGER MAXIMIZED ; CHOOSE YOUR POISON Run( @comspec & " /c start devmgmt.msc","", @SW_HIDE) WinWait("Device Manager") WinActivate("Device Manager") WinSetState("Device Manager", "", @SW_MAXIMIZE) ; ; BEGIN SHOOTING THE DEVICE MANAGER THE FOLLOWING WAY REQUIRED: ; 1. IT BE DONE AT THE BEGINNING OF THE SCRIPT. ; 2. MORE WORK TO FIND THE COORDINATES: ; https://www.autoitscript.com/forum/topic/165325-how-to-get-4-screen-coordinates-just-by-dragging-a-rectangle/?do=findComment&comment=1206830 ; modified and saved as "C:\Program Files (x86)\AutoIt3\Include\Coordinates.au3" ; download Coordinates.au3 https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin/ ; Run("control /name Microsoft.DeviceManager") ; script must be run with admin privileges ; WinWaitActive("Device Manager") ; $WinHndl = WinGetHandle("Device Manager") ; WinMove($WinHndl,"",-4,0,@DesktopWidth+10,@DesktopHeight) ; MAKE ADJUSTMENTS HERE ; #include <Coordinates.au3> ; END SHOOTING THE DEVICE MANAGER THE FOLLOWING WAY REQUIRED: ; ; Run("mmc devmgmt.msc") ; WinActivate ( "Device Manager", "" ) ; Sleep( 125 ) ; WinSetState("[ACTIVE]", "", @SW_MAXIMIZE) ; Sleep( 125 ) ; WinSetState("Device Manager", "", @SW_MAXIMIZE) ; END OPEN DEVICE MANAGER MAXIMIZED Sleep( 1000 ) Send("{TAB}") Sleep( 250 ) send("{down 4}") Sleep( 250 ) send("{right}") ;DISK DRIVES Sleep( 250 ) send("{down2}") Sleep( 250 ) send("{right}") ;DISPLAY ADAPTERS Sleep( 250 ) send("{down 5}") Sleep( 250 ) send("{right}") ;IDE ATA/ATAPI CONTROLLERS Sleep( 250 ) send("{down 6}") Sleep( 250 ) send("{right}") ;NETWORK ADAPTERS $ZDIR=@tempDir ;where does the screenshot go $ZNAME="\device-manager1.jpg" ;what will its name be $ZTOPX=2 $ZTOPY=77 $ZBOTTOMX=272 $ZBOTTOMY=382 Sleep( 250 ) ScreenShot() send("{down 15}") Sleep( 250 ) send("{right}") ;SOUND, VIDEO, AND GAME CONTROLLERS Sleep( 250 ) send("{down 7}") ;MOVES NETWORK ADAPTERS TO THE $ZTOPY=273 POSITION $ZDIR=@tempDir ;where does the screenshot go $ZNAME="\device-manager2.jpg" ;what will its name be $ZTOPX=2 $ZTOPY=273 $ZBOTTOMX=272 $ZBOTTOMY=638 Sleep( 250 ) ScreenShot() Sleep( 1000 ) ; https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin//?do=findComment&comment=1407181 ; credit for the screenshot scrolling code goes to monoscout999 ; screenshot of everything in the device manager $outputFile = @HomeDrive&"\Users\Default\Desktop\UPDATE\device-manager2.jpg" ;get a handle of things $WinHndl = WinGetHandle("Device Manager") $Treeview = ControlGetHandle("Device Manager","","[Class:SysTreeView32]") ;expand the treeview control _GUICtrlTreeView_Expand($Treeview) MouseMove(300,200) MouseWheel("up",100) Sleep(250) ;Get Edit1 Vertical Scroll Min/Max range and page size. $aScrollRange = _GUIScrollBars_GetScrollRange($Treeview, $SB_VERT) $iPageSize = _GUIScrollBars_GetScrollInfoPage($Treeview, $SB_VERT) $iPages = Round($aScrollRange[1] / $iPageSize) ;get treeview control size $aTreeviewPos = ControlGetPos($WinHndl,"",$Treeview) ;Capture $scrollBarSize = 20 $hDC = _winapi_GetDC($Treeview) $hCDC = _WinAPI_CreateCompatibleDC($hDC) $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $aTreeviewPos[2] - $scrollBarSize , ($aTreeviewPos[3] * ($iPages +1 ))) _WinAPI_SelectObject($hCDC, $hBMP) For $i = 0 to $iPages+1 _WinAPI_BitBlt($hCDC, 0, $aTreeviewPos[3] * $i, $aTreeviewPos[2] - $scrollBarSize , ($aTreeviewPos[3] ), $hDC,0, 0, $SRCCOPY) _WinAPI_PostMessage($Treeview,$WM_VSCROLL,$SB_PAGEDOWN,0) Sleep(250) Next _WinAPI_ReleaseDC($Treeview, $hDC) _WinAPI_DeleteDC($hCDC) _GDIPlus_Startup() $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) _GDIPlus_ImageSaveToFile($hImage, $outputFile) _GDIPlus_Shutdown() _WinAPI_DeleteObject($hBMP) ; If FileExists($outputFile) Then ShellExecute($outputFile) Sleep( 1000 ) ProcessClose ( "mmc.exe" ) ; close the device manager. THIS MIGHT BE WEAK. ; MouseMove ( 1150, 650) ; TO START, SECURE, SHUTDOWN SHORTCUT Sleep( 1000 ) ;; END CAPTURE ;; BEGIN JOIN IMAGES #include <GDIPlus.au3> #include <WinAPISysWin.au3> ; FULLY QUALIFIED PATH NAME (FQPN) TO FIRST IMAGE, FQPN TO SECOND IMAGE, FQPN TO COMBINED IMAGE ; _BMPJoin(@tempDir & "\start-menu1.jpg", @tempDir & "\start-menu2.jpg", @homeDrive & "\Users\Default\Desktop\UPDATE\start-menu.jpg", "right") ; SIDE-BY-SIDE ; _BMPJoin(@tempDir & "\device-manager1.jpg", @tempDir & "\device-manager2.jpg", @homeDrive & "\Users\Default\Desktop\UPDATE\device-manager.jpg", "") ; STACKED _BMPJoin(@tempDir & "\start-menu1.jpg", @tempDir & "\start-menu2.jpg", @homeDrive & "\Users\Default\Desktop\UPDATE\start-menu.jpg", "") _BMPJoin(@tempDir & "\device-manager1.jpg", @tempDir & "\device-manager2.jpg", @homeDrive & "\Users\Default\Desktop\UPDATE\device-manager.jpg", "") ;; END JOIN IMAGES Exit ; END OF SCRIPT ;; BEGIN SCREENSHOT FUNCTION Func ScreenShot() ; Capture full screen _ScreenCapture_Capture($ZDIR & $ZNAME, $ZTOPX, $ZTOPY, $ZBOTTOMX, $ZBOTTOMY) EndFunc ;==>ScreenShot ; https://www.autoitscript.com/autoit3/docs/libfunctions/_ScreenCapture_Capture.htm ; $iLeft [optional] X coordinate of the upper left corner of the rectangle ; $iTop [optional] Y coordinate of the upper left corner of the rectangle ; $iRight [optional] X coordinate of the lower right corner of the rectangle. If this is -1, the current screen width will be used. ; $iBottom [optional] Y coordinate of the lower right corner of the rectangle. If this is -1, the current screen height will be used. ;; END SCREENSHOT FUNCTION ;; BEGIN JOIN IMAGES FUNCTION ; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/ Func _BMPJoin($sFile1, $sFile2, $sResult, $Position) Local $hSourceIMG1, $hSourceIMG2, $iWidth1, $width2, $iHeight1, $iHeight2, $hBitmap, $hImage, $hGraphics Local $iBwidth, $iBheight If Not FileExists(StringRegExpReplace($sResult, "(^.*)\\.*", "\1")) Then $sResult = @ScriptDir & "\result.bmp" _GDIPlus_Startup() $hSourceIMG1 = _GDIPlus_ImageLoadFromFile($sFile1) $hSourceIMG2 = _GDIPlus_ImageLoadFromFile($sFile2) $iWidth1 = _GDIPlus_ImageGetWidth($hSourceIMG1) $iHeight1 = _GDIPlus_ImageGetHeight($hSourceIMG1) $iWidth2 = _GDIPlus_ImageGetWidth($hSourceIMG2) $iHeight2 = _GDIPlus_ImageGetHeight($hSourceIMG2) If $Position = "right" Then $iBwidth = $iWidth1 + $iWidth2 $iBheight = $iHeight1 if $iHeight2 > $iHeight1 then $iBheight = $iHeight2 ; WORK NEEDS TO BE DONE TO ELIMINATE THE BLACK BAR WHEN THE SHOTS ARE NOT THE SIZE HEIGHT AND ARE BEING DISPLAYED SIDE-BY-SIDE. Else;position = "below" $iBwidth = $iWidth1 if $iWidth2 > $iWidth1 then $iBwidth = $iWidth2 $iBheight = $iHeight1 + $iHeight2 EndIf $hBitmap = _CreateBMP($iBwidth, $iBheight) $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage) ; https://www.autoitscript.com/autoit3/docs/libfunctions/_GDIPlus_GraphicsDrawImageRectRect.htm _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hSourceIMG1, 0, 0, $iWidth1, $iHeight1, 0, 0, $iWidth1, $iHeight1) If $Position = "right" Then _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hSourceIMG2, 0, 0, $iWidth2, $iHeight2, $iWidth1, 0, $iWidth2, $iHeight2) Else _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hSourceIMG2, 0, 0, $iWidth2, $iHeight2, 0, $iHeight1, $iWidth2, $iHeight2) EndIf _GDIPlus_ImageSaveToFile($hImage, $sResult) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_ImageDispose($hSourceIMG1) _GDIPlus_ImageDispose($hSourceIMG2) _GDIPlus_Shutdown() EndFunc ;==>_BMPJoin Func _CreateBMP($sWidth, $sHeight) Local $hWnd, $hDC, $hBMP $hWnd = _WinAPI_GetDesktopWindow() $hDC = _WinAPI_GetDC($hWnd) $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $sWidth, $sHeight) _WinAPI_ReleaseDC($hWnd, $hDC) Return $hBMP EndFunc ;==>_CreateBMP ;; END JOIN IMAGES FUNCTION SCRIPT TWO:
      ;; AUTOIT3 v3.3.14.5 SCRIPT ;; PURPOSE: ; WRITE AN AUTOIT3 SCRIPT THAT WHEN RUN IN A WINDOWS SCHEDULED TASK WILL PRODUCE A SCREENSHOT OF THE WINDOWS 10 DESKTOP, START MENU, QUICK ACCESS MENU, AND DEVICE MANAGER WITHOUT INTERACTION. ;; SEE https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin/ ;; MUST BE RUN WITH ADMIN PRIVILEDGES. NOT ROBUST YET. ;; DOWNLOAD COORDINATES.AU3 https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin/ ;; SCREENSHOT WIN10 DESKTOP, QUICK ACCESS, DEVICE MANAGER AND START MENU. ;; MULTIPLE SHOTS JOINED STACKED, SIDE-BY-SIDE, OR NEITHER. SEE SIDE-BY-SIDE ;; WORK NEEDS TO BE DONE TO ELIMINATE THE BLACK BAR WHEN THE SHOTS ARE NOT THE SAME HEIGHT AND ARE BEING DISPLAYED SIDE-BY-SIDE. ;; MY GUESS THE EASIEST THING TO DO WOULD BE TO TURN IT WHITE. ;; YOU WILL HAVE TO TELL IT WHERE YOUR TASKBAR EXPLORER SHORTCUT IS. SEE MouseClick ( "right", 74, 748, 1, 0) ;; YOU WILL HAVE TO TELL IT WHERE TO PROCESS AND MOVE THE SHOTS. SEE MULTIPLE OF $ZDIR, $ZNAME, FQPN SEE $outputFile ;; IMPROVEMENTS ARE WELCOMED ;; FIND LIST OF ENVIRONMENT VARIABLES NAMES ;; AUTOIT3 HELP File ;; "C:\Program Files (x86)\AutoIt3\AutoIt.chm" ;; SEARCH FOR MACRO REFERENCE AND MACRO REFERENCE - DIRECTORY ;; THANKS TO RASIM, MARTIN, AND BOOMINGRANNY AT AUTOITSCRIPT.COM ; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/ ; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/?do=findComment&comment=581214 ; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/?do=findComment&comment=581372 ; https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin/ ; https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin//?do=findComment&comment=1407181 ;; "C:\Program Files (x86)\AutoIt3\AutoIt3_x64.exe" "F:\MYAPPS\WINDOWS\screenshots9.au3" ;; Screenshot Win10 desktop, quick access, device manager, start menu. Shots stacked or side-by-side. Admin privileges. Not robust. ; BEGIN CAPTURE ; https://www.autoitscript.com/forum/topic/8377-capture-screen-dll/ ; Capture full screen ; Fist parameter - filename, last - jpeg quality. #include <ScreenCapture.au3> send("#d") ; show desktop ;DEVICE MANAGER ;STARTING THE DEVICE MANAGER THIS WAY REQUIRED: ; 1. IT BE DONE AT THE BEGINNING OF THE SCRIPT. ; 2. MORE WORK TO FIND THE COORDINATES: ; https://www.autoitscript.com/forum/topic/165325-how-to-get-4-screen-coordinates-just-by-dragging-a-rectangle/?do=findComment&comment=1206830 ; modified and saved as "C:\Program Files (x86)\AutoIt3\Include\Coordinates.au3" ; download Coordinates.au3 https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin/ Run("control /name Microsoft.DeviceManager") WinWaitActive("Device Manager") $WinHndl = WinGetHandle("Device Manager") WinMove($WinHndl,"",-4,0,@DesktopWidth+10,@DesktopHeight) ; MAKE ADJUSTMENTS HERE IF NECESSARY Sleep( 1000 ) Send("{TAB}") Sleep( 125 ) send("{down 4}") Sleep( 125 ) send("{right}") Sleep( 125 ) send("{down2}") Sleep( 125 ) send("{right}") Sleep( 125 ) send("{down 5}") Sleep( 125 ) send("{right}") Sleep( 500 ) send("{down 5}") Sleep( 500 ) send("{right}") Sleep( 125 ) send("{down 14}") Sleep( 125 ) send("{right}") Sleep( 125 ) send("{down 7}") Sleep ( 120 ) $ZDIR=@tempDir ;where does the screenshot go $ZNAME="\device-manager1.jpg" ;what will its name be $ZTOPX=24 $ZTOPY=84 $ZBOTTOMX=277 $ZBOTTOMY=374 #include <Coordinates.au3>; finds incorrect coordinates. They are shifted down ~50px. Does not work on menus exposed by right clicking or the start menu ScreenShot () ; exit $ZDIR=@tempDir ;where does the screenshot go $ZNAME="\device-manager2.jpg" ;what will its name be $ZTOPX=24 $ZTOPY=374 $ZBOTTOMX=277 $ZBOTTOMY=716 #include <Coordinates.au3>; finds incorrect coordinates. They are shifted down ~50px. Does not work on menus exposed by right clicking or the start menu ScreenShot() Sleep( 500 ) ProcessClose ( "mmc.exe" ) ; close the device manager ; QUICK ACCESS ; https://www.autoitscript.com/autoit3/docs/functions/MouseClick.htm MouseClick ( "right", 74, 748, 1, 0) ; right click windows explorer shortcut on taskbar. Sleep( 1200 ) send("{up}") ; SCRIPT MORE RELIABLE IF UPs ARE NOT COMBINED Sleep( 120 ) send("{up}") Sleep( 120 ) send("{up}") Sleep( 120 ) send("{up}") Sleep( 120 ) send("{down}") Sleep (1200) $ZDIR=@homeDrive & "\Users\Default\Desktop\UPDATE" ;where does the screenshot go $ZNAME="\quick-access.jpg" ;what will its name be $ZTOPX=0 $ZTOPY=0 $ZBOTTOMX=251 $ZBOTTOMY=615 #include <Coordinates.au3>; finds incorrect coordinates. They are shifted down ~50px. Does not work on menus exposed by right clicking or the start menu ScreenShot() Sleep ( 250 ) ; START MENU send("{LWIN}") ;OPEN START MENU Sleep ( 250 ) $ZDIR=@tempDir ;where does the screenshot go $ZNAME="\start-menu1.jpg" ;what will its name be $ZTOPX=315 $ZTOPY=139 $ZBOTTOMX=1285 $ZBOTTOMY=660 #include <Coordinates.au3>; finds incorrect coordinates. They are shifted down ~50px. Does not work on menus exposed by right clicking or the start menu ScreenShot() ; BEGIN WEAK POINT send("{tab}"); COMBINING TABS BREAKS SCRIPT Sleep ( 240 ) send("{tab}") Sleep ( 240 ) send("{tab}") Sleep ( 500 ) send("{down 8}"); move to the bottom of the start menu to take the next screenshot. operates on the first column of shortcuts. will only go to the bottom of it. add send("{right}") after the last tab to operate on another column. Sleep ( 1000 ) ; END WEAK POINT ; $ZDIR=@tempDir ;where does the screenshot go $ZNAME="\start-menu2.jpg" ;what will its name be $ZTOPX=315 $ZTOPY=409 $ZBOTTOMX=1285 $ZBOTTOMY=730 #include <Coordinates.au3>; finds incorrect coordinates. They are shifted down ~50px. Does not work on menus exposed by right clicking or the start menu ScreenShot() Sleep ( 120 ) send("{LWIN}") ; CLOSE THE START MENU Sleep ( 120 ) ; DESKTOP $ZDIR=@homeDrive & "\Users\Default\Desktop\UPDATE" ;where does the screenshot go $ZNAME="\desktop.jpg" ;what will its name be $ZTOPX=0 $ZTOPY=0 $ZBOTTOMX=-1 $ZBOTTOMY=-1 ScreenShot() sleep (500) ;; END CAPTURE ;; BEGIN JOIN IMAGES #include <GDIPlus.au3> #include <WinAPISysWin.au3> ; FULLY QUALIFIED PATH NAME (FQPN) TO FIRST IMAGE, FQPN TO SECOND IMAGE, FQPN TO COMBINED IMAGE ; _BMPJoin(@tempDir & "\start-menu1.jpg", @tempDir & "\start-menu2.jpg", @homeDrive & "\Users\Default\Desktop\UPDATE\start-menu.jpg", "right") ; SIDE-BY-SIDE ; _BMPJoin(@tempDir & "\device-manager1.jpg", @tempDir & "\device-manager2.jpg", @homeDrive & "\Users\Default\Desktop\UPDATE\device-manager.jpg", "") ; STACKED _BMPJoin(@tempDir & "\start-menu1.jpg", @tempDir & "\start-menu2.jpg", @homeDrive & "\Users\Default\Desktop\UPDATE\start-menu.jpg", "") _BMPJoin(@tempDir & "\device-manager1.jpg", @tempDir & "\device-manager2.jpg", @homeDrive & "\Users\Default\Desktop\UPDATE\device-manager.jpg", "") ;; END JOIN IMAGES Exit ; END OF SCRIPT ;; BEGIN SCREENSHOT FUNCTION Func ScreenShot() ; Capture full screen _ScreenCapture_Capture($ZDIR & $ZNAME, $ZTOPX, $ZTOPY, $ZBOTTOMX, $ZBOTTOMY) EndFunc ;==>ScreenShot ; https://www.autoitscript.com/autoit3/docs/libfunctions/_ScreenCapture_Capture.htm ; $iLeft [optional] X coordinate of the upper left corner of the rectangle ; $iTop [optional] Y coordinate of the upper left corner of the rectangle ; $iRight [optional] X coordinate of the lower right corner of the rectangle. If this is -1, the current screen width will be used. ; $iBottom [optional] Y coordinate of the lower right corner of the rectangle. If this is -1, the current screen height will be used. ;; END SCREENSHOT FUNCTION ;; BEGIN JOIN IMAGES FUNCTION ; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/ Func _BMPJoin($sFile1, $sFile2, $sResult, $Position) Local $hSourceIMG1, $hSourceIMG2, $iWidth1, $width2, $iHeight1, $iHeight2, $hBitmap, $hImage, $hGraphics Local $iBwidth, $iBheight If Not FileExists(StringRegExpReplace($sResult, "(^.*)\\.*", "\1")) Then $sResult = @ScriptDir & "\result.bmp" _GDIPlus_Startup() $hSourceIMG1 = _GDIPlus_ImageLoadFromFile($sFile1) $hSourceIMG2 = _GDIPlus_ImageLoadFromFile($sFile2) $iWidth1 = _GDIPlus_ImageGetWidth($hSourceIMG1) $iHeight1 = _GDIPlus_ImageGetHeight($hSourceIMG1) $iWidth2 = _GDIPlus_ImageGetWidth($hSourceIMG2) $iHeight2 = _GDIPlus_ImageGetHeight($hSourceIMG2) If $Position = "right" Then $iBwidth = $iWidth1 + $iWidth2 $iBheight = $iHeight1 if $iHeight2 > $iHeight1 then $iBheight = $iHeight2 ; WORK NEEDS TO BE DONE TO ELIMINATE THE BLACK BAR WHEN THE SHOTS ARE NOT THE SIZE HEIGHT AND ARE BEING DISPLAYED SIDE-BY-SIDE. Else;position = "below" $iBwidth = $iWidth1 if $iWidth2 > $iWidth1 then $iBwidth = $iWidth2 $iBheight = $iHeight1 + $iHeight2 EndIf $hBitmap = _CreateBMP($iBwidth, $iBheight) $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage) ; https://www.autoitscript.com/autoit3/docs/libfunctions/_GDIPlus_GraphicsDrawImageRectRect.htm _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hSourceIMG1, 0, 0, $iWidth1, $iHeight1, 0, 0, $iWidth1, $iHeight1) If $Position = "right" Then _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hSourceIMG2, 0, 0, $iWidth2, $iHeight2, $iWidth1, 0, $iWidth2, $iHeight2) Else _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hSourceIMG2, 0, 0, $iWidth2, $iHeight2, 0, $iHeight1, $iWidth2, $iHeight2) EndIf _GDIPlus_ImageSaveToFile($hImage, $sResult) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_ImageDispose($hSourceIMG1) _GDIPlus_ImageDispose($hSourceIMG2) _GDIPlus_Shutdown() EndFunc ;==>_BMPJoin Func _CreateBMP($sWidth, $sHeight) Local $hWnd, $hDC, $hBMP $hWnd = _WinAPI_GetDesktopWindow() $hDC = _WinAPI_GetDC($hWnd) $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $sWidth, $sHeight) _WinAPI_ReleaseDC($hWnd, $hDC) Return $hBMP EndFunc ;==>_CreateBMP ;; END JOIN IMAGES FUNCTION ;; BEGIN COORDINATES FUNCTION ;; END COORDINATES FUNCTION
      KEYWORDS: RIGHT CLICK EXPLORER SHORTCUT PINNED TO TASKBAR PINNED TO QUICK ACCESS PIN TO QUICK ACCESS PIN TO EXPLORER PINNED TO EXPLORER
       
       
    • stayready40
      By stayready40
      Hello all. I created a script to uninstall Symantec from our environment and I placed the "BlockInput(1)" command in the beginning of the script so that end users would not be able to move the mouse or keyboard to disrupt the mouse clicks.
      During testing we found that this worked for our Windows 7 machines, but for our windows 10 machines the mouse disable did not work can anyone shed some light on why this is? 
      Here is my code:

       
    • faustf
      By faustf
      hi guys
      i have a script  like this,  in windows 7 work perfect , in windows 10 not  work  , some one can explain me  why ??'
      #include <Array.au3> #include <MsgBoxConstants.au3> Global $aGPathFoto= FileReadToArray (@ScriptDir & "\TEMP\PathFoto.txt") Local $ctrl = 0 While 1 Local $hWnd = WinWait("[CLASS:#32770]", "", 10) If WinExists("[CLASS:#32770]") Then If $ctrl < 2 Then ControlSend($hWnd, "Choose File to Upload", "[CLASS:Edit; INSTANCE:1]", $aGPathFoto[0]&"{Enter}") Exit $ctrl += 1 Else ExitLoop EndIf EndIf WEnd $aGpathfoto = C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg
    • Skeletor
      By Skeletor
      Hi Virtual People, 
      I'm trying to lock my screen in Windows 10 but to no avail. 
      Has Windows 10 forbidden this feature? 
      Send("#l") Above code does not work. Even sending Ctrl Alt Del does not work nor as an Admin. 
      Note: I want to lock my screen, not log off. Thanks for been kind.
       
×