Jump to content

Re-use of a window with radio buttons


Recommended Posts

I have code that re-uses a dialog where I have 4 radio options. 3 of the 4 options will call a function then close the entire progam, as designed, but when I use the 4th option it will call a windows program and then wait for that program to close. When it closes it shows the same dialog. Problem: the option (radio) selection will no longer call the functions. Code below.

Func CreateLogoutWindow()

;**** Change window processing to On Event Mode!!!!!

Opt("GUIOnEventMode", 1)

global $Radio_1

global $Radio_2

global $Radio_3

global $Radio_4

global $MyLoopCounter

global $Logoutmsg

global $MyExitDialog

if WinExists("Log Out Type Selection") = 1 then

;WinClose("Log Out Type Selection")

WinSetState ( "Log Out Type Selection","", @SW_RESTORE )

GUICtrlDelete($Radio_1)

GUICtrlDelete($Radio_2)

GUICtrlDelete($Radio_3)

GUICtrlDelete($Radio_4)

;$Radio_1 = GuiCtrlCreateRadio("Log Out Completely", 30, 20, 190, 15)

;GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')

;GUICtrlSetOnEvent(-1, "Option1checked")

;$Radio_2 = GuiCtrlCreateRadio("Log Out for Paid Break", 30, 40, 190, 15)

;GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')

;GUICtrlSetOnEvent(-1, "Option2checked")

;$Radio_3 = GuiCtrlCreateRadio("Log Out for UN-Paid Break",30, 60, 190, 15)

;GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')

;GUICtrlSetOnEvent(-1, "Option3checked")

;$Radio_4 = GuiCtrlCreateRadio("Go Back Into Interviwer",30, 80, 190, 15)

;GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')

;GUICtrlSetOnEvent(-1, "Option4checked")

Else

