Jump to content

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


BBs19
 Share

Recommended Posts

On 3/15/2018 at 4:11 PM, Reekod said:

Hi there 

really nice work, why don't you share the 5.2 version used in your TV shows APPS ? 

the _List_CreateGUI is a pure and wonderfull advance for Auto-it scripting

regards


 

Hi, I didn't really test it or document anything of that version.

I am taking a break at the moment. TV-Show-Manager used the last of my resources :P

I will eventually start programming again and fix MetroGUI UDF.

The way I am creating custom lists is nothing special. The main problem is the limitation of Windows. After a certain size, it will stop drawing the items at the bottom and they will end up all at the same spot. I had this problem when I created custom graphs with + 200 Items. So not sure if it is worth adding to MetroUDF.

Link to comment
Share on other sites

@x_bennY

Search and you will find :)

On 27/10/2017 at 4:47 PM, BBs19 said:

You can't edit the text of buttons as they are pictures, they need to be recreated to edit the text. I might add this later, but for now you can use two buttons and hide one if you for example want a button that switches between Start / Stop

Link to comment
Share on other sites

  • 2 weeks later...

Can i change an existing button color, or do i have to recreate the button?

Sorry if the question seems silly, i couldn't find an answer in the thread.

Edit: Ok, i guess it's the same answer as above...

Edited by pintas
Link to comment
Share on other sites

  • 4 months later...

I surgest add base control as label, group, combo, input.

For a sample:

Func _Metro_CreateLabel($Text,$x,$y,$w,$h,$tyle=-1,$xstyle =-1,$Font_Color = $FontThemeColor, $Font = "Segoe UI", $Fontsize = "12")
$hLabel = GUICtrlCreateLabel($Text,$x,$y,$w,$h,$tyle,$xstyle)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($hLabel), "wstr", 0, "wstr", 0)
    GUICtrlSetFont($hLabel, $Fontsize, 500, 0, $Font)
    GUICtrlSetColor($hLabel, $Font_Color)
    Return $hLabel
EndFunc

Func _Metro_CreateGroup($Text,$x,$y,$w,$h,$tyle=-1,$xstyle =-1,$Font_Color = $FontThemeColor, $Font = "Segoe UI", $Fontsize = "12")
$hgroup = GUICtrlCreateGroup($Text,$x,$y,$w,$h,$tyle,$xstyle)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($hgroup), "wstr", 0, "wstr", 0)
    GUICtrlSetFont($hgroup, $Fontsize, 500, 0, $Font)
    GUICtrlSetColor($hgroup, $Font_Color)
    Return $hgroup
EndFunc

Func _Metro_CreateInput($Text,$x,$y,$w,$h,$tyle=-1,$xstyle =-1,$BG_Color = $GUIThemeColor,$Font_Color = $FontThemeColor, $Font = "Arial", $Fontsize = "9")
    $hInput = GUICtrlCreateInput($Text,$x,$y,$w,$h,$tyle,$xstyle)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($hInput), "wstr", 0, "wstr", 0)
    GUICtrlSetFont($hInput, $Fontsize, 400, 0, $Font)
    GUICtrlSetColor($hInput, $Font_Color)
    GUICtrlSetBkColor($hInput,$GUIThemeColor)
    _cHvr_Register($hInput, "_iHoverOff", "_iHoverOn")
    Return $hInput
EndFunc

Func _Metro_CreateCombo($Text,$x,$y,$w,$h,$tyle=-1,$xstyle =-1,$BG_Color = $GUIThemeColor,$Font_Color = $FontThemeColor, $Font = "Arial", $Fontsize = "9")
    $hcombo = GUICtrlCreateCombo($Text,$x,$y,$w,$h,$tyle,$xstyle)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($hcombo), "wstr", 0, "wstr", 0)
    GUICtrlSetFont($hcombo, $Fontsize, 400, 0, $Font)
    GUICtrlSetColor($hcombo, $Font_Color)
    GUICtrlSetBkColor($hcombo,$GUIThemeColor)
    Return $hcombo
EndFunc

 

Link to comment
Share on other sites

  • 1 month later...

I 'm new on metrogui udf.
I have a ask, I click checkbox but checkbox is not checked ???

And I want to add $GUI_CLOSE_EVRNT but ı get a error

#include <MetroGUI_UDF.au3>
HotKeySet("{ESC}","_exit")
$1 = _Metro_CreateGUI("NpcBot",500,500)
_Metro_AddControlButtons(True,False,True,False)
_Metro_CreateCheckbox("X-2 NPC",10,10,150,24)
_Metro_SetGUIOption($1,True,False)
GUISetState(@SW_SHOW)
While 1
;~ $nMsg = GUIGetMsg()
;~ Switch $nMsg
;~     Case $GUI_EVENT_CLOSE
;~             Exit
;~     Case $GUI_EVENT_MINIMIZE
;~         Exit
;~ EndSwitch
WEnd
Func _exit()
    Exit
EndFunc

Link to comment
Share on other sites

Hi there. First of all, i ADORE your UDF!

My programming skills are Novice. I am learning autoIT to automatize some of my task at work.

I am having a hard time with Metro checkboxes and Array. 

 

i Used to have a script that create a ticket in our IT ticketing System. 

here is my old code : 

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=Beta
#AutoIt3Wrapper_Icon=Media\newhire.ico
#AutoIt3Wrapper_Outfile=..\Addon\NewHire.exe
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_Fileversion=4.0.0.34
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.2
 Author:         JJ

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <AutoItConstants.au3>
#include 'ExtInputBox.au3'
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <Date.au3>
#include <Timers.au3>
#include <GuiComboBox.au3>

;Global variable for the entire script

Global $sFileVersion = FileGetVersion(@AutoItExe)

Global $g_bPaused = False
HotKeySet("{ESC}", "Terminate")
HotKeySet("{PAUSE}", "TogglePause")



preform()

Func preform()