$MyExitDialog = GuiCreate("Log Out Type Selection", 260, 120,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

endif

$Radio_1 = GuiCtrlCreateRadio("Log Out Completely", 30, 20, 190, 15)

GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')

GUICtrlSetOnEvent($Radio_1, "Option1checked")

$Radio_2 = GuiCtrlCreateRadio("Log Out for Paid Break", 30, 40, 190, 15)

GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')

GUICtrlSetOnEvent($Radio_2, "Option2checked")

$Radio_3 = GuiCtrlCreateRadio("Log Out for UN-Paid Break",30, 60, 190, 15)

GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')

GUICtrlSetOnEvent($Radio_3, "Option3checked")

$Radio_4 = GuiCtrlCreateRadio("Go Back Into Interviwer",30, 80, 190, 15)

GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')

GUICtrlSetOnEvent($Radio_4, "Option4checked")

GuiSetState(@SW_SHOW,$MyExitDialog)

$MyLoopCounter = 60

While 1

if $MyLoopCounter <= 0 Then

Option1checked()

EndIf

sleep(1000)

$MyLoopCounter = $MyLoopCounter - 1

WEnd

EndFunc

Func Option1checked()

WinActivate("TimeClock Plus")

Send("{TAB}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send(GuiCtrlRead($oInput_1))

Sleep(2000)

Send("{ENTER}")

Sleep(5000)

Send("{ENTER}")

Sleep(5000)

$Logoutmsg = "You have Logged out of the System"

GUICtrlSetState($Radio_1,$GUI_UNCHECKED)

MyExit()

EndFunc

Func Option2checked()

WinActivate("TimeClock Plus")

Send("{TAB}")

Sleep(2000)

Send("{TAB}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("P")

Sleep(2000)

Send(GuiCtrlRead($oInput_1))

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

$Logoutmsg = "You have Logged out on PAID Break"

GUICtrlSetState($Radio_2,$GUI_UNCHECKED)

MyExit()

EndFunc

Func Option3checked()

WinActivate("TimeClock Plus")

Send("{TAB}")

Sleep(2000)

Send("{TAB}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("N")

Sleep(2000)

Send(GuiCtrlRead($oInput_1))

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

$Logoutmsg = "You have Logged out on NON-PAID Break"

GUICtrlSetState($Radio_3,$GUI_UNCHECKED)

MyExit()

EndFunc

Func Option4checked()

GUICtrlSetState($Radio_4,$GUI_UNCHECKED)

ShellExecute ( "F:\CALL CENTER - OPERATIONS\SRG Folder\Interviewer.lnk","", "" )

WinSetState ( "Log Out Type Selection","", @SW_MINIMIZE )

WinClose("Log Out Type Selection")

sleep(1500)

CheckWincati()

EndFunc

Func MyExit()

if ProcessExists("wintck32.exe") Then

ProcessClose("wintck32.exe")

EndIf

;MsgBox(4096,"Time Clock Automation","You are now logged out!")

MsgBox(4096,"Time Clock Automation",$Logoutmsg)

Exit

EndFunc

DUALLOGIN.au3

Link to comment
Share on other sites

  • Moderators

taddyman,

Welcome to the AutoIt forum. :P

OK, enough Mr Nice Guy - that code is, to speak frankly, a mess. :mellow: I have real difficulty in following the logic flow as it runs. :party:

I have to add a whole load of variables as Global before the script will even run. As I do not have any of the images you use, I have to adjust the GUI styles to even see the thing. Some of the variables you use are set to zero (and hence fire on each pass of the GUIGetMsg loop) because the image controls are not created.

So:

Point 1: If you want help, please post code that runs so that we can debug the problem and not the code!

Point 2: When you post code please use Code tags so that we can read it more easily. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Or press the blue button just under the BOLD toolbar button.

OK, Mr Nice Guy again (ish!). :party:

Why on earth are you switching to OnEvent mode when you enter the CreateLogoutWindow function? :party: You only change back in function CheckWincati which does not seem to happen very quickly. Changing GUI modes mid-script is fraught with danger and not something that should be done without an exceptional reason.

So I would suggest that you rewrite your CreateLogoutWindow function to use GetMessage mode - perhaps something along these lines:

GUIStartgroup() ; So that only one radio can be checked
$Radio_1 = GUICtrlCreateRadio("Log Out Completely", 30, 20, 190, 15)
GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')
$Radio_2 = GUICtrlCreateRadio("Log Out for Paid Break", 30, 40, 190, 15)
GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')
$Radio_3 = GUICtrlCreateRadio("Log Out for UN-Paid Break", 30, 60, 190, 15)
GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')
$Radio_4 = GUICtrlCreateRadio("Go Back Into Interviwer", 30, 80, 190, 15)
GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')
    
GUISetState(@SW_SHOW, $MyExitDialog)

While 1
    For $i = $radio_1 To $Radio_4
        If GUICtrlRead($i) = 1 Then ExitLoop 2
    Next
WEnd
    
; We are here because a radio is checked - which one
$iChecked = $radio1 - $i + 1
; $iChecked will read 1 To 4 - use this to run the appropriate function on return

Try and sort out the script and repost it if you still have problems. :party:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

taddyman,

See you tomorrow! :mellow:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

taddyman,

Good morning, I hope you slept as well as I did. :ILA:

Here is a version of your script which works for me. I have added lots of comments - look for the <<<<<<<<<<<<<<<<<<<<< lines.

3 major changes to explain:

- 1. I am now deleting the Log Out Type Selection dialog each time. It is only a small dialog and it is not used that often so there is little point in keeping it for reuse - the time saving is minimal.

- 2. I have converted the script to run in GetMessage mode all the time. As I mentioned yesterday, switching between modes in a script is a recipe for disaster and should only ever be attempted in the most exceptional circumstances - and even then you should have alarm bells going off and be asking yourself why the situation is that exceptional and how you might recast the code. :party:

- 3. You were running into major recursion problems with the script. :party: If you elected to return to the Interviewer (Option 4) you were re-entering function CheckWincati before exiting the function - which then recalled function CreateLogoutWindow - and so on to infinity. Very bad idea. :mellow: I have changed function CheckWincati to become an infinite loop - we exit the whole script with Options 1-3 so we never need to leave the this loop until we exit - which enables Option 4 to exit the CreateLogoutWindow function before re- entering the loop. Hence no recursion. :party:

Here is the code as I have modified it:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ComboConstants.au3>

Global $Radio_1  ; Global declarations moved from with function <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Global $Radio_2
Global $Radio_3
Global $Radio_4
Global $MyLoopCounter
Global $Logoutmsg
Global $MyExitDialog

;Application writtien by Bruce Evans and Tim Addy of Synergetics DCS for Southern Research
;to manipulate the TimeClock and Wincati Interviewer applications in the attempt
;to sync the employees time in and time out entries. It also forces them not to
;forget to log out or goto break

__steam_window('SOUTHERN RESEARCH GROUP', 600, 300) ; WIDTH NOT SMALLER THEN 400 | HEIGHT NOT SMALLER THEN 200 === TRUST ME

Func __steam_window($sWINDOW_TITLE, $iWINDOW_WIDTH, $iWINDOW_HEIGHT)
    Local $oWINDOW = GUICreate($sWINDOW_TITLE, $iWINDOW_WIDTH, $iWINDOW_HEIGHT, -1, -1, BitOR($WS_POPUP, $WS_SYSMENU, $WS_MINIMIZEBOX), $WS_EX_LAYERED) ; BitOR($WS_EX_TOOLWINDOW, $WS_EX_LAYERED))
    GUISetFont(12, 400, 0, 'Tahoma')
    GUISetBkColor(0x494E49)
    GUICtrlCreatePic('hdr.bmp', 0, 0, $iWINDOW_WIDTH - 16, 20, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('hdr.bmp', $iWINDOW_WIDTH - 16, 0, 11, 5, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('hdr.bmp', $iWINDOW_WIDTH - 16, 16, 11, 4, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('hdr.bmp', $iWINDOW_WIDTH - 5, 0, 5, 20, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreateGraphic(0, 20, 1, $iWINDOW_HEIGHT)
    GUICtrlSetColor(-1, 0x686A65)
    GUICtrlCreateGraphic($iWINDOW_WIDTH - 1, 20, 1, $iWINDOW_HEIGHT)
    GUICtrlSetColor(-1, 0x686A65)
    GUICtrlCreateGraphic(0, $iWINDOW_HEIGHT - 1, $iWINDOW_WIDTH, 1)
    GUICtrlSetColor(-1, 0x686A65)
    Local $oCLOSE = GUICtrlCreatePic('cls.bmp', $iWINDOW_WIDTH - 16, 5, 11, 11, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    Local $oLABELHEADER = GUICtrlCreateLabel($sWINDOW_TITLE, 6, 0, $iWINDOW_WIDTH - 22, 20, $SS_CENTERIMAGE)
    GUICtrlSetColor(-1, 0xD8DED3)
    GUICtrlSetBkColor(-1, 0x5A6A50)

    #cs ==============================
        EXAMPLE SECTION ==================
    #ce ==============================

    ;Login Button
    Local $oBUTTON_1 = GUICtrlCreateButton('LOG IN', 10, 30, 140, 20)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    GUICtrlSetState($oBUTTON_1, $GUI_DEFBUTTON)
    ;Cancel Button
    Local $oBUTTON_2 = GUICtrlCreateButton('CANCEL', 10, 60, 140, 20)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')

    GUICtrlCreateGraphic(1, 20, 160, $iWINDOW_HEIGHT - 21)
    GUICtrlSetColor(-1, 0x464646)
    GUICtrlSetBkColor(-1, 0x464646)

    GUICtrlCreateGraphic(158, 20, 1, $iWINDOW_HEIGHT - 21)
    GUICtrlSetColor(-1, 0x3D423D)

    GUICtrlCreateGraphic(159, 20, 1, $iWINDOW_HEIGHT - 21)
    GUICtrlSetColor(-1, 0x424742)

    GUICtrlCreateGraphic(160, 20, 1, $iWINDOW_HEIGHT - 21)
    GUICtrlSetColor(-1, 0x454A45)

    ;Code to create label above entry text boxes
    $oLABELTOP = GUICtrlCreateLabel('WINCATI AND TIMECLOCK DUAL LOGIN', 180, 31, $iWINDOW_WIDTH - 200, 20, $SS_CENTERIMAGE)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    GUICtrlSetColor(-1, 0xC4B550)

    GUICtrlCreateGraphic(170, 51, $iWINDOW_WIDTH - 180, 1)
    GUICtrlSetColor(-1, 0x636763)

    ;Code for Enter ID Number control Label
    GUICtrlCreateLabel('Enter ID number:', 250, 70, 150, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    GUICtrlSetColor(-1, 0xE6ECE0)

    ;Code for Enter ID Number control Input Box
    Global $oInput_1 = GUICtrlCreateInput('', 420, 70, 90, 20, 0x2000)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    Local $oLimit_1 = GUICtrlSetLimit(-1, 7)
    GUICtrlSetState($oInput_1, $GUI_FOCUS)

    ;Code for Select Job Code control Label
    GUICtrlCreateLabel('Select Job Code:', 250, 100, 150, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    GUICtrlSetColor(-1, 0xE6ECE0)
    ;Code for Select Job Code control Input Box
    Global $oInput_2 = GUICtrlCreateInput('', 420, 100, 50, 20, 0x2000)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    Local $oLimit_2 = GUICtrlSetLimit(-1, 3)

    ;Code for Costing Code control Label
    GUICtrlCreateLabel('Costing Code:', 250, 130, 150, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
    GUICtrlSetColor(-1, 0xE6ECE0)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    ;Code for Costing Code control Input Box
    Local $oInput_3 = GUICtrlCreateInput('', 420, 130, 50, 20, 0x2000)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    Local $oLimit_3 = GUICtrlSetLimit(-1, 2)

    ;Code for Interviewer ID control Label
    GUICtrlCreateLabel('Interviewer ID:', 250, 160, 150, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    GUICtrlSetColor(-1, 0xE6ECE0)
    ;Code for Interviewer ID control Input Box
    Local $oInput_4 = GUICtrlCreateInput('', 420, 160, 50, 20, 0x2000)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    Local $oLimit_4 = GUICtrlSetLimit(-1, 3)

    ;Code for Station Number control Label
    GUICtrlCreateLabel('Station Number:', 250, 190, 150, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    GUICtrlSetColor(-1, 0xE6ECE0)
    ;Code for Station Number control Input Box
    Local $oInput_5 = GUICtrlCreateInput('', 420, 190, 50, 20, 0x2000)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    Local $oLimit_5 = GUICtrlSetLimit(-1, 3)

    ;Code for Study List control Label
    GUICtrlCreateLabel('Study List:', 250, 220, 150, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    GUICtrlSetColor(-1, 0xE6ECE0)
    ;Code for Study List control Input Box
    Local $oInput_6 = GUICtrlCreateInput('', 420, 220, 50, 20, 0x2000)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    Local $oLimit_6 = GUICtrlSetLimit(-1, 3)

    ; THIS CONTROL NEEDS TO BE LAST DUE TO OVERLAY ISSUES
    GUICtrlCreateGraphic(170, 30, $iWINDOW_WIDTH - 180, $iWINDOW_HEIGHT - 40)
    GUICtrlSetColor(-1, 0x686A65)

    #cs ==============================
        EXAMPLE SECTION ==================
    #ce ==============================

    GUICtrlCreatePic('cnr.bmp', 0, 0, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('cnr.bmp', $iWINDOW_WIDTH - 1, 0, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('cnr.bmp', 0, $iWINDOW_HEIGHT - 1, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('cnr.bmp', $iWINDOW_WIDTH - 1, $iWINDOW_HEIGHT - 1, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)

    ;This is the start of the app that open the main window
    GUISetState(@SW_SHOW)

    While 1
        Local $eMSG = GUIGetMsg()
        Switch $eMSG
            Case $GUI_EVENT_CLOSE, $oCLOSE, $oBUTTON_2 ; These all run identical code - why write it 3 times? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                ;Local $iWINDOW_TRANS
                ;For $iWINDOW_TRANS = 255 To 0 Step -10
                ;If $iWINDOW_TRANS > 0 Then WinSetTrans($oWINDOW,'',$iWINDOW_TRANS)
                ;Sleep(10)
                ;Next
                Exit

                ;This is the login code. It executes the Time Clock via the ICON on the desktop it
                ;must be there and named exactly as the entry under the SHELLEXECUTE() statment
            Case $oBUTTON_1

                ;Need to add edit checks here, make sure there is data in the text boxes
#cs  ; I am not checking - you will need to uncomment this block <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                If GUICtrlRead($oInput_1) = "" Then
                    MsgBox(4096, "Enter ID Number Error", "There must be a ID Number, the program will exit now!")
                    Exit
                EndIf
                If GUICtrlRead($oInput_2) = "" Then
                    MsgBox(4096, "Select Job Code Error", "There must be a Job Code, the program will exit now!")
                    Exit
                EndIf
                If GUICtrlRead($oInput_3) = "" Then
                    MsgBox(4096, "Costing Code Error", "There must be a Costing Code, the program will exit now!")
                    Exit
                EndIf
                If GUICtrlRead($oInput_4) = "" Then
                    MsgBox(4096, "Interviewer ID Error", "There must be a Interviewer ID, the program will exit now!")
                    Exit
                EndIf
                If GUICtrlRead($oInput_5) = "" Then
                    MsgBox(4096, "Station Number Error", "There must be a Station Number, the program will exit now!")
                    Exit
                EndIf
                If GUICtrlRead($oInput_6) = "" Then
                    MsgBox(4096, "Study List Error", "There must be a Study List, the program will exit now!")
                    Exit
                EndIf
#ce
                GUISetState(@SW_HIDE)

                ;**** Start of warning box to user about not touching mouse or keyboard during automation process
                ;************************************************************************************************************************
                $WarnVar = GUICreate("DUAL LOGIN *** Usage WARNING  ***", 440, 160, -1, -1, $DS_MODALFRAME)
                GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')

                GUICtrlCreateLabel('DO NOT TOUCH KEYBOARD OR MOUSE', 30, 10, 338, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
                GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
                GUICtrlSetColor(-1, 0xff0000)

                GUICtrlCreateLabel('UNTIL YOU SEE THE WINCATI', 30, 35, 300, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
                GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
                GUICtrlSetColor(-1, 0xff0000)

                GUICtrlCreateLabel('INTERVIEWER SCREEN', 30, 60, 275, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
                GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
                GUICtrlSetColor(-1, 0xff0000)

                Local $oOK_1 = GUICtrlCreateButton('OK', 170, 85, 80, 40)
                GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
                GUICtrlSetState($oOK_1, $GUI_DEFBUTTON)

                GUISetState()
                $MyOK = 0
                While $MyOK = 0
                    $msg = GUIGetMsg()
                    Select
                        Case $msg = $oOK_1
                            GUISetState(@SW_HIDE)
                            ExitLoop

                    EndSelect

                WEnd

                ConsoleWrite("Login Process" & @CRLF)  ; you will need to comment this line <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#cs ;  you will need to uncomment this block <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                ;************************************************************************************************************************
                ;**** End of warning box to user about not touching mouse or keyboard during automation process

                ;**** Start of dual login process
                ;************************************************************************************************************************
                ;*** Launch the time clock software, NOTE this link must be a the location shouwn in the shellexecute
                ShellExecute("F:\CALL CENTER - OPERATIONS\SRG  Folder\On-Screen TimeClock.lnk", "", "")
                ;*** Now Wait 5 seconds for the Time Clock to load, my vary on different machines, may have to increase for slowest system
                Sleep(5000)
                ;*** This ENTER is to launch the "Clock IN" process
                Send("{ENTER}")
                ;*** Now wait 1 second for the input box to open
                Sleep(1000)
                ;*** Now input the varible from input 1
                Send(GUICtrlRead($oInput_1))
                ;*** ENTER again to accespt the input
                Send("{ENTER}")

                Sleep(1000)
                Send("{ENTER}")
                Sleep(1000)
                Send(GUICtrlRead($oInput_2))
                Sleep(1000)
                Send("{ENTER}")
                Sleep(1000)
                Send(GUICtrlRead($oInput_3))
                Sleep(4000)

                ;This is the login to the Interviewer code. It executes the WinCati via the ICON on the desktop it
                ;must be there and named exactly as the entry under the SHELLEXECUTE() statment
                ShellExecute("F:\CALL CENTER - OPERATIONS\SRG  Folder\Interviewer.lnk", "", "")
                ;**** Now Wait 5 seconds for the Interviewer to load, my vary on different machines, may have to increase for slowest system
                Sleep(5000)

                Send(GUICtrlRead($oInput_4))
                Sleep(1000)
                Send("{TAB}")
                Send(GUICtrlRead($oInput_5))
                Sleep(1000)
                Send("{TAB}")

                Sleep(1000)
                Send(GUICtrlRead($oInput_6))
                Sleep(1000)
                Send("{TAB}")
                Send("{ENTER}")
                Sleep(2000)
                WinActivate("Costing Code Selection")
                Send("{ENTER}")

                ;***************************************************************************************************
                ;**** We want to minimize both the duallogon and time clock windows so the Interviewer is on top ***
                ;***************************************************************************************************

                WinSetState("TimeClock Plus", "", @SW_MINIMIZE)
                WinSetState("SOUTHERN RESEARCH GROUP", "", @SW_MINIMIZE)

                ;**** Now call the Check WinCati function to loop until the WinCati Interviewer window close.
                ;*********************************************************************************************
                #ce
                CheckWincati()

                ;EndFunc

        EndSwitch ;??????????
    WEnd ;????????????????????
EndFunc   ;==>__steam_window

;**** This is the loop that watches for the interviewer windows to close
;*********************************************************************************
Func CheckWincati()

    While 1 ; Make this whole section a loop - see post for details why <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

        While WinExists("WinCati 4.1 Interviewer") = 1

            ;**** Checking every 2 seconds to see if it has closed
            ;*****************************************************
            Sleep("2000")
            ContinueLoop

        WEnd

        ;Set global vars for next bit of code before moving on.
        ;Opt("GUIOnEventMode", 0) ; We not longer change mode <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        ;**** If the WinCati Interviewer closes then run the "Log out of interviewer" function
        ;***************************************************************************************
        ;Logoutofintview()
        CreateLogoutWindow()

    WEnd

EndFunc   ;==>CheckWincati
Func CreateLogoutWindow()

    ;**** Change window processing to On Event Mode!!!!!
    ;Opt("GUIOnEventMode", 1)  ; We not longer change mode <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    ; Global declarations moved to beginning of script <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    $MyExitDialog = GUICreate("Log Out Type Selection", 260, 120, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))


    $Radio_1 = GUICtrlCreateRadio("Log Out Completely", 30, 20, 190, 15)
    GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')
    ;GUICtrlSetOnEvent($Radio_1, "Option1checked") ; No lomger needed <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    $Radio_2 = GUICtrlCreateRadio("Log Out for Paid Break", 30, 40, 190, 15)
    GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')
    ;GUICtrlSetOnEvent($Radio_2, "Option2checked") ; No lomger needed <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    $Radio_3 = GUICtrlCreateRadio("Log Out for UN-Paid Break", 30, 60, 190, 15)
    GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')
    ;GUICtrlSetOnEvent($Radio_3, "Option3checked") ; No lomger needed <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    $Radio_4 = GUICtrlCreateRadio("Go Back Into Interviwer", 30, 80, 190, 15)
    GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')
    ;GUICtrlSetOnEvent($Radio_4, "Option4checked") ; No lomger needed <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    GUISetState(@SW_SHOW, $MyExitDialog)

    $iBegin = TimerInit() ; Start timer <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    While 1
        ; Check timer
        If TimerDiff($iBegin) > 60000 Then
            ; Set exit code and exit While...WEnd loop <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            $iChecked = 1
            ExitLoop
        EndIf

        ; Check if a radio clicked <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        For $i = $Radio_1 To $Radio_4
            If GUICtrlRead($i) = 1 Then
                ; Set exit code and exit both For...Next and While...WEnd loops <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                $iChecked = $i - $radio_1 + 1
                ExitLoop 2 ; We need to 2 here because there are 2 loops to exit <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            EndIf
        Next
        Sleep(10) ; must have a small sleep to avoid maxing out the CPU <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    WEnd

    ; Depending on exit code, run the appropriate function <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    Switch $iChecked
        Case 1
            Option1checked()
        Case 2
            Option2checked()
        Case 3
            Option3checked()
        Case 4
            Option4checked()
    EndSwitch

EndFunc   ;==>CreateLogoutWindow

Func Option1checked()
    ConsoleWrite("Option 1" & @CRLF)
    #cs
    WinActivate("TimeClock Plus")
    Send("{TAB}")
    Sleep(2000)
    Send("{ENTER}")
    Sleep(2000)
    Send(GUICtrlRead($oInput_1))
    Sleep(2000)
    Send("{ENTER}")
    Sleep(5000)
    Send("{ENTER}")
    Sleep(5000)
    $Logoutmsg = "You have Logged out of the System"
    GUICtrlSetState($Radio_1, $GUI_UNCHECKED) ; Why bother - you are exiting  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    #ce
    MyExit()
EndFunc   ;==>Option1checked

Func Option2checked()
    ConsoleWrite("Option2 " & @CRLF)
    #cs
    WinActivate("TimeClock Plus")
    Send("{TAB}")
    Sleep(2000)
    Send("{TAB}")
    Sleep(2000)
    Send("{ENTER}")
    Sleep(2000)
    Send("P")
    Sleep(2000)
    Send(GUICtrlRead($oInput_1))
    Sleep(2000)
    Send("{ENTER}")
    Sleep(2000)
    Send("{ENTER}")
    Sleep(2000)
    $Logoutmsg = "You have Logged out on PAID Break"
    GUICtrlSetState($Radio_2, $GUI_UNCHECKED) ; Why bother - you are exiting  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    #ce
    MyExit()
EndFunc   ;==>Option2checked

Func Option3checked()
    ConsoleWrite("Option 3" & @CRLF)
    #cs
    WinActivate("TimeClock Plus")
    Send("{TAB}")
    Sleep(2000)
    Send("{TAB}")
    Sleep(2000)
    Send("{ENTER}")
    Sleep(2000)
    Send("N")
    Sleep(2000)
    Send(GUICtrlRead($oInput_1))
    Sleep(2000)
    Send("{ENTER}")
    Sleep(2000)
    Send("{ENTER}")
    Sleep(2000)
    $Logoutmsg = "You have Logged out on NON-PAID Break"
    GUICtrlSetState($Radio_3, $GUI_UNCHECKED) ; Why bother - you are exiting  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    #ce
    MyExit()
EndFunc   ;==>Option3checked

Func Option4checked()
    ConsoleWrite("Option 4" & @CRLF)
    #cs
    GUICtrlSetState($Radio_4, $GUI_UNCHECKED)
    ShellExecute("F:\CALL CENTER - OPERATIONS\SRG  Folder\Interviewer.lnk", "", "")
    #ce
    GUIDelete($MyExitDialog) ; Just destroy the dialog - why keep it? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ;WinSetState("Log Out Type Selection", "", @SW_MINIMIZE)
    ;WinClose("Log Out Type Selection")
    Sleep(1500)

    ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    ;CheckWincati()  Huge error - see post <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

EndFunc   ;==>Option4checked
Func MyExit()

    If ProcessExists("wintck32.exe") Then
        ProcessClose("wintck32.exe")
    EndIf
    ;MsgBox(4096,"Time Clock Automation","You are now logged out!")
    MsgBox(4096, "Time Clock Automation", $Logoutmsg)
    Exit

EndFunc   ;==>MyExit

;**** This section runs for the user to choose if they want to logout, 3 different ways or go back into Interviewer"
Func Logoutofintview()

    MsgBox(4096, "Here", "1")

    ;Global $MyExitDialog
    Global $MyLoopCounter

    ;msgbox(4096,"Window Exist",WinExists("Log Out Type Selection"))

    ;if WinExists("Log Out Type Selection")  = 1 then
    ;GUICtrlDelete($MyExitDialog)
    ;GUICtrlDelete($Radio_1)
    ;GUICtrlDelete($Radio_2)
    ;GUICtrlDelete($Radio_3)
    ;GUICtrlDelete($Radio_4)
    ;GuiSetState(@SW_SHOW + @SW_ENABLE,$MyExitDialog)

    ;GUICtrlSetState($Radio_1,$GUI_UNCHECKED)
    ;GUICtrlSetState($Radio_2,$GUI_UNCHECKED)
    ;GUICtrlSetState($Radio_2,$GUI_UNCHECKED)
    ;GUICtrlSetState($Radio_2,$GUI_UNCHECKED)
    ;GUISetState(@SW_SHOW,$MyExitDialog)
    ;else
    CreateLogoutWindow()
    ;EndIf

    $MyExit = 0
    $MyLoopCounter = 60
    $Logoutmsg = "Error in Logout, see Administrator"
    ;GuiSetState(@SW_SHOW)

    While $MyExit = 0
        $msg = GUIGetMsg()

        ;if $MyLoopCounter = 0 Then ;Timer to force log out after 60 seconds
        ;same as $radio_1 below
        ;WinActivate("TimeClock Plus")
        ;Send("{TAB}")
        ;Sleep(2000)
        ;Send("{ENTER}")
        ;Sleep(2000)
        ;Send(GuiCtrlRead($oInput_1))
        ;Sleep(2000)
        ;Send("{ENTER}")
        ;Sleep(5000)
        ;Send("{ENTER}")
        ;Sleep(5000)
        ;$Logoutmsg = "You have Logged out of the System Automatilly"
        ;$MyExit = 1
        ;Else

        Select
            ;Case $msg = $GUI_EVENT_CLOSE
            ;ExitLoop

            Case $msg = $Radio_1 ;Log out completely
                ;GUISetState(@SW_HIDE + @SW_DISABLE)
                ;Time Clock - logout
                WinActivate("TimeClock Plus")
                Send("{TAB}")
                Sleep(2000)
                Send("{ENTER}")
                Sleep(2000)
                Send(GUICtrlRead($oInput_1))
                Sleep(2000)
                Send("{ENTER}")
                Sleep(5000)
                Send("{ENTER}")
                Sleep(5000)
                $Logoutmsg = "You have Logged out of the System"
                $MyExit = 1

            Case $msg = $Radio_2
                ;GUISetState(@SW_HIDE + @SW_DISABLE)
                ;Time Clock - Paid Break
                WinActivate("TimeClock Plus")
                Send("{TAB}")
                Sleep(2000)
                Send("{TAB}")
                Sleep(2000)
                Send("{ENTER}")
                Sleep(2000)
                Send("P")
                Sleep(2000)
                Send(GUICtrlRead($oInput_1))
                Sleep(2000)
                Send("{ENTER}")
                Sleep(2000)
                Send("{ENTER}")
                Sleep(2000)
                $Logoutmsg = "You have Logged out on PAID Break"
                $MyExit = 1

            Case $msg = $Radio_3
                ;GUISetState(@SW_HIDE + @SW_DISABLE)
                ;Time Clock - Non-Paid Break
                WinActivate("TimeClock Plus")
                Send("{TAB}")
                Sleep(2000)
                Send("{TAB}")
                Sleep(2000)
                Send("{ENTER}")
                Sleep(2000)
                Send("N")
                Sleep(2000)
                Send(GUICtrlRead($oInput_1))
                Sleep(2000)
                Send("{ENTER}")
                Sleep(2000)
                Send("{ENTER}")
                Sleep(2000)
                $Logoutmsg = "You have Logged out on NON-PAID Break"
                $MyExit = 1

            Case $msg = $Radio_4()
                GUISetState(@SW_HIDE + @SW_DISABLE, $MyExitDialog)
                GUICtrlSetState($Radio_4, $GUI_UNCHECKED)
                ShellExecute("F:\CALL CENTER - OPERATIONS\SRG  Folder\Interviewer.lnk", "", "")
                Sleep(1500)
                $MyExit = 1
                CheckWincati()
            Case Else
                ;;;
        EndSelect

        ;EndIf

        ;sleep("1000")
        ;$MyLoopCounter = $MyLoopCounter - 1

    WEnd

    If ProcessExists("wintck32.exe") Then
        ProcessClose("wintck32.exe")
    EndIf

    ;MsgBox(4096,"Time Clock Automation","You are now logged out!")

    MsgBox(4096, "Time Clock Automation", $Logoutmsg)
    Exit
EndFunc   ;==>Logoutofintview

Sorry if I sounded a little harsh yesterday - but having to sort out code to get it to run before being able to look for problems gets a bit tiresome after a while. I hope this modified code makes up for it. :P

Please ask if you have any questions. :party:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks much, I have been off line for a few days. Again sorry for the bad code. I am a VB6 and VB Script, some what programmer. AutoIT is nice but I am tring to use it the way I would develop in VB. I inherited from another engineer that had left the company.

I see what you have done and will apply to this project. I will also clean up my bad AutoIT coding.

Thanks

taddyman,

Good morning, I hope you slept as well as I did. :ILA:

Here is a version of your script which works for me. I have added lots of comments - look for the <<<<<<<<<<<<<<<<<<<<< lines.

3 major changes to explain:

- 1. I am now deleting the Log Out Type Selection dialog each time. It is only a small dialog and it is not used that often so there is little point in keeping it for reuse - the time saving is minimal.

- 2. I have converted the script to run in GetMessage mode all the time. As I mentioned yesterday, switching between modes in a script is a recipe for disaster and should only ever be attempted in the most exceptional circumstances - and even then you should have alarm bells going off and be asking yourself why the situation is that exceptional and how you might recast the code. :party:

- 3. You were running into major recursion problems with the script. :party: If you elected to return to the Interviewer (Option 4) you were re-entering function CheckWincati before exiting the function - which then recalled function CreateLogoutWindow - and so on to infinity. Very bad idea. :mellow: I have changed function CheckWincati to become an infinite loop - we exit the whole script with Options 1-3 so we never need to leave the this loop until we exit - which enables Option 4 to exit the CreateLogoutWindow function before re- entering the loop. Hence no recursion. :party:

Here is the code as I have modified it:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ComboConstants.au3>

Global $Radio_1  ; Global declarations moved from with function <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Global $Radio_2
Global $Radio_3
Global $Radio_4
Global $MyLoopCounter
Global $Logoutmsg
Global $MyExitDialog

;Application writtien by Bruce Evans and Tim Addy of Synergetics DCS for Southern Research
;to manipulate the TimeClock and Wincati Interviewer applications in the attempt
;to sync the employees time in and time out entries. It also forces them not to
;forget to log out or goto break

__steam_window('SOUTHERN RESEARCH GROUP', 600, 300) ; WIDTH NOT SMALLER THEN 400 | HEIGHT NOT SMALLER THEN 200 === TRUST ME

Func __steam_window($sWINDOW_TITLE, $iWINDOW_WIDTH, $iWINDOW_HEIGHT)
    Local $oWINDOW = GUICreate($sWINDOW_TITLE, $iWINDOW_WIDTH, $iWINDOW_HEIGHT, -1, -1, BitOR($WS_POPUP, $WS_SYSMENU, $WS_MINIMIZEBOX), $WS_EX_LAYERED) ; BitOR($WS_EX_TOOLWINDOW, $WS_EX_LAYERED))
    GUISetFont(12, 400, 0, 'Tahoma')
    GUISetBkColor(0x494E49)
    GUICtrlCreatePic('hdr.bmp', 0, 0, $iWINDOW_WIDTH - 16, 20, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('hdr.bmp', $iWINDOW_WIDTH - 16, 0, 11, 5, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('hdr.bmp', $iWINDOW_WIDTH - 16, 16, 11, 4, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('hdr.bmp', $iWINDOW_WIDTH - 5, 0, 5, 20, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreateGraphic(0, 20, 1, $iWINDOW_HEIGHT)
    GUICtrlSetColor(-1, 0x686A65)
    GUICtrlCreateGraphic($iWINDOW_WIDTH - 1, 20, 1, $iWINDOW_HEIGHT)
    GUICtrlSetColor(-1, 0x686A65)
    GUICtrlCreateGraphic(0, $iWINDOW_HEIGHT - 1, $iWINDOW_WIDTH, 1)
    GUICtrlSetColor(-1, 0x686A65)
    Local $oCLOSE = GUICtrlCreatePic('cls.bmp', $iWINDOW_WIDTH - 16, 5, 11, 11, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    Local $oLABELHEADER = GUICtrlCreateLabel($sWINDOW_TITLE, 6, 0, $iWINDOW_WIDTH - 22, 20, $SS_CENTERIMAGE)
    GUICtrlSetColor(-1, 0xD8DED3)
    GUICtrlSetBkColor(-1, 0x5A6A50)

    #cs ==============================
        EXAMPLE SECTION ==================
    #ce ==============================

    ;Login Button
    Local $oBUTTON_1 = GUICtrlCreateButton('LOG IN', 10, 30, 140, 20)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    GUICtrlSetState($oBUTTON_1, $GUI_DEFBUTTON)
    ;Cancel Button
    Local $oBUTTON_2 = GUICtrlCreateButton('CANCEL', 10, 60, 140, 20)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')

    GUICtrlCreateGraphic(1, 20, 160, $iWINDOW_HEIGHT - 21)
    GUICtrlSetColor(-1, 0x464646)
    GUICtrlSetBkColor(-1, 0x464646)

    GUICtrlCreateGraphic(158, 20, 1, $iWINDOW_HEIGHT - 21)
    GUICtrlSetColor(-1, 0x3D423D)

    GUICtrlCreateGraphic(159, 20, 1, $iWINDOW_HEIGHT - 21)
    GUICtrlSetColor(-1, 0x424742)

    GUICtrlCreateGraphic(160, 20, 1, $iWINDOW_HEIGHT - 21)
    GUICtrlSetColor(-1, 0x454A45)

    ;Code to create label above entry text boxes
    $oLABELTOP = GUICtrlCreateLabel('WINCATI AND TIMECLOCK DUAL LOGIN', 180, 31, $iWINDOW_WIDTH - 200, 20, $SS_CENTERIMAGE)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    GUICtrlSetColor(-1, 0xC4B550)

    GUICtrlCreateGraphic(170, 51, $iWINDOW_WIDTH - 180, 1)
    GUICtrlSetColor(-1, 0x636763)

    ;Code for Enter ID Number control Label
    GUICtrlCreateLabel('Enter ID number:', 250, 70, 150, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    GUICtrlSetColor(-1, 0xE6ECE0)

    ;Code for Enter ID Number control Input Box
    Global $oInput_1 = GUICtrlCreateInput('', 420, 70, 90, 20, 0x2000)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    Local $oLimit_1 = GUICtrlSetLimit(-1, 7)
    GUICtrlSetState($oInput_1, $GUI_FOCUS)

    ;Code for Select Job Code control Label
    GUICtrlCreateLabel('Select Job Code:', 250, 100, 150, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    GUICtrlSetColor(-1, 0xE6ECE0)
    ;Code for Select Job Code control Input Box
    Global $oInput_2 = GUICtrlCreateInput('', 420, 100, 50, 20, 0x2000)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    Local $oLimit_2 = GUICtrlSetLimit(-1, 3)

    ;Code for Costing Code control Label
    GUICtrlCreateLabel('Costing Code:', 250, 130, 150, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
    GUICtrlSetColor(-1, 0xE6ECE0)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    ;Code for Costing Code control Input Box
    Local $oInput_3 = GUICtrlCreateInput('', 420, 130, 50, 20, 0x2000)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    Local $oLimit_3 = GUICtrlSetLimit(-1, 2)

    ;Code for Interviewer ID control Label
    GUICtrlCreateLabel('Interviewer ID:', 250, 160, 150, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    GUICtrlSetColor(-1, 0xE6ECE0)
    ;Code for Interviewer ID control Input Box
    Local $oInput_4 = GUICtrlCreateInput('', 420, 160, 50, 20, 0x2000)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    Local $oLimit_4 = GUICtrlSetLimit(-1, 3)

    ;Code for Station Number control Label
    GUICtrlCreateLabel('Station Number:', 250, 190, 150, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    GUICtrlSetColor(-1, 0xE6ECE0)
    ;Code for Station Number control Input Box
    Local $oInput_5 = GUICtrlCreateInput('', 420, 190, 50, 20, 0x2000)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    Local $oLimit_5 = GUICtrlSetLimit(-1, 3)

    ;Code for Study List control Label
    GUICtrlCreateLabel('Study List:', 250, 220, 150, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    GUICtrlSetColor(-1, 0xE6ECE0)
    ;Code for Study List control Input Box
    Local $oInput_6 = GUICtrlCreateInput('', 420, 220, 50, 20, 0x2000)
    GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
    Local $oLimit_6 = GUICtrlSetLimit(-1, 3)

    ; THIS CONTROL NEEDS TO BE LAST DUE TO OVERLAY ISSUES
    GUICtrlCreateGraphic(170, 30, $iWINDOW_WIDTH - 180, $iWINDOW_HEIGHT - 40)
    GUICtrlSetColor(-1, 0x686A65)

    #cs ==============================
        EXAMPLE SECTION ==================
    #ce ==============================

    GUICtrlCreatePic('cnr.bmp', 0, 0, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('cnr.bmp', $iWINDOW_WIDTH - 1, 0, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('cnr.bmp', 0, $iWINDOW_HEIGHT - 1, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('cnr.bmp', $iWINDOW_WIDTH - 1, $iWINDOW_HEIGHT - 1, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)

    ;This is the start of the app that open the main window
    GUISetState(@SW_SHOW)

    While 1
        Local $eMSG = GUIGetMsg()
        Switch $eMSG
            Case $GUI_EVENT_CLOSE, $oCLOSE, $oBUTTON_2 ; These all run identical code - why write it 3 times? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                ;Local $iWINDOW_TRANS
                ;For $iWINDOW_TRANS = 255 To 0 Step -10
                ;If $iWINDOW_TRANS > 0 Then WinSetTrans($oWINDOW,'',$iWINDOW_TRANS)
                ;Sleep(10)
                ;Next
                Exit

                ;This is the login code. It executes the Time Clock via the ICON on the desktop it
                ;must be there and named exactly as the entry under the SHELLEXECUTE() statment
            Case $oBUTTON_1

                ;Need to add edit checks here, make sure there is data in the text boxes
#cs  ; I am not checking - you will need to uncomment this block <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                If GUICtrlRead($oInput_1) = "" Then
                    MsgBox(4096, "Enter ID Number Error", "There must be a ID Number, the program will exit now!")
                    Exit
                EndIf
                If GUICtrlRead($oInput_2) = "" Then
                    MsgBox(4096, "Select Job Code Error", "There must be a Job Code, the program will exit now!")
                    Exit
                EndIf
                If GUICtrlRead($oInput_3) = "" Then
                    MsgBox(4096, "Costing Code Error", "There must be a Costing Code, the program will exit now!")
                    Exit
                EndIf
                If GUICtrlRead($oInput_4) = "" Then
                    MsgBox(4096, "Interviewer ID Error", "There must be a Interviewer ID, the program will exit now!")
                    Exit
                EndIf
                If GUICtrlRead($oInput_5) = "" Then
                    MsgBox(4096, "Station Number Error", "There must be a Station Number, the program will exit now!")
                    Exit
                EndIf
                If GUICtrlRead($oInput_6) = "" Then
                    MsgBox(4096, "Study List Error", "There must be a Study List, the program will exit now!")
                    Exit
                EndIf
#ce
                GUISetState(@SW_HIDE)

                ;**** Start of warning box to user about not touching mouse or keyboard during automation process
                ;************************************************************************************************************************
                $WarnVar = GUICreate("DUAL LOGIN *** Usage WARNING  ***", 440, 160, -1, -1, $DS_MODALFRAME)
                GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')

                GUICtrlCreateLabel('DO NOT TOUCH KEYBOARD OR MOUSE', 30, 10, 338, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
                GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
                GUICtrlSetColor(-1, 0xff0000)

                GUICtrlCreateLabel('UNTIL YOU SEE THE WINCATI', 30, 35, 300, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
                GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
                GUICtrlSetColor(-1, 0xff0000)

                GUICtrlCreateLabel('INTERVIEWER SCREEN', 30, 60, 275, 20, BitOR($SS_RIGHT, $SS_CENTERIMAGE))
                GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
                GUICtrlSetColor(-1, 0xff0000)

                Local $oOK_1 = GUICtrlCreateButton('OK', 170, 85, 80, 40)
                GUICtrlSetFont(-1, 12, 800, 0, 'Tahoma')
                GUICtrlSetState($oOK_1, $GUI_DEFBUTTON)

                GUISetState()
                $MyOK = 0
                While $MyOK = 0
                    $msg = GUIGetMsg()
                    Select
                        Case $msg = $oOK_1
                            GUISetState(@SW_HIDE)
                            ExitLoop

                    EndSelect

                WEnd

                ConsoleWrite("Login Process" & @CRLF)  ; you will need to comment this line <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#cs ;  you will need to uncomment this block <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                ;************************************************************************************************************************
                ;**** End of warning box to user about not touching mouse or keyboard during automation process

                ;**** Start of dual login process
                ;************************************************************************************************************************
                ;*** Launch the time clock software, NOTE this link must be a the location shouwn in the shellexecute
                ShellExecute("F:\CALL CENTER - OPERATIONS\SRG  Folder\On-Screen TimeClock.lnk", "", "")
                ;*** Now Wait 5 seconds for the Time Clock to load, my vary on different machines, may have to increase for slowest system
                Sleep(5000)
                ;*** This ENTER is to launch the "Clock IN" process
                Send("{ENTER}")
                ;*** Now wait 1 second for the input box to open
                Sleep(1000)
                ;*** Now input the varible from input 1
                Send(GUICtrlRead($oInput_1))
                ;*** ENTER again to accespt the input
                Send("{ENTER}")

                Sleep(1000)
                Send("{ENTER}")
                Sleep(1000)
                Send(GUICtrlRead($oInput_2))
                Sleep(1000)
                Send("{ENTER}")
                Sleep(1000)
                Send(GUICtrlRead($oInput_3))
                Sleep(4000)

                ;This is the login to the Interviewer code. It executes the WinCati via the ICON on the desktop it
                ;must be there and named exactly as the entry under the SHELLEXECUTE() statment
                ShellExecute("F:\CALL CENTER - OPERATIONS\SRG  Folder\Interviewer.lnk", "", "")
                ;**** Now Wait 5 seconds for the Interviewer to load, my vary on different machines, may have to increase for slowest system
                Sleep(5000)

                Send(GUICtrlRead($oInput_4))
                Sleep(1000)
                Send("{TAB}")
                Send(GUICtrlRead($oInput_5))
                Sleep(1000)
                Send("{TAB}")

                Sleep(1000)
                Send(GUICtrlRead($oInput_6))
                Sleep(1000)
                Send("{TAB}")
                Send("{ENTER}")
                Sleep(2000)
                WinActivate("Costing Code Selection")
                Send("{ENTER}")

                ;***************************************************************************************************
                ;**** We want to minimize both the duallogon and time clock windows so the Interviewer is on top ***
                ;***************************************************************************************************

                WinSetState("TimeClock Plus", "", @SW_MINIMIZE)
                WinSetState("SOUTHERN RESEARCH GROUP", "", @SW_MINIMIZE)

                ;**** Now call the Check WinCati function to loop until the WinCati Interviewer window close.
                ;*********************************************************************************************
                #ce
                CheckWincati()

                ;EndFunc

        EndSwitch ;??????????
    WEnd ;????????????????????
EndFunc   ;==>__steam_window

;**** This is the loop that watches for the interviewer windows to close
;*********************************************************************************
Func CheckWincati()

    While 1 ; Make this whole section a loop - see post for details why <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

        While WinExists("WinCati 4.1 Interviewer") = 1

            ;**** Checking every 2 seconds to see if it has closed
            ;*****************************************************
            Sleep("2000")
            ContinueLoop

        WEnd

        ;Set global vars for next bit of code before moving on.
        ;Opt("GUIOnEventMode", 0) ; We not longer change mode <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        ;**** If the WinCati Interviewer closes then run the "Log out of interviewer" function
        ;***************************************************************************************
        ;Logoutofintview()
        CreateLogoutWindow()

    WEnd

EndFunc   ;==>CheckWincati
Func CreateLogoutWindow()

    ;**** Change window processing to On Event Mode!!!!!
    ;Opt("GUIOnEventMode", 1)  ; We not longer change mode <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    ; Global declarations moved to beginning of script <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    $MyExitDialog = GUICreate("Log Out Type Selection", 260, 120, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))


    $Radio_1 = GUICtrlCreateRadio("Log Out Completely", 30, 20, 190, 15)
    GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')
    ;GUICtrlSetOnEvent($Radio_1, "Option1checked") ; No lomger needed <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    $Radio_2 = GUICtrlCreateRadio("Log Out for Paid Break", 30, 40, 190, 15)
    GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')
    ;GUICtrlSetOnEvent($Radio_2, "Option2checked") ; No lomger needed <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    $Radio_3 = GUICtrlCreateRadio("Log Out for UN-Paid Break", 30, 60, 190, 15)
    GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')
    ;GUICtrlSetOnEvent($Radio_3, "Option3checked") ; No lomger needed <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    $Radio_4 = GUICtrlCreateRadio("Go Back Into Interviwer", 30, 80, 190, 15)
    GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')
    ;GUICtrlSetOnEvent($Radio_4, "Option4checked") ; No lomger needed <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    GUISetState(@SW_SHOW, $MyExitDialog)

    $iBegin = TimerInit() ; Start timer <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    While 1
        ; Check timer
        If TimerDiff($iBegin) > 60000 Then
            ; Set exit code and exit While...WEnd loop <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            $iChecked = 1
            ExitLoop
        EndIf

        ; Check if a radio clicked <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        For $i = $Radio_1 To $Radio_4
            If GUICtrlRead($i) = 1 Then
                ; Set exit code and exit both For...Next and While...WEnd loops <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                $iChecked = $i - $radio_1 + 1
                ExitLoop 2 ; We need to 2 here because there are 2 loops to exit <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            EndIf
        Next
        Sleep(10) ; must have a small sleep to avoid maxing out the CPU <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    WEnd

    ; Depending on exit code, run the appropriate function <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    Switch $iChecked
        Case 1
            Option1checked()
        Case 2
            Option2checked()
        Case 3
            Option3checked()
        Case 4
            Option4checked()
    EndSwitch

EndFunc   ;==>CreateLogoutWindow

Func Option1checked()
    ConsoleWrite("Option 1" & @CRLF)
    #cs
    WinActivate("TimeClock Plus")
    Send("{TAB}")
    Sleep(2000)
    Send("{ENTER}")
    Sleep(2000)
    Send(GUICtrlRead($oInput_1))
    Sleep(2000)
    Send("{ENTER}")
    Sleep(5000)
    Send("{ENTER}")
    Sleep(5000)
    $Logoutmsg = "You have Logged out of the System"
    GUICtrlSetState($Radio_1, $GUI_UNCHECKED) ; Why bother - you are exiting  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    #ce
    MyExit()
EndFunc   ;==>Option1checked

Func Option2checked()
    ConsoleWrite("Option2 " & @CRLF)
    #cs
    WinActivate("TimeClock Plus")
    Send("{TAB}")
    Sleep(2000)
    Send("{TAB}")
    Sleep(2000)
    Send("{ENTER}")
    Sleep(2000)
    Send("P")
    Sleep(2000)
    Send(GUICtrlRead($oInput_1))
    Sleep(2000)
    Send("{ENTER}")
    Sleep(2000)
    Send("{ENTER}")
    Sleep(2000)
    $Logoutmsg = "You have Logged out on PAID Break"
    GUICtrlSetState($Radio_2, $GUI_UNCHECKED) ; Why bother - you are exiting  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    #ce
    MyExit()
EndFunc   ;==>Option2checked

Func Option3checked()
    ConsoleWrite("Option 3" & @CRLF)
    #cs
    WinActivate("TimeClock Plus")
    Send("{TAB}")
    Sleep(2000)
    Send("{TAB}")
    Sleep(2000)
    Send("{ENTER}")
    Sleep(2000)
    Send("N")
    Sleep(2000)
    Send(GUICtrlRead($oInput_1))
    Sleep(2000)
    Send("{ENTER}")
    Sleep(2000)
    Send("{ENTER}")
    Sleep(2000)
    $Logoutmsg = "You have Logged out on NON-PAID Break"
    GUICtrlSetState($Radio_3, $GUI_UNCHECKED) ; Why bother - you are exiting  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    #ce
    MyExit()
EndFunc   ;==>Option3checked

Func Option4checked()
    ConsoleWrite("Option 4" & @CRLF)
    #cs
    GUICtrlSetState($Radio_4, $GUI_UNCHECKED)
    ShellExecute("F:\CALL CENTER - OPERATIONS\SRG  Folder\Interviewer.lnk", "", "")
    #ce
    GUIDelete($MyExitDialog) ; Just destroy the dialog - why keep it? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ;WinSetState("Log Out Type Selection", "", @SW_MINIMIZE)
    ;WinClose("Log Out Type Selection")
    Sleep(1500)

    ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    ;CheckWincati()  Huge error - see post <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

EndFunc   ;==>Option4checked
Func MyExit()

    If ProcessExists("wintck32.exe") Then
        ProcessClose("wintck32.exe")
    EndIf
    ;MsgBox(4096,"Time Clock Automation","You are now logged out!")
    MsgBox(4096, "Time Clock Automation", $Logoutmsg)
    Exit

EndFunc   ;==>MyExit

;**** This section runs for the user to choose if they want to logout, 3 different ways or go back into Interviewer"
Func Logoutofintview()

    MsgBox(4096, "Here", "1")

    ;Global $MyExitDialog
    Global $MyLoopCounter

    ;msgbox(4096,"Window Exist",WinExists("Log Out Type Selection"))

    ;if WinExists("Log Out Type Selection")  = 1 then
    ;GUICtrlDelete($MyExitDialog)
    ;GUICtrlDelete($Radio_1)
    ;GUICtrlDelete($Radio_2)
    ;GUICtrlDelete($Radio_3)
    ;GUICtrlDelete($Radio_4)
    ;GuiSetState(@SW_SHOW + @SW_ENABLE,$MyExitDialog)

    ;GUICtrlSetState($Radio_1,$GUI_UNCHECKED)
    ;GUICtrlSetState($Radio_2,$GUI_UNCHECKED)
    ;GUICtrlSetState($Radio_2,$GUI_UNCHECKED)
    ;GUICtrlSetState($Radio_2,$GUI_UNCHECKED)
    ;GUISetState(@SW_SHOW,$MyExitDialog)
    ;else
    CreateLogoutWindow()
    ;EndIf

    $MyExit = 0
    $MyLoopCounter = 60
    $Logoutmsg = "Error in Logout, see Administrator"
    ;GuiSetState(@SW_SHOW)

    While $MyExit = 0
        $msg = GUIGetMsg()

        ;if $MyLoopCounter = 0 Then ;Timer to force log out after 60 seconds
        ;same as $radio_1 below
        ;WinActivate("TimeClock Plus")
        ;Send("{TAB}")
        ;Sleep(2000)
        ;Send("{ENTER}")
        ;Sleep(2000)
        ;Send(GuiCtrlRead($oInput_1))
        ;Sleep(2000)
        ;Send("{ENTER}")
        ;Sleep(5000)
        ;Send("{ENTER}")
        ;Sleep(5000)
        ;$Logoutmsg = "You have Logged out of the System Automatilly"
        ;$MyExit = 1
        ;Else

        Select
            ;Case $msg = $GUI_EVENT_CLOSE
            ;ExitLoop

            Case $msg = $Radio_1 ;Log out completely
                ;GUISetState(@SW_HIDE + @SW_DISABLE)
                ;Time Clock - logout
                WinActivate("TimeClock Plus")
                Send("{TAB}")
                Sleep(2000)
                Send("{ENTER}")
                Sleep(2000)
                Send(GUICtrlRead($oInput_1))
                Sleep(2000)
                Send("{ENTER}")
                Sleep(5000)
                Send("{ENTER}")
                Sleep(5000)
                $Logoutmsg = "You have Logged out of the System"
                $MyExit = 1

            Case $msg = $Radio_2
                ;GUISetState(@SW_HIDE + @SW_DISABLE)
                ;Time Clock - Paid Break
                WinActivate("TimeClock Plus")
                Send("{TAB}")
                Sleep(2000)
                Send("{TAB}")
                Sleep(2000)
                Send("{ENTER}")
                Sleep(2000)
                Send("P")
                Sleep(2000)
                Send(GUICtrlRead($oInput_1))
                Sleep(2000)
                Send("{ENTER}")
                Sleep(2000)
                Send("{ENTER}")
                Sleep(2000)
                $Logoutmsg = "You have Logged out on PAID Break"
                $MyExit = 1

            Case $msg = $Radio_3
                ;GUISetState(@SW_HIDE + @SW_DISABLE)
                ;Time Clock - Non-Paid Break
                WinActivate("TimeClock Plus")
                Send("{TAB}")
                Sleep(2000)
                Send("{TAB}")
                Sleep(2000)
                Send("{ENTER}")
                Sleep(2000)
                Send("N")
                Sleep(2000)
                Send(GUICtrlRead($oInput_1))
                Sleep(2000)
                Send("{ENTER}")
                Sleep(2000)
                Send("{ENTER}")
                Sleep(2000)
                $Logoutmsg = "You have Logged out on NON-PAID Break"
                $MyExit = 1

            Case $msg = $Radio_4()
                GUISetState(@SW_HIDE + @SW_DISABLE, $MyExitDialog)
                GUICtrlSetState($Radio_4, $GUI_UNCHECKED)
                ShellExecute("F:\CALL CENTER - OPERATIONS\SRG  Folder\Interviewer.lnk", "", "")
                Sleep(1500)
                $MyExit = 1
                CheckWincati()
            Case Else
                ;;;
        EndSelect

        ;EndIf

        ;sleep("1000")
        ;$MyLoopCounter = $MyLoopCounter - 1

    WEnd

    If ProcessExists("wintck32.exe") Then
        ProcessClose("wintck32.exe")
    EndIf

    ;MsgBox(4096,"Time Clock Automation","You are now logged out!")

    MsgBox(4096, "Time Clock Automation", $Logoutmsg)
    Exit
EndFunc   ;==>Logoutofintview

Sorry if I sounded a little harsh yesterday - but having to sort out code to get it to run before being able to look for problems gets a bit tiresome after a while. I hope this modified code makes up for it. :P

Please ask if you have any questions. :party:

M23

Link to comment
Share on other sites

  • Moderators

taddyman,

Glad I could help! :party:

Please come back and ask if there is anything you do not follow in the code - or if there are any general AutoIt points you would like clarified. As you already have some programming background, AutoIt should be pretty easy to pick up (even I can manage fairly well! :P ) but like all languages it has its little quirks. :mellow:

M23

P.S. Just a small point - when you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. :party:

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...