;#Region ### START Koda GUI section ### Form=
Global $preform = GUICreate("Pre-Script Form", 401, 351, 617, 452)
$Prefixlabel = GUICtrlCreateLabel("Employe State", 8, 16, 100, 21)

    Global $prefixroot = GUICtrlCreateCombo("", 144, 16, 169, 21, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))

        GUICtrlSetData(-1, "New Hire|Mat leave Return|Transfert")
        GUICtrlSetTip(-1, "Choose Employee State")

    Global $Nameroot = GUICtrlCreateInput("", 144, 48, 169, 21)
        GUICtrlSetTip(-1, "Enter Full Name")

            $Namelabel = GUICtrlCreateLabel("Employe Name", 8, 48, 100, 21)
            GUICtrlSetTip(-1, "Please enter FULL NAME")

    Global $Usernameroot = GUICtrlCreateInput("", 144, 80, 169, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_UPPERCASE))
        GUICtrlSetTip(-1, "Enter Username")

            $Usernamelabel = GUICtrlCreateLabel("Employe Username", 8, 80, 100, 21)
            GUICtrlSetTip(-1, "Please Enter Username")

    Global $sameprofileroot = GUICtrlCreateInput("", 144, 176, 169, 21)
        GUICtrlSetTip(-1, "Please type Employe Peers")

            $profilelabel = GUICtrlCreateLabel("Same Profile As :", 8, 176, 100, 21)

    Global $deviceroot = GUICtrlCreateCombo("", 144, 112, 169, 21, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
        GUICtrlSetData(-1, "Laptop|Desktop")

            $devicelabel = GUICtrlCreateLabel("Employe Device :", 8, 112, 100, 21)
            GUICtrlSetTip(-1, "Please choose employe device type")

    Global $startdateroot = GUICtrlCreateDate( _NowDate() , 144, 144, 169, 17, 0)
        GUICtrlSetTip(-1, "Please choose start date")

            $timelabel = GUICtrlCreateLabel("Employe Start Date :", 8, 144, 100, 21)

    Global $Locationroot = GUICtrlCreateCombo("", 144, 208, 169, 21, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
        GUICtrlSetData(-1, "Internal Permanent|Internal Contractor|External Permanent|External Contractor")

            $locationlabel = GUICtrlCreateLabel("Employe Location :", 8, 208, 94, 17)
            GUICtrlSetTip(-1, "Please choose Employe Location")

    Global $officemoveroot = GUICtrlCreateDate( _NowDate() , 144, 240, 169, 21,0)
        GUICtrlSetTip( -1, " Please choose Office set up date" &@crlf& " If not sceduled, put the start date")

            $officemovelabel = GUICtrlCreateLabel("Office Set Up Date :",8, 240, 94, 17)

    Global $trainingdateroot = GUICtrlCreateDate( _NowDate() , 144, 272, 169, 21,0)
        GUICtrlSetTip( -1, " Please select Training date" &@crlf& " If not sceduled, put the start date")

            $trainingdatelabel = GUICtrlCreateLabel("Training Date :",8, 272, 94, 17)



$PreStart = GUICtrlCreateButton("Send ", 136, 314, 137, 25, BitOR($BS_PUSHLIKE,$WS_BORDER))
GUICtrlSetTip(-1, "Send Entered values to the Main New Hire GUI")



GUISetState()
;#EndRegion ### END Koda GUI section ###

While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                GUISetState(@SW_HIDE, $preform)
                ExitLoop

            case $PreStart
                GUISetState(@SW_HIDE, $preform)

                ExitLoop


        EndSwitch
    WEnd

EndFunc     ;==>preform



#Region ### START Koda GUI section ### Form=H:\Autoit\Forms\epack.kxf
Global $prefix = GUICtrlRead($prefixroot)
Global $Name = GUICtrlRead($Nameroot)
Global $username = GUICtrlRead($Usernameroot)
Global $sameprofile = GUICtrlRead($sameprofileroot)
Global $device = GUICtrlRead($deviceroot)
Global $startdate = GUICtrlRead($startdateroot)
Global $location = GUICtrlRead($Locationroot)
Global $officemove = GUICtrlRead($officemoveroot)
Global $trainingdate = GUICtrlRead($trainingdateroot)
Global $timer= TimerInit()

 $Mainform = GUICreate( $prefix&  " Ticket Creator For: " &$Name, 600, 400, 786, 251)
    GUISetIcon("V:\_Department\IT\IT-Support\Lazy IT 2018 R2 version 1.029838.1282805 Revision 99.2\Source\Media\pirate.ico")


$Label1 = GUICtrlCreateLabel("Select the services", 35, 8, 146, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

 $Label2 = GUICtrlCreateLabel("Required for " &$Name, 35, 25, 300, 30)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

$Label3 = GUICtrlCreateLabel("Ticket Assignee", 235, 8, 300, 30)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

 $Button1 = GUICtrlCreateButton("Select All", 500, 80, 89, 25, $WS_GROUP)
    GUICtrlSetTip(-1, "Select all Services")

 $Button2 = GUICtrlCreateButton("Clear All", 500, 112, 89, 25, $WS_GROUP)
    GUICtrlSetTip(-1, "Clear all selected services")

 $Button3 = GUICtrlCreateButton("Start!", 450, 310, 139, 50, $WS_GROUP)
    GUICtrlSetTip(-1, "Start the script and enjoy doing nothing!")

 $Button5 = GUICtrlCreateButton("Please Read", 500, 176, 89, 25, $WS_GROUP)

 $Button404 = GUICtrlCreateButton("Add Computer", 500, 48, 89, 25, $WS_GROUP)


$laptopassigne = GUICtrlCreateCombo("IT", 235, 48, 85, 17, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1,"LAMD4|PISCIONR|COSTEAP")


$iphoneassigne = GUICtrlCreateCombo("IT", 235, 72, 85, 17, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "IT1|IT2|IT3|IT4")


$ipadassigne = GUICtrlCreateCombo("IT", 235, 96, 85, 17, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "IT1|IT2|IT3|IT4")


$ciscoassigne = GUICtrlCreateCombo("IT", 235, 120, 85, 17, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "IT1|IT2|IT3|IT4")


$networkassigne = GUICtrlCreateCombo("IT", 235, 144, 85, 17, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "IT1|IT2|IT3|IT4")


$gridassigne = GUICtrlCreateCombo("IT", 235, 168, 85, 17, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "IT1|IT2|IT3|IT4")


$officeassigne = GUICtrlCreateCombo("IT", 235, 188, 85, 17, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "IT1|IT2|IT3|IT4")


$trainingassigne = GUICtrlCreateCombo("IT", 235, 208, 85, 17, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "IT1|IT2|IT3|IT4")



 $Button4 = GUICtrlCreateButton("Exit", 500, 144, 89, 25, $WS_GROUP)
    
$namevalidation = GUICtrlCreateLabel ("Full Name is: "&$Name, 8, 230, 560, 17)
    GUICtrlSetFont (-1,9, 800); bold

$uservalidation = GUICtrlCreateLabel ("Username is:  " &$UserName, 8, 250, 560, 17)
    GUICtrlSetFont (-1,9, 800); bold

$locationvalidation = GUICtrlCreateLabel ("Location is: " &$location, 8, 270, 560, 17)
    GUICtrlSetFont (-1,9, 800); bold

$profilevalidation = GUICtrlCreateLabel ("Same Profile is:  " &$sameprofile, 8, 290, 430, 17)
    GUICtrlSetFont (-1,9, 800); bold

$datevalidation = GUICtrlCreateLabel ("Start Date is: " &$startdate, 8, 310, 430, 17)
    GUICtrlSetFont (-1,9, 800); bold

$officevalidation = GUICtrlCreateLabel ("Office Setup deadline is: " &$officemove, 8, 330, 430, 17)
    GUICtrlSetFont (-1,9, 800); bold

$button6 = GUICtrlCreateButton ("Re-Enter values", 460, 360, 120, 25)
    GUICtrlSetTip(-1, "Re-enter Startup information in case of a misstype")

$versionlabel = GUICtrlCreateLabel ( "Version " & $sFileVersion , 8, 380, 161, 41)
    GUICtrlSetFont (-1,9, 800); bold





dim $checkbox[8]
 $checkbox[0] = GUICtrlCreateCheckbox($device, 8, 48, 100, 17)
 $checkbox[1] = GUICtrlCreateCheckbox("Iphone", 8, 72, 100, 17)
 $checkbox[2] = GUICtrlCreateCheckbox("Ipad + SIM Card", 8, 96, 100, 17)
 $checkbox[3] = GUICtrlCreateCheckbox("Cisco Extension", 8, 120, 100, 17)
 $checkbox[4] = GUICtrlCreateCheckbox("Network", 8, 144, 100, 17)
 $checkbox[5] = GUICtrlCreateCheckbox("Grid Card", 8, 168, 100, 17)
 $checkbox[6] = GUICtrlCreateCheckbox("Office Set-Up", 8, 188, 100, 17)
 $checkbox[7] = GUICtrlCreateCheckbox("User Training / Onboarding", 8, 208, 150, 17)




GUISetState()

#EndRegion ### END Koda GUI section ###




While 1
$nMsg = GUIGetMsg()



Select

    Case $nMsg = $GUI_EVENT_CLOSE
Exit
    Case $nMsg = $Button1   ;Check All
            For $n = 0 To UBound($checkbox) - 1
            ;For $n = 0 To 7 Step 1
                GUICtrlSetState ( $checkbox[$n] , $GUI_CHECKED )
            Next

    case $nmsg = $Button2   ;Clear All
            For $n = 0 To UBound($checkbox) - 1
            ;For $n = 0 To 7 Step 1
                GUICtrlSetState ( $checkbox[$n] , $GUI_UNCHECKED )
            Next

    case $nmsg = $Button3   ;Start script

    Sleep(400)

$fSelection = False
For $n = 0 To UBound($checkbox) - 1
    If BitAND(GUICtrlRead($checkbox[$n]), $GUI_CHECKED) Then
        $fSelection = True

        ExitLoop
    EndIf
Next

Global $laptopread = GUICtrlRead($laptopassigne)

Global $iphoneread = GUICtrlRead($iphoneassigne)

Global $ipadread = GUICtrlRead($ipadassigne)

Global $ciscoread = GUICtrlRead($ciscoassigne)

Global $networkread = GUICtrlRead($networkassigne)

Global $gridread = GUICtrlRead($gridassigne)

Global $officeread = GUICtrlRead($officeassigne)

Global $trainingread = GUICtrlRead($trainingassigne)


If $fSelection Then
    $answer = msgBox(36, 'Preparing the beast', $device & ' Ticket will be assigned to :' &$laptopread & @CRLF&@CRLF& "iPhone ticket will be assigned to :
    
    " & $iphoneread & @CRLF&@CRLF& "iPad ticket will be assigned to : " & $ipadread& @CRLF&@CRLF& "Cisco ticket will be assigned to : " & $ciscoread& 
    
    @CRLF&@CRLF& "Network ticket will be assigned to : " &  $networkread& @CRLF&@CRLF& "Grid card ticket will be assigned to : " & $gridread& @CRLF&@CRLF& 
    
    "Office Set-Up ticket will be assigned to : " & $officeread& @CRLF&@CRLF& "Training/Onboarding ticket will be assigned to : " & $trainingread)
     
     if $answer = 6 then
            $status0 = GUICtrlRead($checkbox[0])
            $status1 = GUICtrlRead($checkbox[1])
            $status2 = GUICtrlRead($checkbox[2])
            $status3 = GUICtrlRead($checkbox[3])
            $status4 = GUICtrlRead($checkbox[4])
            $status5 = GUICtrlRead($checkbox[5])
            $status6 = GUICtrlRead($checkbox[6])
            $status7 = GUICtrlRead($checkbox[7])


            If $status0 = 1 then call ("laptop")
            If $status1 = 1 then call ("iphone")
            If $status2 = 1 then call ("ipad")
            If $status3 = 1 then call ("cisco")
            If $status4 = 1 then call ("network")
            If $status5 = 1 then call ("grid")
            If $status6 = 1 then call ("office")
            If $status7 = 1 then call ("training")


        endif
        if $answer = 8 Then

        EndIf
Else
    MsgBox(48, 'No Items Selected', 'You have not selected any services, Please select from the list')
EndIf



    case $nmsg = $Button4   ;exit script

            Exit

    Case $nmsg = $button6   ;restart script

        Run ("V:\_Department\IT\IT-Support\Lazy IT 2018 R2 version 1.029838.1282805 Revision 99.2\addon\NewHire.exe")
            GUIDelete($Mainform)

        Exit




    case $nmsg = $Button5   ;Display ReadMe
            MsgBox(64, 'Please Read. . .', '1) You need to have HPSM oppened on your main screen.' & @CRLF & @CRLF & '2) Make sure Chrome is not zoomed in or out, Else SCRIPT WILL FAIL. ' &@CRLF & @CRLF & '3) To be added')

    Case $nmsg = $Button404
        Run ("V:\_Department\IT\IT-Support\SoftwaresAll\PC-NameCreator\Add new Computer.bat")



    EndSelect
WEnd






;Functions for each Services
Func laptop()

WinClose($Mainform, $prefix&  " Ticket Creator For: " &$Name)


    ;Point on incident and click on create incident
MouseClick($MOUSE_CLICK_LEFT, 32, 349)
        Sleep(400)
    MouseClick($MOUSE_CLICK_LEFT, 150,408)
Sleep(2450)


;click on the app/service and press enter
    MouseClick($MOUSE_CLICK_LEFT, 385, 387)
    sleep(1000)
Send("RLX-*ONSITE*")
    sleep(1000)
Send("{ENTER}")
    sleep(2000)

;assign it to the person specified in $assignee
Sleep (2600)
    MouseClick($MOUSE_CLICK_LEFT, 1457, 417)
    sleep(300)
        Send ($laptopread)
    sleep(300)
    Send("{ENTER}")
Sleep (500)

;Click Description, select all, delete template
Sleep (500)
    MouseClick($MOUSE_CLICK_LEFT, 867, 496)
        Send("^a")
            Send("{BS}")
                send($prefix& " :" &$username&@CRLF& "Start Date: " &$startdate&@CRLF& "Laptop / Desktop: " &$device&@CRLF& "Grid Card : Yes" &@CRLF& "Same profile as: " &$sameprofile )




;fill up contact and title
    MouseClick($MOUSE_CLICK_LEFT, 323, 232)
        Send($username)
            Sleep(2000)
                MouseClick($MOUSE_CLICK_LEFT, 375, 233)
                Sleep(1700)
            MouseMove(242, 200)
                sleep(1400)
            MouseClick($MOUSE_CLICK_LEFT, 242, 200)
            Sleep(450)
            MouseClick($MOUSE_CLICK_LEFT, 248, 200)
        sleep(3000)
    send($prefix& " :" &$Name& " , New Computer")





;Choose Enhancement incident type , Request for information category and Proactive source
        sleep(100)
        MouseClick($MOUSE_CLICK_LEFT, 1651, 791)
                Send("{DOWN 10}")

        MouseClick($MOUSE_CLICK_LEFT, 1598, 825)
                Send("{DOWN 1}")

        MouseClick($MOUSE_CLICK_LEFT, 1587, 854)
                Send("{DOWN 10}")




;save&Exit ticket

            MouseMove(199, 171)
        sleep(300)
            MouseClick($MOUSE_CLICK_LEFT, 199, 171)
        Sleep(2000)

sleep(2000)
EndFunc

Func iphone()

WinClose($Mainform, $prefix&  " Ticket Creator For: " &$Name)

    ;Point on incident and click on create incident
MouseClick($MOUSE_CLICK_LEFT, 32, 349)
        Sleep(400)
    MouseClick($MOUSE_CLICK_LEFT, 150,408)
Sleep(2450)


;click on the app/service and press enter
    MouseClick($MOUSE_CLICK_LEFT, 385, 387)
    sleep(1000)
Send("RLX-*ONSITE*")
    sleep(1000)
Send("{ENTER}")
    sleep(2000)

;assign it to the person specified in $assignee
Sleep (2600)
    MouseClick($MOUSE_CLICK_LEFT, 1457, 417)
    sleep(300)
        Send($iphoneread)
    sleep(300)
    Send("{ENTER}")
sleep(500)

;Click Description, select all, delete template
Sleep (500)
    MouseClick($MOUSE_CLICK_LEFT, 867, 496)
        Send("^a")
            Send("{BS}")
                    send($prefix& " : "  &$username&@CRLF& "Start Date: " &$startdate&@CRLF& "Same profile as: " &$sameprofile&@CRLF& "Internal/External: " &$location&@CRLF& "Require Iphone" )




;fill up contact and title
    MouseClick($MOUSE_CLICK_LEFT, 323, 232)
        Send($username)
            Sleep(2000)
                MouseClick($MOUSE_CLICK_LEFT, 375, 233)
                Sleep(1700)
            MouseMove(242, 200)
                sleep(1400)
            MouseClick($MOUSE_CLICK_LEFT, 242, 200)
            Sleep(450)
            MouseClick($MOUSE_CLICK_LEFT, 248, 200)
        sleep(3000)
    send($prefix& " : "  &$Name& " , New iPhone")






;Choose Enhancement incident type , Request for information category and Proactive source

        MouseClick($MOUSE_CLICK_LEFT, 1651, 791)
                Send("{DOWN 10}")

        MouseClick($MOUSE_CLICK_LEFT, 1598, 825)
                Send("{DOWN 1}")

        MouseClick($MOUSE_CLICK_LEFT, 1587, 854)
                Send("{DOWN 10}")




;save&Exit ticket

            MouseMove(199, 171)
        sleep(300)
            MouseClick($MOUSE_CLICK_LEFT, 199, 171)
        Sleep(2000)




sleep(2000)


EndFunc

Func ipad()

WinClose($Mainform, $prefix&  " Ticket Creator For: " &$Name)

    ;Point on incident and click on create incident
MouseClick($MOUSE_CLICK_LEFT, 32, 349)
        Sleep(400)
    MouseClick($MOUSE_CLICK_LEFT, 150,408)
Sleep(2450)


;click on the app/service and press enter
    MouseClick($MOUSE_CLICK_LEFT, 385, 387)
    sleep(1000)
Send("RLX-*ONSITE*")
    sleep(1000)
Send("{ENTER}")
    sleep(2000)

;assign it to the person specified in $assignee
Sleep (2600)
    MouseClick($MOUSE_CLICK_LEFT, 1457, 417)
    sleep(300)
        Send($ipadread)
    sleep(300)
    Send("{ENTER}")
Sleep (500)

;Click Description, select all, delete template
Sleep (500)
    MouseClick($MOUSE_CLICK_LEFT, 867, 496)
        Send("^a")
            Send("{BS}")
    send($prefix& " : "  &$username&@CRLF& "Start Date: " &$startdate&@CRLF& "Same profile as: " &$sameprofile&@CRLF& "Internal/External: " &$location&@CRLF& "Require Ipad" )




;fill up contact and title
    MouseClick($MOUSE_CLICK_LEFT, 323, 232)
        Send($username)
            Sleep(2000)
                MouseClick($MOUSE_CLICK_LEFT, 375, 233)
                Sleep(1700)
            MouseMove(242, 200)
                sleep(1400)
            MouseClick($MOUSE_CLICK_LEFT, 242, 200)
            Sleep(450)
            MouseClick($MOUSE_CLICK_LEFT, 248, 200)
        sleep(3000)
    send($prefix& " : "  &$Name& " , New iPad")





;Choose Enhancement incident type , Request for information category and Proactive source

        MouseClick($MOUSE_CLICK_LEFT, 1651, 791)
                Send("{DOWN 10}")

        MouseClick($MOUSE_CLICK_LEFT, 1598, 825)
                Send("{DOWN 1}")

        MouseClick($MOUSE_CLICK_LEFT, 1587, 854)
                Send("{DOWN 10}")




;save&Exit ticket

            MouseMove(199, 171)
        sleep(300)
            MouseClick($MOUSE_CLICK_LEFT, 199, 171)
        Sleep(3000)


sleep(2000)

EndFunc

Func cisco()

WinClose($Mainform, $prefix&  " Ticket Creator For: " &$Name)

    ;Point on incident and click on create incident
MouseClick($MOUSE_CLICK_LEFT, 32, 349)
        Sleep(400)
    MouseClick($MOUSE_CLICK_LEFT, 150,408)
Sleep(2450)


;click on the app/service and press enter
    MouseClick($MOUSE_CLICK_LEFT, 385, 387)
    sleep(1000)
Send("RLX-*ONSITE*")
    sleep(1000)
Send("{ENTER}")
    sleep(2000)

;assign it to the person specified in $assignee
Sleep (2600)
    MouseClick($MOUSE_CLICK_LEFT, 1457, 417)
    sleep(300)
        Send($ciscoread)
    sleep(300)
    Send("{ENTER}")
Sleep (500)

;Click Description, select all, delete template
Sleep (500)
    MouseClick($MOUSE_CLICK_LEFT, 867, 496)
        Send("^a")
            Send("{BS}")
    send($prefix& " : "  &$username&@CRLF& "Start Date: " &$startdate&@CRLF& "Same profile as: " &$sameprofile&@CRLF& "Require Cisco Extension" )




;fill up contact and title
    MouseClick($MOUSE_CLICK_LEFT, 323, 232)
        Send($username)
            Sleep(2000)
                MouseClick($MOUSE_CLICK_LEFT, 375, 233)
                Sleep(1700)
            MouseMove(242, 200)
                sleep(1400)
            MouseClick($MOUSE_CLICK_LEFT, 242, 200)
            Sleep(450)
            MouseClick($MOUSE_CLICK_LEFT, 248, 200)
        sleep(3000)
    send($prefix& " : "  &$Name& " , Cisco")





;Choose Enhancement incident type , Request for information category and Proactive source

        MouseClick($MOUSE_CLICK_LEFT, 1651, 791)
                Send("{DOWN 10}")

        MouseClick($MOUSE_CLICK_LEFT, 1598, 825)
                Send("{DOWN 1}")

        MouseClick($MOUSE_CLICK_LEFT, 1587, 854)
                Send("{DOWN 10}")




;save&Exit ticket

            MouseMove(199, 171)
        sleep(300)
            MouseClick($MOUSE_CLICK_LEFT, 199, 171)
        Sleep(3000)


sleep(2000)

EndFunc

Func network()

WinClose($Mainform, $prefix&  " Ticket Creator For: " &$Name)

    ;Point on incident and click on create incident
MouseClick($MOUSE_CLICK_LEFT, 32, 349)
        Sleep(400)
    MouseClick($MOUSE_CLICK_LEFT, 150,408)
Sleep(2450)


;click on the app/service and press enter
    MouseClick($MOUSE_CLICK_LEFT, 385, 387)
    sleep(1000)
Send("RLX-*ONSITE*")
    sleep(1000)
Send("{ENTER}")
    sleep(2000)

;assign it to the person specified in $assignee
Sleep (2600)
    MouseClick($MOUSE_CLICK_LEFT, 1457, 417)
    sleep(300)
        Send($networkread)
    sleep(300)
    Send("{ENTER}")
Sleep (500)

;Click Description, select all, delete template
Sleep (500)
    MouseClick($MOUSE_CLICK_LEFT, 867, 496)
        Send("^a")
            Send("{BS}")
    send($prefix& " : "  &$username&@CRLF& "Start Date: " &$startdate&@CRLF& "Same profile as: " &$sameprofile&@CRLF& "Internal/External: " &$location )




;fill up contact and title
    MouseClick($MOUSE_CLICK_LEFT, 323, 232)
        Send($username)
            Sleep(2000)
                MouseClick($MOUSE_CLICK_LEFT, 375, 233)
                Sleep(1700)
            MouseMove(242, 200)
                sleep(1400)
            MouseClick($MOUSE_CLICK_LEFT, 242, 200)
            Sleep(450)
            MouseClick($MOUSE_CLICK_LEFT, 248, 200)
        sleep(3000)
    send($prefix& " : "  &$Name& " , Network")





;Choose Enhancement incident type , Request for information category and Proactive source

        MouseClick($MOUSE_CLICK_LEFT, 1651, 791)
                Send("{DOWN 10}")

        MouseClick($MOUSE_CLICK_LEFT, 1598, 825)
                Send("{DOWN 1}")

        MouseClick($MOUSE_CLICK_LEFT, 1587, 854)
                Send("{DOWN 10}")




;save&Exit ticket

            MouseMove(199, 171)
        sleep(300)
            MouseClick($MOUSE_CLICK_LEFT, 199, 171)
        Sleep(3000)


sleep(2000)

EndFunc

Func grid()

WinClose($Mainform, $prefix&  " Ticket Creator For: " &$Name)

    ;Point on incident and click on create incident
MouseClick($MOUSE_CLICK_LEFT, 32, 349)
        Sleep(400)
    MouseClick($MOUSE_CLICK_LEFT, 150,408)
Sleep(2450)


;click on the app/service and press enter
    MouseClick($MOUSE_CLICK_LEFT, 385, 387)
    sleep(1000)
Send("RLX-*ONSITE*")
    sleep(1000)
Send("{ENTER}")
    sleep(2000)

;assign it to the person specified in $assignee
Sleep (2600)
    MouseClick($MOUSE_CLICK_LEFT, 1457, 417)
    sleep(300)
        Send($gridread)
    sleep(300)
    Send("{ENTER}")
Sleep (500)

;Click Description, select all, delete template
Sleep (500)
    MouseClick($MOUSE_CLICK_LEFT, 867, 496)
        Send("^a")
            Send("{BS}")
    send($prefix& " : "  &$username&@CRLF& "Start Date: " &$startdate&@CRLF& "Same profile as: " &$sameprofile&@CRLF& "Internal/External: " &$location&@CRLF& "Need Grid Card" )




;fill up contact and title
    MouseClick($MOUSE_CLICK_LEFT, 323, 232)
        Send($username)
            Sleep(2000)
                MouseClick($MOUSE_CLICK_LEFT, 375, 233)
                Sleep(1700)
            MouseMove(242, 200)
                sleep(1400)
            MouseClick($MOUSE_CLICK_LEFT, 242, 200)
            Sleep(450)
            MouseClick($MOUSE_CLICK_LEFT, 248, 200)
        sleep(3000)
    send($prefix& " : "  &$Name& " , Grid Card")





;Choose Enhancement incident type , Request for information category and Proactive source

        MouseClick($MOUSE_CLICK_LEFT, 1651, 791)
                Send("{DOWN 10}")

        MouseClick($MOUSE_CLICK_LEFT, 1598, 825)
                Send("{DOWN 1}")

        MouseClick($MOUSE_CLICK_LEFT, 1587, 854)
                Send("{DOWN 10}")




;save&Exit ticket

            MouseMove(199, 171)
        sleep(300)
            MouseClick($MOUSE_CLICK_LEFT, 199, 171)
        Sleep(3000)


sleep(2000)


EndFunc  ;==>Grid

Func office()

WinClose($Mainform, $prefix&  " Ticket Creator For: " &$Name)

    ;Point on incident and click on create incident
MouseClick($MOUSE_CLICK_LEFT, 32, 349)
        Sleep(400)
    MouseClick($MOUSE_CLICK_LEFT, 150,408)
Sleep(2450)


;click on the app/service and press enter
    MouseClick($MOUSE_CLICK_LEFT, 385, 387)
    sleep(1000)
Send("RLX-*ONSITE*")
    sleep(1000)
Send("{ENTER}")
    sleep(2000)

;assign it to the person specified in $assignee
Sleep (2600)
    MouseClick($MOUSE_CLICK_LEFT, 1457, 417)
    sleep(300)
        Send($officeread)
    sleep(300)
    Send("{ENTER}")
Sleep (500)

;Click Description, select all, delete template
Sleep (500)
    MouseClick($MOUSE_CLICK_LEFT, 867, 496)
        Send("^a")
            Send("{BS}")
                send($prefix& " :" &$username&@CRLF& "Start Date: " &$startdate&@CRLF& "Laptop / Desktop: " &$device&@CRLF& " Office Set up Date : " &$officemove )




;fill up contact and title
    MouseClick($MOUSE_CLICK_LEFT, 323, 232)
        Send($username)
            Sleep(2000)
                MouseClick($MOUSE_CLICK_LEFT, 375, 233)
                Sleep(1700)
            MouseMove(242, 200)
                sleep(1400)
            MouseClick($MOUSE_CLICK_LEFT, 242, 200)
            Sleep(450)
            MouseClick($MOUSE_CLICK_LEFT, 248, 200)
        sleep(3000)
    send($prefix& " :" &$Name& " , Office Set Up")





;Choose Enhancement incident type , Request for information category and Proactive source

        MouseClick($MOUSE_CLICK_LEFT, 1651, 791)
                Send("{DOWN 10}")

        MouseClick($MOUSE_CLICK_LEFT, 1598, 825)
                Send("{DOWN 1}")

        MouseClick($MOUSE_CLICK_LEFT, 1587, 854)
                Send("{DOWN 10}")




;save&Exit ticket

            MouseMove(199, 171)
        sleep(300)
            MouseClick($MOUSE_CLICK_LEFT, 199, 171)
        Sleep(3000)


sleep(2000)

EndFunc  ;==> Office

Func training()

WinClose($Mainform, $prefix&  " Ticket Creator For: " &$Name)

    ;Point on incident and click on create incident
MouseClick($MOUSE_CLICK_LEFT, 32, 349)
        Sleep(400)
    MouseClick($MOUSE_CLICK_LEFT, 150,408)
Sleep(2450)


;click on the app/service and press enter
    MouseClick($MOUSE_CLICK_LEFT, 385, 387)
    sleep(1000)
Send("RLX-*ONSITE*")
    sleep(1000)
Send("{ENTER}")
    sleep(2000)

;assign it to the person specified in $assignee
Sleep (2600)
    MouseClick($MOUSE_CLICK_LEFT, 1457, 417)
    sleep(300)
        Send($trainingread)
    sleep(300)
    Send("{ENTER}")
Sleep (500)

;Click Description, select all, delete template
Sleep (500)
    MouseClick($MOUSE_CLICK_LEFT, 867, 496)
        Send("^a")
            Send("{BS}")
                send($prefix& " :" &$username&@CRLF& "Start Date: " &$startdate&@CRLF& "Laptop / Desktop: " &$device&@CRLF& " Training / Onboarding date : " &$trainingdate )




;fill up contact and title
    MouseClick($MOUSE_CLICK_LEFT, 323, 232)
        Send($username)
            Sleep(2000)
                MouseClick($MOUSE_CLICK_LEFT, 375, 233)
                Sleep(1700)
            MouseMove(242, 200)
                sleep(1400)
            MouseClick($MOUSE_CLICK_LEFT, 242, 200)
            Sleep(450)
            MouseClick($MOUSE_CLICK_LEFT, 248, 200)
        sleep(3000)
    send($prefix& " :" &$Name& " , Training / Onboarding")





;Choose Training incident type , Request for information category and Proactive source

        MouseClick($MOUSE_CLICK_LEFT, 1651, 791)
                Send("{DOWN 17}")

        MouseClick($MOUSE_CLICK_LEFT, 1598, 825)
                Send("{DOWN 1}")

        MouseClick($MOUSE_CLICK_LEFT, 1587, 854)
                Send("{DOWN 10}")




;save&Exit ticket

            MouseMove(199, 171)
        sleep(300)
            MouseClick($MOUSE_CLICK_LEFT, 199, 171)
        Sleep(3000)


sleep(2000)

EndFunc ;==> training


Exit

Func TogglePause()
    $g_bPaused = Not $g_bPaused
    While $g_bPaused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
    Exit
EndFunc   ;==>Terminate

so If $checkbox[0] was checked and i pressed $Button3 , the script was only doing the Laptop() function and so on. 

 

Now my hair pulling situation. I need to convert this with the wonderful Metro GUI UDF.

 

Here is what i have so far : 

#NoTrayIcon
Opt("GUIOnEventMode", 1)
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Media\newhire.ico
#AutoIt3Wrapper_Outfile=V:\_Department\IT\IT-Support\Lazy IT 2018 R2 version 1.029838.1282805 Revision 99.2\Source\Pre Prod\NewHire V2.0.exe
#AutoIt3Wrapper_Res_Fileversion=4.0.0.36
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_HiDpi=y
#Au3Stripper_Parameters=/so /rm /pe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Au3Stripper_Ignore_Funcs=_iHoverOn,_iHoverOff,_iFullscreenToggleBtn,_cHvr_CSCP_X64,_cHvr_CSCP_X86,_iControlDelete
#EndRegion
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.2
 Author:         JJ

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

#include <MetroGUI_UDF.au3>
#include <_GUIDisable.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <AutoItConstants.au3>
#include 'ExtInputBox.au3'
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <Date.au3>
#include <Timers.au3>
#include <GuiComboBox.au3>
#include <GDIPlus.au3>
#include <WinAPISys.au3>
#include <SecretStuffCOnstants.au3>
#include <FontConstants.au3>
#include <ColorConstants.au3>
#include <LazyITConstants.au3>

;Global Pause/Terminate function

Global $sFileVersion = FileGetVersion(@AutoItExe)

Global $g_bPaused = False
HotKeySet("{ESC}", "Terminate")
HotKeySet("{PAUSE}", "TogglePause")


;############################################################################Pre Form###############################################################################

preform()

Func preform()

_Metro_EnableHighDPIScaling()

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

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


Global $preform = _Metro_CreateGUI("Pre-Script Form", 400, 390, -1, -1, True)

;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.)
;All control buttons like maximize, minimize, fullscreen etc. (except the menu button) work natively. You can use these variables to handle the clicks manually, if you do so, then make sure set $ControlBtnsAutoMode = False
global  $GUI_CLOSE_BUTTON = $Control_Buttons[0]
Global $GUI_MINIMIZE_BUTTON = $Control_Buttons[3]


Global Const $Font = "Comis Sans Ms"

$Prefixlabel = GUICtrlCreateLabel("Employe State", 8, 16, 100, 21)
    GUICtrlSetBkColor($Prefixlabel, $GUI_BKCOLOR_TRANSPARENT)
        GUICtrlSetColor($Prefixlabel, $Color_White)

     Global $prefixroot = GUICtrlCreateCombo("", 140, 16, 169, 21, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))

        GUICtrlSetData(-1, "New Hire|Mat leave Return|Transfert")
        GUICtrlSetTip(-1, "Choose Employee State")

    Global $Nameroot = GUICtrlCreateInput("", 140, 48, 169, 21)
        GUICtrlSetTip(-1, "Enter Full Name")

            $Namelabel = GUICtrlCreateLabel("Employe Name", 8, 48, 100, 21)
            GUICtrlSetTip(-1, "Please enter FULL NAME")
                GUICtrlSetBkColor($Namelabel, $GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor($Namelabel, $Color_White)


    Global $Usernameroot = GUICtrlCreateInput("", 140, 80, 169, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_UPPERCASE))
        GUICtrlSetTip(-1, "Enter Username")

            $Usernamelabel = GUICtrlCreateLabel("Employe Username", 8, 80, 100, 21)
            GUICtrlSetTip(-1, "Please Enter Username")
                GUICtrlSetBkColor($Usernamelabel, $GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor($Usernamelabel, $Color_White)

    Global $sameprofileroot = GUICtrlCreateInput("", 140, 176, 169, 21)
        GUICtrlSetTip(-1, "Please type Employe Peers")

            $profilelabel = GUICtrlCreateLabel("Same Profile As :", 8, 176, 100, 21)
                GUICtrlSetBkColor($profilelabel, $GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor($profilelabel, $Color_White)

    Global $deviceroot = GUICtrlCreateCombo("", 140, 112, 169, 21, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
        GUICtrlSetData(-1, "Laptop|Desktop")

            $devicelabel = GUICtrlCreateLabel("Employe Device :", 8, 112, 100, 21)
            GUICtrlSetTip(-1, "Please choose employe device type")
                GUICtrlSetBkColor($devicelabel, $GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor($devicelabel, $Color_White)

    Global $startdateroot = GUICtrlCreateDate( _NowDate() , 140, 144, 169, 17, 0)
        GUICtrlSetTip(-1, "Please choose start date")

            $timelabel = GUICtrlCreateLabel("Employe Start Date :", 8, 144, 100, 21)
                GUICtrlSetBkColor($timelabel, $GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor($timelabel, $Color_White)

    Global $Locationroot = GUICtrlCreateCombo("", 140, 208, 169, 21, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
        GUICtrlSetData(-1, "Internal Permanent|Internal Contractor|External Permanent|External Contractor")

            $locationlabel = GUICtrlCreateLabel("Employe Location :", 8, 208, 94, 17)
            GUICtrlSetTip(-1, "Please choose Employe Location")
                GUICtrlSetBkColor($locationlabel, $GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor($locationlabel, $Color_White)

    Global $Postalcoderoot = GUICtrlCreateInput("", 140, 240, 169, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_UPPERCASE))
        GUICtrlSetTip(-1, "Enter User's postal code. " &@CRLF & "Leave Blank if unknown")

            $postalcodelabel = GUICtrlCreateLabel("Postal Code :",8, 240, 94, 17)
                GUICtrlSetBkColor($postalcodelabel, $GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor($postalcodelabel, $Color_White)


    Global $trainingdateroot = GUICtrlCreateDate( _NowDate() , 140, 272, 169, 21,0)
        GUICtrlSetTip( -1, " Please select Training date" &@crlf& " If not sceduled, put the start date")

            $trainingdatelabel = GUICtrlCreateLabel("Training Date :",8, 272, 94, 17)
                GUICtrlSetBkColor($trainingdatelabel, $GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor($trainingdatelabel, $Color_White)


    Global $officemoveroot = GUICtrlCreateDate( _NowDate() , 140, 304, 169, 21,0)
        GUICtrlSetTip( -1, " Please choose Office set up date" &@crlf& " If not sceduled, put the start date")

            $officemovelabel = GUICtrlCreateLabel("Office Set Up Date :",8, 304, 94, 17)
                GUICtrlSetBkColor($officemovelabel, $GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor($officemovelabel, $Color_White)

global  $PreStart = _Metro_CreateButtonEx("Send", 136, 355, 137, 25, $BS_DEFPUSHBUTTON)
GUICtrlSetTip(-1, "Send Entered values to the Main New Hire GUI")



Global $DCToggle = _Metro_CreateToggle("DC", 8, 355, 100, 26)


;Set resizing options for the controls so they don't change in size or position. This can be customized to match your gui perfectly for resizing. See AutoIt Help file.
GUICtrlSetResizing($Prefixlabel, 768 + 8)
GUICtrlSetResizing($prefixroot, 768 + 8)
GUICtrlSetResizing($Nameroot, 768 + 8)
GUICtrlSetResizing($Namelabel, 768 + 8)
GUICtrlSetResizing($Usernameroot, 768 + 8)
GUICtrlSetResizing($Usernamelabel, 768 + 8)
GUICtrlSetResizing($sameprofileroot, 768 + 8)
GUICtrlSetResizing($profilelabel, 768 + 8)
GUICtrlSetResizing($deviceroot, 768 + 8)
GUICtrlSetResizing($devicelabel, 768 + 8)
GUICtrlSetResizing($startdateroot, 768 + 8)
GUICtrlSetResizing($DCToggle, 768 + 8)
GUICtrlSetResizing($timelabel, 768 + 8)
GUICtrlSetResizing($Locationroot, 768 + 8)
GUICtrlSetResizing($locationlabel, 768 + 8)
GUICtrlSetResizing($officemoveroot, 768 + 8)
GUICtrlSetResizing($officemovelabel, 768 + 8)
GUICtrlSetResizing($trainingdateroot, 768 + 8)
GUICtrlSetResizing($trainingdatelabel, 768 + 8)
GUICtrlSetResizing($PreStart, 768 + 8)

GUISetState(@SW_SHOW)
;#EndRegion ### END Koda GUI section ###

GUISetOnEvent($GUI_EVENT_CLOSE, "_GUIEvent_ControlButtons_pre")
GUICtrlSetOnEvent($GUI_MINIMIZE_BUTTON, "_GUIEvent_ControlButtons_pre")
GUICtrlSetOnEvent($PreStart, "_GUIEvent_Buttons_pre")
GUICtrlSetOnEvent($DCToggle, "_GUIEvent_Toggles_pre")



EndFunc ;==> Preform


While 1
    Sleep(5)

WEnd

Func _GUIEvent_ControlButtons_pre()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON
            Exit

        Case $GUI_MINIMIZE_BUTTON
            GUISetState(@SW_MINIMIZE, $preform)


    EndSwitch
EndFunc   ;==>_GUIEvent_ControlButtons

Func _GUIEvent_Buttons_pre()
    Switch @GUI_CtrlId

        Case $PreStart
            GUISetState(@SW_HIDE, $preform)

            Call("Mainform")

    EndSwitch
EndFunc ;==> _GUIEvent_Buttons

Func _GUIEvent_Toggles_pre()
    Switch @GUI_CtrlId
        Case $DCToggle
            If _Metro_ToggleIsChecked($DCToggle) Then
                _Metro_ToggleUnCheck($DCToggle)


            Else
                _Metro_ToggleCheck($DCToggle)

            EndIf


    EndSwitch
EndFunc   ;==>_GUIEvent_Toggles

;####################################################################################################################################################################




;############################################################################Main Form###############################################################################
mainform()
Func mainform()



If _Metro_ToggleIsChecked($DCToggle) Then

        Global $DC = True
Else
        Global $DC = False

EndIf

Global $prefix = GUICtrlRead($prefixroot)

If $DC = True Then
    $Prefix = "DC " & $prefix


EndIf

Global $Name = GUICtrlRead($Nameroot)
Global $username = GUICtrlRead($Usernameroot)
Global $sameprofile = GUICtrlRead($sameprofileroot)
Global $device = GUICtrlRead($deviceroot)
Global $startdate = GUICtrlRead($startdateroot)
Global $location = GUICtrlRead($Locationroot)
Global $officemove = GUICtrlRead($officemoveroot)
Global $trainingdate = GUICtrlRead($trainingdateroot)
Global $timer= TimerInit()
Global $Postalcode = GUICtrlRead($Postalcoderoot)

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



 Global $Mainform = _Metro_CreateGUI( $prefix&  " Ticket Creator For: " &$Name, 700, 500, -1, -1, True)
    GUISetIcon("V:\_Department\IT\IT-Support\Lazy IT 2018 R2 version 1.029838.1282805 Revision 99.2\Source\Media\pirate.ico")

$Control_Buttons = _Metro_AddControlButtons(True, False, True, False, False) ;CloseBtn = True, MaximizeBtn = True, MinimizeBtn = True, FullscreenBtn = True, MenuBtn = Trueglobal   $GUI_CLOSE_BUTTON = $Control_Buttons[0]

Global $GUI_MINIMIZE_BUTTON = $Control_Buttons[3]
Global $GUI_CLOSE_BUTTON = $Control_Buttons[1]


$Label1 = GUICtrlCreateLabel("Select the services", 35, 8, 146, 20)
            GUICtrlSetBkColor($Label1, $GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor($Label1, $Color_White)
                        GUICtrlSetFont($Label1,10,800)


 $Label2 = GUICtrlCreateLabel("Required for " &$Name, 35, 25, 300, 30)
                GUICtrlSetBkColor($Label2, $GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor($Label2, $Color_White)
                        GUICtrlSetFont($Label2,10,800)

$Label3 = GUICtrlCreateLabel("Ticket Assignee", 260, 8, 300, 30)
                GUICtrlSetBkColor($Label3, $GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor($Label3, $Color_White)
                        GUICtrlSetFont($Label3,10,800)

Global $AddComputerButton = _Metro_CreateButtonEx("Add Computer", 600, 43, 89, 35, $WS_GROUP)

Global $SelectAllButton = _Metro_CreateButtonEx("Select All", 600, 88, 89, 30, $WS_GROUP)
    GUICtrlSetTip(-1, "Select all Services")

Global $ClearAllButton = _Metro_CreateButtonEx("Clear All", 600, 128, 89, 30, $WS_GROUP)
    GUICtrlSetTip(-1, "Clear all selected services")

Global $ReadButton = _Metro_CreateButtonEx("Please Read", 600, 168, 89, 30, $WS_GROUP)

 Global $ExitButton = _Metro_CreateButtonEx("Exit", 600, 208, 89, 30, $WS_GROUP)

Global $StartButton = _Metro_CreateButtonEx("Start!", 550, 310, 139, 50, $WS_GROUP)
    GUICtrlSetTip(-1, "Start the script and enjoy doing nothing!")

Global $Restart = _Metro_CreateButtonEx("Re-Enter values", 570, 470, 120, 25)
    GUICtrlSetTip(-1, "Re-enter Startup information in case of a misstype")
        GUICtrlSetFont (-1,12)

Global $laptopassigne = GUICtrlCreateCombo("IT", 280, 48, 85, 17, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1,"IT1|IT2|IT3|IT4")


Global $iphoneassigne = GUICtrlCreateCombo("IT", 280, 72, 85, 17, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "IT1|IT2|IT3|IT4")


Global $ipadassigne = GUICtrlCreateCombo("IT", 280, 96, 85, 17, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "IT1|IT2|IT3|IT4")


Global $ciscoassigne = GUICtrlCreateCombo("IT", 280, 120, 85, 17, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "IT1|IT2|IT3|IT4")


Global $networkassigne = GUICtrlCreateCombo("IT", 280, 144, 85, 17, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "IT1|IT2|IT3|IT4")


Global $gridassigne = GUICtrlCreateCombo("IT", 280, 168, 85, 17, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "IT1|IT2|IT3|IT4")


Global $officeassigne = GUICtrlCreateCombo("IT", 280, 192, 85, 17, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "IT1|IT2|IT3|IT4")


Global $trainingassigne = GUICtrlCreateCombo("IT", 280, 216, 85, 17, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "IT1|IT2|IT3|IT4")


$DCvalidation = GUICtrlCreateLabel (" ==> Diabetes Care Employee <== ", 180, 250, 580, 26)
    GUICtrlSetFont (-1,14, 800)
        GUICtrlSetBkColor($DCvalidation, $GUI_BKCOLOR_TRANSPARENT)
            GUICtrlSetColor($DCvalidation, $Color_White)

If $DC = False Then

    GUICtrlSetData($DCvalidation, " ")

EndIf

$namevalidation = GUICtrlCreateLabel ("Full Name is: "&$Name, 8, 270, 560, 17)
    GUICtrlSetFont (-1,12)
        GUICtrlSetBkColor($namevalidation, $GUI_BKCOLOR_TRANSPARENT)
            GUICtrlSetColor($namevalidation, $Color_White)

$uservalidation = GUICtrlCreateLabel ("Username is:  " &$UserName, 8, 300, 560, 17)
    GUICtrlSetFont (-1,12)
        GUICtrlSetBkColor($uservalidation, $GUI_BKCOLOR_TRANSPARENT)
            GUICtrlSetColor($uservalidation, $Color_White)

$locationvalidation = GUICtrlCreateLabel ("Location is: " &$location, 8, 330, 560, 17)
    GUICtrlSetFont (-1,12)
        GUICtrlSetFont ($location,12)
            GUICtrlSetBkColor($locationvalidation, $GUI_BKCOLOR_TRANSPARENT)
                GUICtrlSetColor($locationvalidation, $Color_White)

$postalcodevalidation = GUICtrlCreateLabel ("Postal Code is :  " &$Postalcode, 8, 360, 430, 17)
    GUICtrlSetFont (-1,12)
        GUICtrlSetBkColor($postalcodevalidation, $GUI_BKCOLOR_TRANSPARENT)
            GUICtrlSetColor($postalcodevalidation, $Color_White)

$profilevalidation = GUICtrlCreateLabel ("Same Profile as:  " &$sameprofile, 8, 390, 430, 17)
    GUICtrlSetFont (-1,12)
        GUICtrlSetBkColor($profilevalidation, $GUI_BKCOLOR_TRANSPARENT)
            GUICtrlSetColor($profilevalidation, $Color_White)


$datevalidation = GUICtrlCreateLabel ("Start Date is: " &$startdate, 8, 420, 430, 17)
    GUICtrlSetFont ($datevalidation,12)
            GUICtrlSetBkColor($datevalidation, $GUI_BKCOLOR_TRANSPARENT)
                GUICtrlSetColor($datevalidation, $Color_White)

$officevalidation = GUICtrlCreateLabel ("Office Setup deadline is: " &$officemove, 8, 450, 430, 17)
    GUICtrlSetFont (-1,12)
        GUICtrlSetBkColor($officevalidation, $GUI_BKCOLOR_TRANSPARENT)
            GUICtrlSetColor($officevalidation, $Color_White)

$versionlabel = GUICtrlCreateLabel ( "Version " & $sFileVersion , 8, 480, 161, 41)
    GUICtrlSetFont (-1,12)
        GUICtrlSetBkColor($versionlabel, $GUI_BKCOLOR_TRANSPARENT)
            GUICtrlSetColor($versionlabel, $Color_White)





global $checkbox[8]

    GUICtrlSetColor($checkbox, $Color_White)

 $checkbox[0] = _Metro_CreateCheckbox($device, 8, 48, 200, 24)
 $checkbox[1] = _Metro_CreateCheckbox("Iphone", 8, 72, 200, 24)
 $checkbox[2] = _Metro_CreateCheckbox("Ipad + SIM Card", 8, 96, 200, 24)
 $checkbox[3] = _Metro_CreateCheckbox("Cisco Extension", 8, 120, 200, 24)
 $checkbox[4] = _Metro_CreateCheckbox("Network", 8, 144, 200, 24)
 $checkbox[5] = _Metro_CreateCheckbox("Grid Card", 8, 168, 200, 24)
 $checkbox[6] = _Metro_CreateCheckbox("Office Set-Up", 8, 192, 200, 24)
 $checkbox[7] = _Metro_CreateCheckbox("User Training", 8, 216, 200, 24)


GUICtrlSetResizing($SelectAllButton, 768 + 8)
GUICtrlSetResizing($ClearAllButton, 768 + 8)
GUICtrlSetResizing($StartButton, 768 + 8)
GUICtrlSetResizing($ReadButton, 768 + 8)
GUICtrlSetResizing($AddComputerButton, 768 + 8)
GUICtrlSetResizing($Restart, 768 + 8)
GUICtrlSetResizing($ExitButton, 768 + 8)


GUISetState()


GUISetOnEvent($GUI_EVENT_CLOSE, "_GUIEvent_ControlButtons_Main")
GUICtrlSetOnEvent($GUI_MINIMIZE_BUTTON, "_GUIEvent_ControlButtons_Main")
GUICtrlSetOnEvent($SelectAllButton, "_GUIEvent_Buttons_Main")
GUICtrlSetOnEvent($ClearAllButton, "_GUIEvent_Buttons_Main")
GUICtrlSetOnEvent($StartButton, "_GUIEvent_Buttons_Main")
GUICtrlSetOnEvent($ReadButton, "_GUIEvent_Buttons_Main")
GUICtrlSetOnEvent($AddComputerButton, "_GUIEvent_Buttons_Main")
GUICtrlSetOnEvent($ExitButton, "_GUIEvent_Buttons_Main")
GUICtrlSetOnEvent($Restart, "_GUIEvent_Buttons_Main")
GUICtrlSetOnEvent($checkbox[0], "_GUIEvent_Checkboxes")
GUICtrlSetOnEvent($checkbox[1], "_GUIEvent_Checkboxes")
GUICtrlSetOnEvent($checkbox[2], "_GUIEvent_Checkboxes")
GUICtrlSetOnEvent($checkbox[3], "_GUIEvent_Checkboxes")
GUICtrlSetOnEvent($checkbox[4], "_GUIEvent_Checkboxes")
GUICtrlSetOnEvent($checkbox[5], "_GUIEvent_Checkboxes")
GUICtrlSetOnEvent($checkbox[6], "_GUIEvent_Checkboxes")
GUICtrlSetOnEvent($checkbox[7], "_GUIEvent_Checkboxes")


EndFunc ;==> Mainform

;#######################################################################################################################

While 1
    sleep(5)
Wend

Func _GUIEvent_ControlButtons_Main()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON
            _Metro_GUIDelete($Mainform)
            Exit


        Case $GUI_MINIMIZE_BUTTON
            GUISetState(@SW_MINIMIZE, $Mainform)


    EndSwitch
EndFunc   ;==>_GUIEvent_ControlButtons

Func _GUIEvent_Buttons_Main()

    Switch @GUI_CtrlId

        Case $AddComputerButton
            Run ("V:\_Department\IT\IT-Support\SoftwaresAll\PC-NameCreator\Add new Computer.bat")

        Case $ExitButton
            _Metro_GUIDelete($Mainform)
            Exit

        Case $ReadButton
            _GUIDisable($Mainform, 0, 30) ;For better visibility of the MsgBox on top of the first GUI._GUIDisable($Form1)
             _Metro_MsgBox(64, 'Please Read. . .', '1) You need to have HPSM oppened on your main screen.' & @CRLF & @CRLF & '2) Make sure Chrome is not zoomed in or out, Else SCRIPT WILL FAIL. ' &@CRLF & @CRLF & '3) To be added')

             _GUIDisable($Mainform, 0, 30) ;For better visibility of the MsgBox on top of the first GUI._GUIDisable($Form1)

        Case $Restart

            _Metro_GUIDelete($Mainform)

            Sleep(500)

            GUISetState (@SW_SHOW, $preform)


        Case $SelectAllButton

            _Metro_CheckboxCheck($checkbox[0])

            _Metro_CheckboxCheck($checkbox[1])

            _Metro_CheckboxCheck($checkbox[2])

            _Metro_CheckboxCheck($checkbox[3])

            _Metro_CheckboxCheck($checkbox[4])

            _Metro_CheckboxCheck($checkbox[5])

            _Metro_CheckboxCheck($checkbox[6])

            _Metro_CheckboxCheck($checkbox[7])

        Case $ClearAllButton

            _Metro_CheckboxUnCheck($checkbox[0])

            _Metro_CheckboxunCheck($checkbox[1])

            _Metro_CheckboxunCheck($checkbox[2])

            _Metro_CheckboxunCheck($checkbox[3])

            _Metro_CheckboxunCheck($checkbox[4])

            _Metro_CheckboxunCheck($checkbox[5])

            _Metro_CheckboxunCheck($checkbox[6])

            _Metro_CheckboxunCheck($checkbox[7])


        Case $StartButton

            Sleep(400)

    _metro_msgBox(36, 'Preparing the beast', $device & ' Ticket will be assigned to :' &$laptopassigne & @CRLF&@CRLF&"iPhone ticket will be assigned to : " & $iphoneassigne & @CRLF&@CRLF&"iPad ticket will be assigned to : " & $ipadassigne& @CRLF&@CRLF&"Cisco ticket will be assigned to : " &$ciscoassigne& @CRLF&@CRLF&"Network ticket will be assigned to : " & $networkassigne& @CRLF&@CRLF&"Grid card ticket will be assigned to : " &$gridassigne& @CRLF&@CRLF&"Office Set-Up ticket will be assigned to : " & $officeassigne& @CRLF&@CRLF&"Training/Onboarding ticket will be assigned to: " & $trainingassigne)


EndSwitch


    EndFunc   ;==>_GUIEvent_Buttons

Func _GUIEvent_Checkboxes()



    Switch @GUI_CtrlId
        Case $checkbox[0]
            If _Metro_CheckboxIsChecked($checkbox[0]) Then
                _Metro_CheckboxUnCheck($checkbox[0])

            Else
                _Metro_CheckboxCheck($checkbox[0])

            EndIf

        Case $checkbox[1]
            If _Metro_CheckboxIsChecked($checkbox[1]) Then
                _Metro_CheckboxUnCheck($checkbox[1])

            Else
                _Metro_CheckboxCheck($checkbox[1])

            EndIf

        Case $checkbox[2]
            If _Metro_CheckboxIsChecked($checkbox[2]) Then
                _Metro_CheckboxUnCheck($checkbox[2])

            Else
                _Metro_CheckboxCheck($checkbox[2])

            EndIf

        Case $checkbox[3]
            If _Metro_CheckboxIsChecked($checkbox[3]) Then
                _Metro_CheckboxUnCheck($checkbox[3])

            Else
                _Metro_CheckboxCheck($checkbox[3])

            EndIf

        Case $checkbox[4]
            If _Metro_CheckboxIsChecked($checkbox[4]) Then
                _Metro_CheckboxUnCheck($checkbox[4])

            Else
                _Metro_CheckboxCheck($checkbox[4])

            EndIf

        Case $checkbox[5]
            If _Metro_CheckboxIsChecked($checkbox[5]) Then
                _Metro_CheckboxUnCheck($checkbox[5])

            Else
                _Metro_CheckboxCheck($checkbox[5])

            EndIf

        Case $checkbox[6]
            If _Metro_CheckboxIsChecked($checkbox[6]) Then
                _Metro_CheckboxUnCheck($checkbox[6])

            Else
                _Metro_CheckboxCheck($checkbox[6])

            EndIf

        Case $checkbox[7]
            If _Metro_CheckboxIsChecked($checkbox[7]) Then
                _Metro_CheckboxUnCheck($checkbox[7])

            Else
                _Metro_CheckboxCheck($checkbox[7])

            EndIf

EndSwitch

EndFunc ;==> _GUIEvent_Checkboxes



;Functions for each Services
Func laptop()

WinClose($Mainform, $prefix&  " Ticket Creator For: " &$Name)


    ;Point on incident and click on create incident
MouseClick($MOUSE_CLICK_LEFT, 32, 349)
        Sleep(400)
    MouseClick($MOUSE_CLICK_LEFT, 150,408)
Sleep(2450)


;click on the app/service and press enter
    MouseClick($MOUSE_CLICK_LEFT, 385, 387)
    sleep(1000)
Send("RLX-*ONSITE*")
    sleep(1000)
Send("{ENTER}")
    sleep(2000)

;assign it to the person specified in $assignee
Sleep (2600)
    MouseClick($MOUSE_CLICK_LEFT, 1457, 417)
    sleep(300)
        Send ($laptopassigne)
    sleep(300)
    Send("{ENTER}")
Sleep (500)

;Click Description, select all, delete template
Sleep (500)
    MouseClick($MOUSE_CLICK_LEFT, 867, 496)
        Send("^a")
            Send("{BS}")
                send($prefix& " :" &$username&@CRLF& "Start Date: " &$startdate&@CRLF& "Laptop / Desktop: " &$device&@CRLF& "Grid Card : Yes" &@CRLF& "Same profile as: " &$sameprofile )




;fill up contact and title
    MouseClick($MOUSE_CLICK_LEFT, 323, 232)
        Send($username)
            Sleep(2000)
                MouseClick($MOUSE_CLICK_LEFT, 375, 233)
                Sleep(1700)
            MouseMove(242, 200)
                sleep(1400)
            MouseClick($MOUSE_CLICK_LEFT, 242, 200)
            Sleep(450)
            MouseClick($MOUSE_CLICK_LEFT, 248, 200)
        sleep(3000)
    send($prefix& " :" &$Name& " , New Computer")





;Choose Enhancement incident type , Request for information category and Proactive source
        sleep(100)
        MouseClick($MOUSE_CLICK_LEFT, 1651, 791)
                Send("{DOWN 10}")

        MouseClick($MOUSE_CLICK_LEFT, 1598, 825)
                Send("{DOWN 1}")

        MouseClick($MOUSE_CLICK_LEFT, 1587, 854)
                Send("{DOWN 10}")




;save&Exit ticket

            MouseMove(199, 171)
        sleep(300)
            MouseClick($MOUSE_CLICK_LEFT, 199, 171)
        Sleep(2000)

sleep(2000)
EndFunc

Func iphone()

WinClose($Mainform, $prefix&  " Ticket Creator For: " &$Name)

    ;Point on incident and click on create incident
MouseClick($MOUSE_CLICK_LEFT, 32, 349)
        Sleep(400)
    MouseClick($MOUSE_CLICK_LEFT, 150,408)
Sleep(2450)

    ;click on the app/service and press enter
    MouseClick($MOUSE_CLICK_LEFT, 366, 397)
    sleep(1000)
Send("RLX-*VOICE*")
    sleep(1000)
Send("{ENTER}")
    sleep(2000)
MouseClick($MOUSE_CLICK_LEFT, 1659, 368)
    Send("{DOWN 2}")
        Send("{ENTER}")
            sleep("500")

;assign it to the person specified in $assignee
Sleep (2600)
    MouseClick($MOUSE_CLICK_LEFT, 1457, 417)
    sleep(300)
        Send($iphoneassigne)
    sleep(300)
    Send("{ENTER}")
sleep(500)

;Click Description, select all, delete template
Sleep (500)
    MouseClick($MOUSE_CLICK_LEFT, 867, 496)
        Send("^a")
            Send("{BS}")
                    send($prefix& " : "  &$username&@CRLF& "Start Date: " &$startdate&@CRLF& "Same profile as: " &$sameprofile&@CRLF& "Internal/External: " &$location&@CRLF& "Postal Code : " &$Postalcode&@CRLF&  "Require Iphone" )




;fill up contact and title
    MouseClick($MOUSE_CLICK_LEFT, 323, 232)
        Send($username)
            Sleep(2000)
                MouseClick($MOUSE_CLICK_LEFT, 375, 233)
                Sleep(1700)
            MouseMove(242, 200)
                sleep(1400)
            MouseClick($MOUSE_CLICK_LEFT, 242, 200)
            Sleep(450)
            MouseClick($MOUSE_CLICK_LEFT, 248, 200)
        sleep(3000)
    send($prefix& " : "  &$Name& " , New iPhone")






;Choose Enhancement incident type , Request for information category and Proactive source

        MouseClick($MOUSE_CLICK_LEFT, 1651, 791)
                Send("{DOWN 10}")

        MouseClick($MOUSE_CLICK_LEFT, 1598, 825)
                Send("{DOWN 1}")

        MouseClick($MOUSE_CLICK_LEFT, 1587, 854)
                Send("{DOWN 10}")




;save&Exit ticket

            MouseMove(199, 171)
        sleep(300)
            MouseClick($MOUSE_CLICK_LEFT, 199, 171)
        Sleep(2000)




sleep(2000)


EndFunc

Func ipad()

WinClose($Mainform, $prefix&  " Ticket Creator For: " &$Name)

    ;Point on incident and click on create incident
MouseClick($MOUSE_CLICK_LEFT, 32, 349)
        Sleep(400)
    MouseClick($MOUSE_CLICK_LEFT, 150,408)
Sleep(2450)


;click on the app/service and press enter
    MouseClick($MOUSE_CLICK_LEFT, 366, 397)
    sleep(1000)
Send("RLX-*VOICE*")
    sleep(1000)
Send("{ENTER}")
    sleep(2000)
MouseClick($MOUSE_CLICK_LEFT, 1659, 368)
    Send("{DOWN 2}")
        Send("{ENTER}")
            sleep("500")

;assign it to the person specified in $assignee
Sleep (2600)
    MouseClick($MOUSE_CLICK_LEFT, 1457, 417)
    sleep(300)
        Send($ipadassigne)
    sleep(300)
    Send("{ENTER}")
Sleep (500)

;Click Description, select all, delete template
Sleep (500)
    MouseClick($MOUSE_CLICK_LEFT, 867, 496)
        Send("^a")
            Send("{BS}")
                send($prefix& " : "  &$username&@CRLF& "Start Date: " &$startdate&@CRLF& "Same profile as: " &$sameprofile&@CRLF& "Internal/External: " &$location&@CRLF& "Postal Code : " &$Postalcode&@CRLF&  "Require Ipad" )




;fill up contact and title
    MouseClick($MOUSE_CLICK_LEFT, 323, 232)
        Send($username)
            Sleep(2000)
                MouseClick($MOUSE_CLICK_LEFT, 375, 233)
                Sleep(1700)
            MouseMove(242, 200)
                sleep(1400)
            MouseClick($MOUSE_CLICK_LEFT, 242, 200)
            Sleep(450)
            MouseClick($MOUSE_CLICK_LEFT, 248, 200)
        sleep(3000)
    send($prefix& " : "  &$Name& " , New iPad")





;Choose Enhancement incident type , Request for information category and Proactive source

        MouseClick($MOUSE_CLICK_LEFT, 1651, 791)
                Send("{DOWN 10}")

        MouseClick($MOUSE_CLICK_LEFT, 1598, 825)
                Send("{DOWN 1}")

        MouseClick($MOUSE_CLICK_LEFT, 1587, 854)
                Send("{DOWN 10}")




;save&Exit ticket

            MouseMove(199, 171)
        sleep(300)
            MouseClick($MOUSE_CLICK_LEFT, 199, 171)
        Sleep(3000)


sleep(2000)

EndFunc

Func cisco()

WinClose($Mainform, $prefix&  " Ticket Creator For: " &$Name)

    ;Point on incident and click on create incident
MouseClick($MOUSE_CLICK_LEFT, 32, 349)
        Sleep(400)
    MouseClick($MOUSE_CLICK_LEFT, 150,408)
Sleep(2450)


;click on the app/service and press enter
    MouseClick($MOUSE_CLICK_LEFT, 385, 387)
    sleep(1000)
Send("RLX-*ONSITE*")
    sleep(1000)
Send("{ENTER}")
    sleep(2000)

;assign it to the person specified in $assignee
Sleep (2600)
    MouseClick($MOUSE_CLICK_LEFT, 1457, 417)
    sleep(300)
        Send($ciscoassigne)
    sleep(300)
    Send("{ENTER}")
Sleep (500)

;Click Description, select all, delete template
Sleep (500)
    MouseClick($MOUSE_CLICK_LEFT, 867, 496)
        Send("^a")
            Send("{BS}")
    send($prefix& " : "  &$username&@CRLF& "Start Date: " &$startdate&@CRLF& "Same profile as: " &$sameprofile&@CRLF& "Require Cisco Extension" )




;fill up contact and title
    MouseClick($MOUSE_CLICK_LEFT, 323, 232)
        Send($username)
            Sleep(2000)
                MouseClick($MOUSE_CLICK_LEFT, 375, 233)
                Sleep(1700)
            MouseMove(242, 200)
                sleep(1400)
            MouseClick($MOUSE_CLICK_LEFT, 242, 200)
            Sleep(450)
            MouseClick($MOUSE_CLICK_LEFT, 248, 200)
        sleep(3000)
    send($prefix& " : "  &$Name& " , Cisco")





;Choose Enhancement incident type , Request for information category and Proactive source

        MouseClick($MOUSE_CLICK_LEFT, 1651, 791)
                Send("{DOWN 10}")

        MouseClick($MOUSE_CLICK_LEFT, 1598, 825)
                Send("{DOWN 1}")

        MouseClick($MOUSE_CLICK_LEFT, 1587, 854)
                Send("{DOWN 10}")




;save&Exit ticket

            MouseMove(199, 171)
        sleep(300)
            MouseClick($MOUSE_CLICK_LEFT, 199, 171)
        Sleep(3000)


sleep(2000)

EndFunc

Func network()

WinClose($Mainform, $prefix&  " Ticket Creator For: " &$Name)

    ;Point on incident and click on create incident
MouseClick($MOUSE_CLICK_LEFT, 32, 349)
        Sleep(400)
    MouseClick($MOUSE_CLICK_LEFT, 150,408)
Sleep(2450)


;click on the app/service and press enter
    MouseClick($MOUSE_CLICK_LEFT, 385, 387)
    sleep(1000)
Send("RLX-*ONSITE*")
    sleep(1000)
Send("{ENTER}")
    sleep(2000)

;assign it to the person specified in $assignee
Sleep (2600)
    MouseClick($MOUSE_CLICK_LEFT, 1457, 417)
    sleep(300)
        Send($networkassigne)
    sleep(300)
    Send("{ENTER}")
Sleep (500)

;Click Description, select all, delete template
Sleep (500)
    MouseClick($MOUSE_CLICK_LEFT, 867, 496)
        Send("^a")
            Send("{BS}")
    send($prefix& " : "  &$username&@CRLF& "Start Date: " &$startdate&@CRLF& "Same profile as: " &$sameprofile&@CRLF& "Internal/External: " &$location )




;fill up contact and title
    MouseClick($MOUSE_CLICK_LEFT, 323, 232)
        Send($username)
            Sleep(2000)
                MouseClick($MOUSE_CLICK_LEFT, 375, 233)
                Sleep(1700)
            MouseMove(242, 200)
                sleep(1400)
            MouseClick($MOUSE_CLICK_LEFT, 242, 200)
            Sleep(450)
            MouseClick($MOUSE_CLICK_LEFT, 248, 200)
        sleep(3000)
    send($prefix& " : "  &$Name& " , Network")





;Choose Enhancement incident type , Request for information category and Proactive source

        MouseClick($MOUSE_CLICK_LEFT, 1651, 791)
                Send("{DOWN 10}")

        MouseClick($MOUSE_CLICK_LEFT, 1598, 825)
                Send("{DOWN 1}")

        MouseClick($MOUSE_CLICK_LEFT, 1587, 854)
                Send("{DOWN 10}")




;save&Exit ticket

            MouseMove(199, 171)
        sleep(300)
            MouseClick($MOUSE_CLICK_LEFT, 199, 171)
        Sleep(3000)


sleep(2000)

EndFunc

Func grid()

WinClose($Mainform, $prefix&  " Ticket Creator For: " &$Name)

    ;Point on incident and click on create incident
MouseClick($MOUSE_CLICK_LEFT, 32, 349)
        Sleep(400)
    MouseClick($MOUSE_CLICK_LEFT, 150,408)
Sleep(2450)


;click on the app/service and press enter
    MouseClick($MOUSE_CLICK_LEFT, 385, 387)
    sleep(1000)
Send("RLX-*ONSITE*")
    sleep(1000)
Send("{ENTER}")
    sleep(2000)

;assign it to the person specified in $assignee
Sleep (2600)
    MouseClick($MOUSE_CLICK_LEFT, 1457, 417)
    sleep(300)
        Send($gridassigne)
    sleep(300)
    Send("{ENTER}")
Sleep (500)

;Click Description, select all, delete template
Sleep (500)
    MouseClick($MOUSE_CLICK_LEFT, 867, 496)
        Send("^a")
            Send("{BS}")
    send($prefix& " : "  &$username&@CRLF& "Start Date: " &$startdate&@CRLF& "Same profile as: " &$sameprofile&@CRLF& "Internal/External: " &$location&@CRLF& "Need Grid Card" )




;fill up contact and title
    MouseClick($MOUSE_CLICK_LEFT, 323, 232)
        Send($username)
            Sleep(2000)
                MouseClick($MOUSE_CLICK_LEFT, 375, 233)
                Sleep(1700)
            MouseMove(242, 200)
                sleep(1400)
            MouseClick($MOUSE_CLICK_LEFT, 242, 200)
            Sleep(450)
            MouseClick($MOUSE_CLICK_LEFT, 248, 200)
        sleep(3000)
    send($prefix& " : "  &$Name& " , Grid Card")





;Choose Enhancement incident type , Request for information category and Proactive source

        MouseClick($MOUSE_CLICK_LEFT, 1651, 791)
                Send("{DOWN 10}")

        MouseClick($MOUSE_CLICK_LEFT, 1598, 825)
                Send("{DOWN 1}")

        MouseClick($MOUSE_CLICK_LEFT, 1587, 854)
                Send("{DOWN 10}")




;save&Exit ticket

            MouseMove(199, 171)
        sleep(300)
            MouseClick($MOUSE_CLICK_LEFT, 199, 171)
        Sleep(3000)


sleep(2000)


EndFunc  ;==>Grid

Func office()

WinClose($Mainform, $prefix&  " Ticket Creator For: " &$Name)

    ;Point on incident and click on create incident
MouseClick($MOUSE_CLICK_LEFT, 32, 349)
        Sleep(400)
    MouseClick($MOUSE_CLICK_LEFT, 150,408)
Sleep(2450)


;click on the app/service and press enter
    MouseClick($MOUSE_CLICK_LEFT, 385, 387)
    sleep(1000)
Send("RLX-*ONSITE*")
    sleep(1000)
Send("{ENTER}")
    sleep(2000)

;assign it to the person specified in $assignee
Sleep (2600)
    MouseClick($MOUSE_CLICK_LEFT, 1457, 417)
    sleep(300)
        Send($officeassigne)
    sleep(300)
    Send("{ENTER}")
Sleep (500)

;Click Description, select all, delete template
Sleep (500)
    MouseClick($MOUSE_CLICK_LEFT, 867, 496)
        Send("^a")
            Send("{BS}")
                send($prefix& " :" &$username&@CRLF& "Start Date: " &$startdate&@CRLF& "Laptop / Desktop: " &$device&@CRLF& " Office Set up Date : " &$officemove )




;fill up contact and title
    MouseClick($MOUSE_CLICK_LEFT, 323, 232)
        Send($username)
            Sleep(2000)
                MouseClick($MOUSE_CLICK_LEFT, 375, 233)
                Sleep(1700)
            MouseMove(242, 200)
                sleep(1400)
            MouseClick($MOUSE_CLICK_LEFT, 242, 200)
            Sleep(450)
            MouseClick($MOUSE_CLICK_LEFT, 248, 200)
        sleep(3000)
    send($prefix& " :" &$Name& " , Office Set Up")





;Choose Enhancement incident type , Request for information category and Proactive source

        MouseClick($MOUSE_CLICK_LEFT, 1651, 791)
                Send("{DOWN 10}")

        MouseClick($MOUSE_CLICK_LEFT, 1598, 825)
                Send("{DOWN 1}")

        MouseClick($MOUSE_CLICK_LEFT, 1587, 854)
                Send("{DOWN 10}")




;save&Exit ticket

            MouseMove(199, 171)
        sleep(300)
            MouseClick($MOUSE_CLICK_LEFT, 199, 171)
        Sleep(3000)


sleep(2000)

EndFunc  ;==> Office

Func training()

WinClose($Mainform, $prefix&  " Ticket Creator For: " &$Name)

    ;Point on incident and click on create incident
MouseClick($MOUSE_CLICK_LEFT, 32, 349)
        Sleep(400)
    MouseClick($MOUSE_CLICK_LEFT, 150,408)
Sleep(2450)


;click on the app/service and press enter
    MouseClick($MOUSE_CLICK_LEFT, 385, 387)
    sleep(1000)
Send("RLX-*ONSITE*")
    sleep(1000)
Send("{ENTER}")
    sleep(2000)

;assign it to the person specified in $assignee
Sleep (2600)
    MouseClick($MOUSE_CLICK_LEFT, 1457, 417)
    sleep(300)
        Send($trainingassigne)
    sleep(300)
    Send("{ENTER}")
Sleep (500)

;Click Description, select all, delete template
Sleep (500)
    MouseClick($MOUSE_CLICK_LEFT, 867, 496)
        Send("^a")
            Send("{BS}")
                send($prefix& " :" &$username&@CRLF& "Start Date: " &$startdate&@CRLF& "Laptop / Desktop: " &$device&@CRLF& " Training / Onboarding date : " &$trainingdate )




;fill up contact and title
    MouseClick($MOUSE_CLICK_LEFT, 323, 232)
        Send($username)
            Sleep(2000)
                MouseClick($MOUSE_CLICK_LEFT, 375, 233)
                Sleep(1700)
            MouseMove(242, 200)
                sleep(1400)
            MouseClick($MOUSE_CLICK_LEFT, 242, 200)
            Sleep(450)
            MouseClick($MOUSE_CLICK_LEFT, 248, 200)
        sleep(3000)
    send($prefix& " :" &$Name& " , Training / Onboarding")





;Choose Training incident type , Request for information category and Proactive source

        MouseClick($MOUSE_CLICK_LEFT, 1651, 791)
                Send("{DOWN 17}")

        MouseClick($MOUSE_CLICK_LEFT, 1598, 825)
                Send("{DOWN 1}")

        MouseClick($MOUSE_CLICK_LEFT, 1587, 854)
                Send("{DOWN 10}")




;save&Exit ticket

            MouseMove(199, 171)
        sleep(300)
            MouseClick($MOUSE_CLICK_LEFT, 199, 171)
        Sleep(3000)


sleep(2000)

EndFunc ;==> training


Exit

Func TogglePause()
    $g_bPaused = Not $g_bPaused
    While $g_bPaused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()

    _Metro_GUIDelete($Mainform)

Exit
    _Metro_GUIDelete($preform)

Exit

EndFunc   ;==>Terminate

The thing is :  i have NO idea how to make it work. 

Any help , as little as it can be would be very appreciated. I have been trying to convert my script for abut 2 weeks now..

 

 

Thank you a lot for helping a desesperate novice programmer :)

 

Link to comment
Share on other sites

  • 1 month later...

Hi

First of all thanks for a great UDF

I am currently trying to create a menu for WinPE 10 x64

And i have encountered issue regarding the buttons dont have there text, first thought it was some wrong with my script so it testet with the example script same issue her exept when the input box open there the text was working fine, as soon as i add'ed Font in the buttons it works

Capture.PNG

Capture1.PNG

Link to comment
Share on other sites

First thank you for this great UDF it looks amazing.

 

My question is I looked for a way to add an Edit Region to a gui and did not see it. I am hoping to use an edit area to show some results. Did I miss it? Is there a way to add it?

 

Thank you in advance.

Link to comment
Share on other sites

  • 1 month later...
On 12/08/2018 at 10:23 PM, lpduy said:

I surgest add base control as label, group, combo, input.

For a sample:

Func _Metro_CreateLabel($Text,$x,$y,$w,$h,$tyle=-1,$xstyle =-1,$Font_Color = $FontThemeColor, $Font = "Segoe UI", $Fontsize = "12")
$hLabel = GUICtrlCreateLabel($Text,$x,$y,$w,$h,$tyle,$xstyle)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($hLabel), "wstr", 0, "wstr", 0)
    GUICtrlSetFont($hLabel, $Fontsize, 500, 0, $Font)
    GUICtrlSetColor($hLabel, $Font_Color)
    Return $hLabel
EndFunc

Func _Metro_CreateGroup($Text,$x,$y,$w,$h,$tyle=-1,$xstyle =-1,$Font_Color = $FontThemeColor, $Font = "Segoe UI", $Fontsize = "12")
$hgroup = GUICtrlCreateGroup($Text,$x,$y,$w,$h,$tyle,$xstyle)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($hgroup), "wstr", 0, "wstr", 0)
    GUICtrlSetFont($hgroup, $Fontsize, 500, 0, $Font)
    GUICtrlSetColor($hgroup, $Font_Color)
    Return $hgroup
EndFunc

Func _Metro_CreateInput($Text,$x,$y,$w,$h,$tyle=-1,$xstyle =-1,$BG_Color = $GUIThemeColor,$Font_Color = $FontThemeColor, $Font = "Arial", $Fontsize = "9")
    $hInput = GUICtrlCreateInput($Text,$x,$y,$w,$h,$tyle,$xstyle)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($hInput), "wstr", 0, "wstr", 0)
    GUICtrlSetFont($hInput, $Fontsize, 400, 0, $Font)
    GUICtrlSetColor($hInput, $Font_Color)
    GUICtrlSetBkColor($hInput,$GUIThemeColor)
    _cHvr_Register($hInput, "_iHoverOff", "_iHoverOn")
    Return $hInput
EndFunc

Func _Metro_CreateCombo($Text,$x,$y,$w,$h,$tyle=-1,$xstyle =-1,$BG_Color = $GUIThemeColor,$Font_Color = $FontThemeColor, $Font = "Arial", $Fontsize = "9")
    $hcombo = GUICtrlCreateCombo($Text,$x,$y,$w,$h,$tyle,$xstyle)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($hcombo), "wstr", 0, "wstr", 0)
    GUICtrlSetFont($hcombo, $Fontsize, 400, 0, $Font)
    GUICtrlSetColor($hcombo, $Font_Color)
    GUICtrlSetBkColor($hcombo,$GUIThemeColor)
    Return $hcombo
EndFunc

 

What's the group, combo and input do?
I thought this UDF already include INPUT function? But yes, I would like to try include your Label function.

Thanks for sharing.

Link to comment
Share on other sites

  • 2 weeks later...
5 hours ago, YawStar said:

Is there any way to add image or icon to Metro Button? I tried _Metro_CreateButton(), _Metro_CreateButtonEx() and _Metro_CreateButtonEx2() functions.

You can test this :

; #FUNCTION# ====================================================================================================================
; Name ..........: _Metro_CreateButtonExImg
; Description ...: Creates Windows 10 style buttons with a frame around. Hovering changes the button color to a lighter color. Support Image
; Syntax ........: _Metro_CreateButtonExImg($Text, $Left, $Top, $Width, $Height[, $BG_Color = $ButtonBKColor[,
;                  $Font_Color = $ButtonTextColor[, $Font = "Arial"[, $Fontsize = 12.5[, $FontStyle = 1[,
;                  $FrameColor = "0x1B1B1B"[, $Icon = ""]]]]]]]])
; Parameters ....: $Text                - Text of the button.
;                  $Left                - Left pos.
;                  $Top                 - Top pos.
;                  $Width               - Width.
;                  $Height              - Height.
;                  $BG_Color            - [optional] Button background color. Default is $ButtonBKColor.
;                  $Font_Color          - [optional] Font colore. Default is $ButtonTextColor.
;                  $Font                - [optional] Font. Default is "Arial".
;                  $Fontsize            - [optional] Fontsize. Default is 12.5.
;                  $FontStyle           - [optional] Fontstyle. Default is 1.
;                  $FrameColor          - [optional] Button frame color. Default is "0xFFFFFF".
;                  $Icon                - [optional] Icon for the button. Default is none.
; Return values .: Handle to the button.
; Example .......: _Metro_CreateButtonEx("Button 1",50,50,120,34)
; ===============================================================================================================================

Func _Metro_CreateButtonExImg($Text, $Left, $Top, $Width, $Height, $BG_Color = $ButtonBKColor, $Font_Color = $ButtonTextColor, $Font = "Arial", $Fontsize = 10, $FontStyle = 1, $FrameColor = "0x1B1B1B", $Icon = "")
    Local $Button_Array[16]

    Local $btnDPI = _HighDPICheck()
    If $HIGHDPI_SUPPORT Then
        $Left = Round($Left * $gDPI)
        $Top = Round($Top * $gDPI)
        $Width = Round($Width * $gDPI)
        $Height = Round($Height * $gDPI)
    Else
        $Fontsize = ($Fontsize / $Font_DPI_Ratio)
    EndIf

    $Button_Array[1] = False ; Set hover OFF
    $Button_Array[3] = "2" ; Type
    $Button_Array[15] = GetCurrentGUI()

    ;Calculate Framesize
    Local $FrameSize = Round(2 * $btnDPI)
    If Not (Mod($FrameSize, 2) = 0) Then $FrameSize = $FrameSize - 1

    ;Set Colors
    $BG_Color = "0xFF" & Hex($BG_Color, 6)
    $Font_Color = "0xFF" & Hex($Font_Color, 6)
    $FrameColor = "0xFF" & Hex($FrameColor, 6)
    Local $Brush_BTN_FontColor = _GDIPlus_BrushCreateSolid($Font_Color)
    Local $Pen_BTN_FrameHoverColor = _GDIPlus_PenCreate($FrameColor, $FrameSize)
    Local $Pen_BTN_FrameHoverColorDis = _GDIPlus_PenCreate(StringReplace(_AlterBrightness($Font_Color, -30), "0x", "0xFF"), $FrameSize)
    Local $Brush_BTN_FontColorDis = _GDIPlus_BrushCreateSolid(StringReplace(_AlterBrightness($Font_Color, +50), "0x", "0xFF"))

    ;Create Button graphics
    Local $Button_Graphic1 = _iGraphicCreate($Width, $Height, $BG_Color, 0, 5) ;Default
    Local $Button_Graphic2 = _iGraphicCreate($Width, $Height, StringReplace(_AlterBrightness($BG_Color, 25), "0x", "0xFF"), 0, 5) ;Hover
    Local $Button_Graphic3 = _iGraphicCreate($Width, $Height, StringReplace(_AlterBrightness($BG_Color, -10), "0x", "0xFF"), 0, 5) ;Disabled

    ;Create font, Set font options
    Local $hFormat = _GDIPlus_StringFormatCreate(), $hFamily = _GDIPlus_FontFamilyCreate($Font), $hFont = _GDIPlus_FontCreate($hFamily, $Fontsize, $FontStyle)
    Local $tLayout = _GDIPlus_RectFCreate(0, 0, $Width, $Height)
    _GDIPlus_StringFormatSetAlign($hFormat, 1)
    _GDIPlus_StringFormatSetLineAlign($hFormat, 1)

    ;Draw button text
    If  $Icon = "" Then
        _GDIPlus_GraphicsDrawStringEx($Button_Graphic1[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor)
        _GDIPlus_GraphicsDrawStringEx($Button_Graphic2[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor)
        _GDIPlus_GraphicsDrawStringEx($Button_Graphic3[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColorDis)
    EndIf

    ;Add frame
    _GDIPlus_GraphicsDrawRect($Button_Graphic1[0], 0, 0, $Width, $Height, $Pen_BTN_FrameHoverColor)
    _GDIPlus_GraphicsDrawRect($Button_Graphic2[0], 0, 0, $Width, $Height, $Pen_BTN_FrameHoverColor)
    _GDIPlus_GraphicsDrawRect($Button_Graphic3[0], 0, 0, $Width, $Height, $Pen_BTN_FrameHoverColorDis)

    ;Add Icon
    If  $Icon <> "" Then
        If $HIGHDPI_SUPPORT Then
            Local $Button_Icon = _GDIPlus_BitmapCreateFromFile($Icon)
            Local $Button_Icon_Dpi = _GDIPlus_ImageScale($Button_Icon, $gdpi, $gdpi)
            Local $Button_Icon_Dis = _GDIPlus_ImageScale($Button_Icon, $gdpi, $gdpi)
        Else
            Local $Button_Icon_Dpi = _GDIPlus_BitmapCreateFromFile($Icon)
            Local $Button_Icon_Dis = _GDIPlus_BitmapCreateFromFile($Icon)
        EndIf
        ; Effect for icon disabled
        Local $hEffect = _GDIPlus_EffectCreateBrightnessContrast(100, 0)
        _GDIPlus_BitmapApplyEffect($Button_Icon_Dis, $hEffect)
        Local $Icon_W = _GDIPlus_ImageGetWidth($Button_Icon_Dpi)
        Local $Icon_H = _GDIPlus_ImageGetHeight($Button_Icon_Dpi)
        _GDIPlus_GraphicsDrawImage($Button_Graphic1[0], $Button_Icon_Dpi, ($Width-$Icon_W)/2, ($Height-$Icon_H)/2)
        _GDIPlus_GraphicsDrawImage($Button_Graphic2[0], $Button_Icon_Dpi, ($Width-$Icon_W)/2, ($Height-$Icon_H)/2)
        _GDIPlus_GraphicsDrawImage($Button_Graphic3[0], $Button_Icon_Dis, ($Width-$Icon_W)/2, ($Height-$Icon_H)/2)
    EndIf

    ;Release created objects
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($Brush_BTN_FontColor)
    _GDIPlus_BrushDispose($Brush_BTN_FontColorDis)
    _GDIPlus_PenDispose($Pen_BTN_FrameHoverColor)
    _GDIPlus_PenDispose($Pen_BTN_FrameHoverColorDis)
    If  $Icon <> "" Then
        If $HIGHDPI_SUPPORT Then _GDIPlus_BitmapDispose($Button_Icon)
        _GDIPlus_BitmapDispose($Button_Icon_Dpi)
        _GDIPlus_BitmapDispose($Button_Icon_Dis)
    EndIf

    ;Set graphic and return Bitmap handle
    $Button_Array[0] = GUICtrlCreatePic("", $Left, $Top, $Width, $Height)
    $Button_Array[5] = _iGraphicCreateBitmapHandle($Button_Array[0], $Button_Graphic1)
    $Button_Array[6] = _iGraphicCreateBitmapHandle($Button_Array[0], $Button_Graphic2, False)
    $Button_Array[7] = _iGraphicCreateBitmapHandle($Button_Array[0], $Button_Graphic3, False)

    ;Set GUI Resizing
    GUICtrlSetResizing($Button_Array[0], 768)

    ;Register Hover funcs
    _cHvr_Register($Button_Array[0], "_iHoverOff", "_iHoverOn", "", "", _iAddHover($Button_Array))
    
    Return $Button_Array[0]
EndFunc   ;==>_Metro_CreateButtonExImg

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...