Sign in to follow this  
Followers 0
jtrout

Focus Issues with GUI Tabs on inputboxes

8 posts in this topic

Ok I have script here and I am building the tabs off an INI and I am getting the information for the input boxes from INIs and prepopulating them into the fields so all I have to do is change it and click update. This works great for the first tab, but when I go to any tab after that it keeps the first tab information in memory somehow and when I click on any of the input boxes on any tab but the first one it replaces the current information with what was on the first tab. I have added in a log to write what is really there and the log looks fine. It is just the focus that somehow is getting overlayed.

Can anyone help? Has anyone ever had issues like this?

CODE

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

#AutoIt3Wrapper_icon=C:\Program Files\AutoIt3\Icons\CNFNOT.ICO

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <guitab.au3>

#include <GuiConstants.au3>

#include <array.au3>

#include <file.au3>

Opt("MustDeclareVars", 1) ; Variables must be pre-declared

Opt("TrayIconDebug", 1) ; Shows current script line in tray icon

Const $ADS_SECURE_AUTHENTICATION = "&h1"

Const $ADS_SERVER_BIND = "&h200"

Const $PORT_CLEARTEXT = ":389"

Global $fileitemExit, $fileitemLogComplete, $filemenuFile, $filemenuLog, $filemenuRefresh, $fileitemRefresh, $tab, $iCurrentTab

Global $UpdateServerbutton, $serversInINI, $file, $newdrives, $filemenuMap, $fileitemMap, $masterdriveletter

Local $Server, $x, $val, $logmsg, $driveletter, $pathtomap, $user, $passwd, $log, $timestamp

Local $month, $day, $year, $hour, $min, $sec, $time, $counter, $logonfrm, $UserIDField, $PasswordField, $UserID, $Password

Local $button1, $button2, $msg, $changednewer, $changed, $msgrtn

Local $AlogentversionNumberServer, $AlogentversionNumberMaster, $AlogentversionNumberFieldCurrent, $AlogentversionNumberFieldFuture, $AlogentversionNumberFieldCurrentNew, $AlogentversionNumberFieldFutureNew

Local $ArgoServer, $ArgoMaster, $ArgoFieldCurrent, $ArgoFieldFuture, $ArgoFieldCurrentNew, $ArgoFieldFutureNew

Local $CodeversionServer, $CodeversionMaster, $CodeversionFieldCurrent, $CodeversionFieldFuture, $CodeversionFieldCurrentNew, $CodeversionFieldFutureNew

Local $ServerDateDateServer, $ServerDateDateMaster, $ServerDateDateFieldCurrent, $ServerDateDateFieldFuture, $ServerDateDateFieldCurrentNew, $ServerDateDateFieldFutureNew

Local $SortPatternDateServer, $SortPatternDateMaster, $SortPatternDateFieldCurrent, $SortPatternDateFieldFuture, $SortPatternDateFieldCurrentNew, $SortPatternDateFieldFutureNew

Local $SortPatternTimeServer, $SortPatternTimeMaster, $SortPatternTimeFieldCurrent, $SortPatternTimeFieldFuture, $SortPatternTimeFieldCurrentNew, $SortPatternTimeFieldFutureNew

Local $SortPatternversionNumberServer, $SortPatternversionNumberMaster, $SortPatternversionNumberFieldCurrent, $SortPatternversionNumberFieldFuture, $SortPatternversionNumberFieldCurrentNew, $SortPatternversionNumberFieldFutureNew

Local $TDEFNDateServer, $TDEFNDateMaster, $TDEFNDateFieldCurrent, $TDEFNDateFieldFuture, $TDEFNDateFieldCurrentNew, $TDEFNDateFieldFutureNew

Local $TDEFNTimeServer, $TDEFNTimeMaster, $TDEFNTimeFieldCurrent, $TDEFNTimeFieldFuture, $TDEFNTimeFieldCurrentNew, $TDEFNTimeFieldFutureNew

Local $TDEFNversionNumberServer, $TDEFNversionNumberMaster, $TDEFNversionNumberFieldCurrent, $TDEFNversionNumberFieldFuture, $TDEFNversionNumberFieldCurrentNew, $TDEFNversionNumberFieldFutureNew

Local $cn, $iDobj, $strSvr, $strLDAP, $strCred, $strUser, $strPW, $iSecurity, $strSvrPort, $oMyError, $iKeyIndex, $HexNumber

If @ComputerName = "Server" Then

$masterdriveletter = "F:"

Else

$masterdriveletter = "Z:"

EndIf

; Open Log file

$logmsg = "Start of GUICodeLoader.exe"

logger($logmsg)

; Login for Script access

Opt("GUIOnEventMode", 0) ; Change to OnEvent mode

logon()

GUIMapping()

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

displayGUI()

Exit

;Functions

Func GUIMapping()

;Read Servers INI

$serversInINI = IniReadSectionNames("Servers.ini")

For $x = 1 To $serversInINI[0]

$driveletter = IniRead("Servers.ini", $serversInINI[$x], "Drive", "ERROR")

$pathtomap = IniRead("Servers.ini", $serversInINI[$x], "Path", "ERROR")

$Server = IniRead("Servers.ini", $serversInINI[$x], "Server", "ERROR")

SplashTextOn('Mapping Drives', 'Please wait....Mapping Drive to ' & $serversInINI[$x] & '.', 600, 300)

mapdrive($driveletter, $pathtomap, $Server)

SplashOff()

Next

EndFunc ;==>GUIMapping

Func mapdrive($driveletter, $pathtomap, $Server)

$user = $Server & "\userid"

$passwd = "password"

DriveMapAdd($driveletter, $pathtomap, 0, $user, $passwd)

If @error Then

If FileExists($driveletter) Then

$logmsg = "The " & $Server & " drive already exists."

logger($logmsg)

Else

$logmsg = "The " & $Server & " drive failed to map"

logger($logmsg)

EndIf

EndIf

EndFunc ;==>mapdrive

Func displayGUI()

; GUI

GUICreate("Code Loader GUI", 600, 830)

;GuiSetIcon(@SystemDir & "\mspaint.exe", 0)

GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")

GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")

GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")

; MENU

$filemenuFile = GUICtrlCreateMenu("&File")

$fileitemExit = GUICtrlCreateMenuItem("E&xit", $filemenuFile)

GUICtrlSetOnEvent(-1, "ExitGUI")

$filemenuMap = GUICtrlCreateMenu("Re&Map Drive")

$fileitemMap = GUICtrlCreateMenuItem("Re-map Server", $filemenuMap)

GUICtrlSetOnEvent(-1, "RemapDrive")

$filemenuRefresh = GUICtrlCreateMenu("&Refresh")

$fileitemRefresh = GUICtrlCreateMenuItem("Refresh &Tab", $filemenuRefresh)

GUICtrlSetOnEvent(-1, "RefreshTab")

$filemenuLog = GUICtrlCreateMenu("&Log")

$fileitemLogComplete = GUICtrlCreateMenuItem("View Complete Log", $filemenuLog)

GUICtrlSetOnEvent(-1, "CompleteLog")

; TABS

Tabs()

TabClick()

GUISetState(@SW_SHOW)

GUICtrlSetOnEvent($tab, "TabClick")

GUICtrlSetOnEvent($UpdateServerbutton, "UpdateServer")

While 1

Sleep(10)

WEnd

GUIDelete()

EndFunc ;==>displayGUI

Func ExitGUI()

Exit

EndFunc ;==>ExitGUI

Func SpecialEvents()

Select

Case @GUI_CtrlId = $GUI_EVENT_CLOSE

Exit

Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE

Case @GUI_CtrlId = $GUI_EVENT_RESTORE

EndSelect

EndFunc ;==>SpecialEvents

Func RemapDrive()

SplashTextOn('Mapping Drives', 'Please wait....Mapping Drive to ' & $serversInINI[$x] & '.', 600, 300)

$driveletter = IniRead("Servers.ini", $serversInINI[$iCurrentTab + 1], "Drive", "ERROR")

$pathtomap = IniRead("Servers.ini", $serversInINI[$iCurrentTab + 1], "Path", "ERROR")

$Server = IniRead("Servers.ini", $serversInINI[$iCurrentTab + 1], "Server", "ERROR")

mapdrive($driveletter, $pathtomap, $Server)

SplashOff()

EndFunc ;==>RemapDrive

Func Tabs()

$tab = GUICtrlCreateTab(5, 5, 590, 800)

For $x = 1 To $serversInINI[0]

GUITab($serversInINI[$x])

Next

GUICtrlCreateTabItem("")

EndFunc ;==>Tabs

Func TabClick()

$iCurrentTab = _GUICtrlTabGetCurFocus($tab)

$x = $iCurrentTab + 1

clearvalues()

getINIInfo($serversInINI[$x])

LoadFields($serversInINI[$x])

ReadFields()

RefreshFields()

ChkforUpdates($serversInINI[$x])

GUICtrlSetData($UpdateServerbutton, "&Update")

EndFunc ;==>TabClick

Func GUITab($val)

GUICtrlCreateTabItem($val)

GUICtrlCreateLabel("Current INI on " & $val, 10, 40)

GUICtrlCreateLabel("ARGO - versionNumber", 10, 70)

GUICtrlCreateLabel("TDEFN - versionNumber", 10, 100)

GUICtrlCreateLabel("TDEFN - Date", 10, 130)

GUICtrlCreateLabel("TDEFN - Time", 10, 160)

GUICtrlCreateLabel("Alogent - versionNumber", 10, 190)

GUICtrlCreateLabel("Sort Pattern - versionNumber", 10, 220)

GUICtrlCreateLabel("Sort Pattern - Date", 10, 250)

GUICtrlCreateLabel("Sort Pattern - Time", 10, 280)

GUICtrlCreateLabel("Server Date - Date", 10, 310)

GUICtrlCreateLabel("Code Delivery Folder - version", 10, 340)

GUICtrlCreateLabel("Future INI on " & $val, 10, 400)

GUICtrlCreateLabel("ARGO - versionNumber", 10, 430)

GUICtrlCreateLabel("TDEFN - versionNumber", 10, 460)

GUICtrlCreateLabel("TDEFN - Date", 10, 490)

GUICtrlCreateLabel("TDEFN - Time", 10, 520)

GUICtrlCreateLabel("Alogent - versionNumber", 10, 550)

GUICtrlCreateLabel("Sort Pattern - versionNumber", 10, 580)

GUICtrlCreateLabel("Sort Pattern - Date", 10, 610)

GUICtrlCreateLabel("Sort Pattern - Time", 10, 640)

GUICtrlCreateLabel("Server Date - Date", 10, 670)

GUICtrlCreateLabel("Code Delivery Folder - version", 10, 700)

GUICtrlSetData($UpdateServerbutton, "&Update")

EndFunc ;==>GUITab

Func LoadFields($val)

$ArgoFieldCurrent = GUICtrlCreateInput("", 180, 70, 200, 20)

$TDEFNversionNumberFieldCurrent = GUICtrlCreateInput("", 180, 100, 200, 20)

$TDEFNDateFieldCurrent = GUICtrlCreateInput("", 180, 130, 200, 20)

$TDEFNTimeFieldCurrent = GUICtrlCreateInput("", 180, 160, 200, 20)

$AlogentversionNumberFieldCurrent = GUICtrlCreateInput("", 180, 190, 200, 20)

$SortPatternversionNumberFieldCurrent = GUICtrlCreateInput("", 180, 220, 200, 20)

$SortPatternDateFieldCurrent = GUICtrlCreateInput("", 180, 250, 200, 20)

$SortPatternTimeFieldCurrent = GUICtrlCreateInput("", 180, 280, 200, 20)

$ServerDateDateFieldCurrent = GUICtrlCreateInput("", 180, 310, 200, 20)

$CodeversionFieldCurrent = GUICtrlCreateInput("", 180, 340, 200, 20)

$ArgoFieldFuture = GUICtrlCreateInput("", 180, 430, 200, 20)

$TDEFNversionNumberFieldFuture = GUICtrlCreateInput("", 180, 460, 200, 20)

$TDEFNDateFieldFuture = GUICtrlCreateInput("", 180, 490, 200, 20)

$TDEFNTimeFieldFuture = GUICtrlCreateInput("", 180, 520, 200, 20)

$AlogentversionNumberFieldFuture = GUICtrlCreateInput("", 180, 550, 200, 20)

$SortPatternversionNumberFieldFuture = GUICtrlCreateInput("", 180, 580, 200, 20)

$SortPatternDateFieldFuture = GUICtrlCreateInput("", 180, 610, 200, 20)

$SortPatternTimeFieldFuture = GUICtrlCreateInput("", 180, 640, 200, 20)

$ServerDateDateFieldFuture = GUICtrlCreateInput("", 180, 670, 200, 20)

$CodeversionFieldFuture = GUICtrlCreateInput("", 180, 700, 200, 20)

$UpdateServerbutton = GUICtrlCreateButton("&Update", 100, 750, 200, 30)

EndFunc ;==>LoadFields

Func RefreshTab()

getINIInfo($serversInINI[$iCurrentTab + 1])

RefreshFields()

EndFunc ;==>RefreshTab

Func RefreshFields()

GUICtrlSetData($ArgoFieldCurrent, $ArgoServer)

GUICtrlSetData($TDEFNversionNumberFieldCurrent, $TDEFNversionNumberServer)

GUICtrlSetData($TDEFNDateFieldCurrent, $TDEFNDateServer)

GUICtrlSetData($TDEFNTimeFieldCurrent, $TDEFNTimeServer)

GUICtrlSetData($AlogentversionNumberFieldCurrent, $AlogentversionNumberServer)

GUICtrlSetData($SortPatternversionNumberFieldCurrent, $SortPatternversionNumberServer)

GUICtrlSetData($SortPatternDateFieldCurrent, $SortPatternDateServer)

GUICtrlSetData($SortPatternTimeFieldCurrent, $SortPatternTimeServer)

GUICtrlSetData($ServerDateDateFieldCurrent, $ServerDateDateServer)

GUICtrlSetData($CodeversionFieldCurrent, $CodeversionServer)

GUICtrlSetData($ArgoFieldFuture, $ArgoMaster)

GUICtrlSetData($TDEFNversionNumberFieldFuture, $TDEFNversionNumberMaster)

GUICtrlSetData($TDEFNDateFieldFuture, $TDEFNDateMaster)

GUICtrlSetData($TDEFNTimeFieldFuture, $TDEFNTimeMaster)

GUICtrlSetData($AlogentversionNumberFieldFuture, $AlogentversionNumberMaster)

GUICtrlSetData($SortPatternversionNumberFieldFuture, $SortPatternversionNumberMaster)

GUICtrlSetData($SortPatternDateFieldFuture, $SortPatternDateMaster)

GUICtrlSetData($SortPatternTimeFieldFuture, $SortPatternTimeMaster)

GUICtrlSetData($ServerDateDateFieldFuture, $ServerDateDateMaster)

GUICtrlSetData($CodeversionFieldFuture, $CodeversionMaster)

EndFunc ;==>RefreshFields

Func ReadFields()

$ArgoFieldCurrentNew = GUICtrlRead($ArgoFieldCurrent)

$TDEFNversionNumberFieldCurrentNew = GUICtrlRead($TDEFNversionNumberFieldCurrent)

$TDEFNDateFieldCurrentNew = GUICtrlRead($TDEFNDateFieldCurrent)

$TDEFNTimeFieldCurrentNew = GUICtrlRead($TDEFNTimeFieldCurrent)

$AlogentversionNumberFieldCurrentNew = GUICtrlRead($AlogentversionNumberFieldCurrent)

$SortPatternversionNumberFieldCurrentNew = GUICtrlRead($SortPatternversionNumberFieldCurrent)

$SortPatternDateFieldCurrentNew = GUICtrlRead($SortPatternDateFieldCurrent)

$SortPatternTimeFieldCurrentNew = GUICtrlRead($SortPatternTimeFieldCurrent)

$ServerDateDateFieldCurrentNew = GUICtrlRead($ServerDateDateFieldCurrent)

$CodeversionFieldCurrentNew = GUICtrlRead($CodeversionFieldCurrent)

$ArgoFieldFutureNew = GUICtrlRead($ArgoFieldFuture)

$TDEFNversionNumberFieldFutureNew = GUICtrlRead($TDEFNversionNumberFieldFuture)

$TDEFNDateFieldFutureNew = GUICtrlRead($TDEFNDateFieldFuture)

$TDEFNTimeFieldFutureNew = GUICtrlRead($TDEFNTimeFieldFuture)

$AlogentversionNumberFieldFutureNew = GUICtrlRead($AlogentversionNumberFieldFuture)

$SortPatternversionNumberFieldFutureNew = GUICtrlRead($SortPatternversionNumberFieldFuture)

$SortPatternDateFieldFutureNew = GUICtrlRead($SortPatternDateFieldFuture)

$SortPatternTimeFieldFutureNew = GUICtrlRead($SortPatternTimeFieldFuture)

$ServerDateDateFieldFutureNew = GUICtrlRead($ServerDateDateFieldFuture)

$CodeversionFieldFutureNew = GUICtrlRead($CodeversionFieldFuture)

EndFunc ;==>ReadFields

Func clearvalues()

$ArgoServer = ""

$ArgoMaster = ""

$TDEFNversionNumberServer = ""

$TDEFNversionNumberMaster = ""

$TDEFNDateServer = ""

$TDEFNDateMaster = ""

$TDEFNTimeServer = ""

$TDEFNTimeMaster = ""

$AlogentversionNumberServer = ""

$AlogentversionNumberMaster = ""

$SortPatternversionNumberServer = ""

$SortPatternversionNumberMaster = ""

$SortPatternDateServer = ""

$SortPatternDateMaster = ""

$SortPatternTimeServer = ""

$SortPatternTimeMaster = ""

$ServerDateDateServer = ""

$ServerDateDateMaster = ""

$CodeversionServer = ""

$CodeversionMaster = ""

EndFunc

Func ChkforUpdates($val)

$changednewer = ""

If $ArgoServer > $ArgoMaster Then

$changednewer = $changednewer & $val & " Argo version is newer than the Master INI on TECONSOLE " & @CRLF

EndIf

If $TDEFNversionNumberServer > $TDEFNversionNumberMaster Then

$changednewer = $changednewer & $val & " TDEFN version number is newer than the Master INI on TECONSOLE " & @CRLF

EndIf

If $TDEFNDateServer > $TDEFNDateMaster Then

$changednewer = $changednewer & $val & " TDEFN date is newer than the Master INI on TECONSOLE " & @CRLF

EndIf

If $TDEFNTimeServer > $TDEFNTimeMaster Then

$changednewer = $changednewer & $val & " TDEFN time is newer than the Master INI on TECONSOLE " & @CRLF

EndIf

If $AlogentversionNumberServer > $AlogentversionNumberMaster Then

$changednewer = $changednewer & $val & " Alogent version number is newer than the Master INI on TECONSOLE " & @CRLF

EndIf

If $SortPatternversionNumberServer > $SortPatternversionNumberMaster Then

$changednewer = $changednewer & $val & " Sort Pattern version number is newer than the Master INI on TECONSOLE " & @CRLF

EndIf

If $SortPatternDateServer > $SortPatternDateMaster Then

$changednewer = $changednewer & $val & " Sort Pattern date is newer than the Master INI on TECONSOLE " & @CRLF

EndIf

If $SortPatternTimeServer > $SortPatternTimeMaster Then

$changednewer = $changednewer & $val & " Sort Pattern time is newer than the Master INI on TECONSOLE " & @CRLF

EndIf

If $ServerDateDateServer > $ServerDateDateMaster Then

$changednewer = $changednewer & $val & " server date is newer than the Master INI on TECONSOLE " & @CRLF

EndIf

If $CodeversionServer > $CodeversionMaster Then

$changednewer = $changednewer & $val & " code version is newer than the Master INI on TECONSOLE " & @CRLF

EndIf

If $changednewer <> "" Then

MsgBox(0, "TILT", "Someone changed the " & $val & " server by hand and needs to be beat.")

$msgrtn = MsgBox(4, $val, $val & " ini out of sync with ini on teconsole: " & @CRLF & @CRLF & $changednewer & @CRLF & @CRLF & "Do you wish to update the Master INI on TECONSOLE now?")

If $msgrtn = 6 Then ; Checks for 'Yes'

;Update INI Master on TECONSOLE with current server's INI

$ArgoMaster = $ArgoServer

$TDEFNversionNumberMaster = $TDEFNversionNumberServer

$TDEFNDateMaster = $TDEFNDateServer

$TDEFNTimeMaster = $TDEFNTimeServer

$AlogentversionNumberMaster = $AlogentversionNumberServer

$SortPatternversionNumberMaster = $SortPatternversionNumberServer

$SortPatternDateMaster = $SortPatternDateServer

$SortPatternTimeMaster = $SortPatternTimeServer

$ServerDateDateMaster = $ServerDateDateServer

$CodeversionMaster = $CodeversionServer

WriteINI($val)

RefreshTab()

ElseIf $msgrtn = 7 Then ; Checks for 'No'

;Leave well enough alone

$logmsg = "User knows out of sync and we hope they will fix it themselves"

logger($logmsg)

EndIf

logger($changednewer)

EndIf

EndFunc ;==>ChkforUpdates

Func ChangedBeforeUpdate($val)

If ($ArgoFieldCurrentNew <> $ArgoFieldCurrent) Or _

($TDEFNversionNumberFieldCurrentNew <> $TDEFNversionNumberFieldCurrent) Or _

($TDEFNDateFieldCurrentNew <> $TDEFNDateFieldCurrent) Or _

($TDEFNTimeFieldCurrentNew <> $TDEFNTimeFieldCurrent) Or _

($AlogentversionNumberFieldCurrentNew <> $AlogentversionNumberFieldCurrent) Or _

($SortPatternversionNumberFieldCurrentNew <> $SortPatternversionNumberFieldCurrent) Or _

($SortPatternDateFieldCurrentNew <> $ServerDateDateFieldCurrent) Or _

($SortPatternTimeFieldCurrentNew <> $SortPatternTimeFieldCurrent) Or _

($ServerDateDateMaster <> $ServerDateDateServer) Or _

($CodeversionFieldCurrentNew <> $CodeversionFieldCurrent) Then

MsgBox(0, "TILT", "You should not change have to change anything on Current. This will be ignored and continue to update the TECONSOLE Server.")

EndIf

$changed = ""

If $ArgoServer <> $ArgoMaster Then

$changed = $changed & $val & " Argo version has been changed and will be pushed to " & $val & " tonight " & @CRLF

EndIf

If $TDEFNversionNumberServer <> $TDEFNversionNumberMaster Then

$changed = $changed & $val & " TDEFN version number has been changed and will be pushed to " & $val & " tonight " & @CRLF

EndIf

If $TDEFNDateServer <> $TDEFNDateMaster Then

$changed = $changed & $val & " TDEFN date has been changed and will be pushed to " & $val & " tonight " & @CRLF

EndIf

If $TDEFNTimeServer <> $TDEFNTimeMaster Then

$changed = $changed & $val & " TDEFN time has been changed and will be pushed to " & $val & " tonight " & @CRLF

EndIf

If $AlogentversionNumberServer <> $AlogentversionNumberMaster Then

$changed = $changed & $val & " Alogent version number has been changed and will be pushed to " & $val & " tonight " & @CRLF

EndIf

If $SortPatternversionNumberServer <> $SortPatternversionNumberMaster Then

$changed = $changed & $val & " Sort Pattern version number has been changed and will be pushed to " & $val & " tonight " & @CRLF

EndIf

If $SortPatternDateServer <> $SortPatternDateMaster Then

$changed = $changed & $val & " Sort Pattern date has been changed and will be pushed to " & $val & " tonight " & @CRLF

EndIf

If $SortPatternTimeServer <> $SortPatternTimeMaster Then

$changed = $changed & $val & " Sort Pattern time has been changed and will be pushed to " & $val & " tonight " & @CRLF

EndIf

If $ServerDateDateServer <> $ServerDateDateMaster Then

$changed = $changed & $val & " server date has been changed and will be pushed to " & $val & " tonight " & @CRLF

EndIf

If $CodeversionServer <> $CodeversionMaster Then

$changed = $changed & $val & " code version has been changed and will be pushed to " & $val & " tonight " & @CRLF

EndIf

If $changed <> "" Then

MsgBox(0, $val, $val & " ini out of sync with ini on teconsole: " & @CRLF & @CRLF & $changed)

logger($changed)

EndIf

EndFunc ;==>ChangedBeforeUpdate

Func getINIInfo($val)

$driveletter = IniRead("Servers.ini", $val, "Drive", "ERROR")

getArgoVersion($val, $driveletter) ;Gets ARGO system Code Version #'s

getTDEFNVersion($val, $driveletter) ;Gets TE TDEFN File Version #'s

getTDEFNDate($val, $driveletter) ;Gets TE TDEFN File Dates

getTDEFNTime($val, $driveletter) ;Gets TE TDEFN File Times

getAlogentVersion($val, $driveletter) ;Gets Alogent System Code Version #'s

getSortPatternVersion($val, $driveletter) ;Gets Sort Pattern Version #'s

getSortPatternDate($val, $driveletter) ;Gets Sort Pattern Dates

getSortPatternTime($val, $driveletter) ;Gets Sort Pattern Times

getServerDate($val, $driveletter) ;Gets Server Date

getCodeversion($val, $driveletter) ;Gets Code Version

EndFunc ;==>getINIInfo

Func getArgoVersion($val, $driveletter)

$ArgoServer = IniRead($driveletter & '\Sierra Xpedite\Company\Update\TellerExpressUpdate.ini', 'ARGO', 'versionNumber', "ERROR")

$ArgoMaster = IniRead($masterdriveletter & '\CodeDelivery\GUICodeLoader\' & $val & '\TellerExpressUpdate.ini', 'ARGO', 'versionNumber', "ERROR")

;~ $logmsg = "Argo Server Version Number is: " & $ArgoServer

;~ logger($logmsg)

;~ $logmsg = "Argo Master Version Number is: " & $ArgoMaster

;~ logger($logmsg)

EndFunc ;==>getArgoVersion

Func getTDEFNVersion($val, $driveletter)

$TDEFNversionNumberServer = IniRead($driveletter & '\Sierra Xpedite\Company\Update\TellerExpressUpdate.ini', 'TDEFN', 'versionNumber', "ERROR")

$TDEFNversionNumberMaster = IniRead($masterdriveletter & '\CodeDelivery\GUICodeLoader\' & $val & '\TellerExpressUpdate.ini', 'TDEFN', 'versionNumber', "ERROR")

;~ $logmsg = "TDEFN Server Version Number is: " & $TDEFNversionNumberServer

;~ logger($logmsg)

;~ $logmsg = "TDEFN Master Version Number is: " & $TDEFNversionNumberMaster

;~ logger($logmsg)

EndFunc ;==>getTDEFNVersion

Func getTDEFNDate($val, $driveletter)

$TDEFNDateServer = IniRead($driveletter & '\Sierra Xpedite\Company\Update\TellerExpressUpdate.ini', 'TDEFN', 'Date', "ERROR")

$TDEFNDateMaster = IniRead($masterdriveletter & '\CodeDelivery\GUICodeLoader\' & $val & '\TellerExpressUpdate.ini', 'TDEFN', 'Date', "ERROR")

;~ $logmsg = "TDEFN Server Date is: " & $TDEFNDateServer

;~ logger($logmsg)

;~ $logmsg = "TDEFN Master Date is: " & $TDEFNDateMaster

;~ logger($logmsg)

EndFunc ;==>getTDEFNDate

Func getTDEFNTime($val, $driveletter)

$TDEFNTimeServer = IniRead($driveletter & '\Sierra Xpedite\Company\Update\TellerExpressUpdate.ini', 'TDEFN', 'Time', "ERROR")

$TDEFNTimeMaster = IniRead($masterdriveletter & '\CodeDelivery\GUICodeLoader\' & $val & '\TellerExpressUpdate.ini', 'TDEFN', 'Time', "ERROR")

;~ $logmsg = "TDEFN Server Time is: " & $TDEFNTimeServer

;~ logger($logmsg)

;~ $logmsg = "TDEFN Master Time is: " & $TDEFNTimeMaster

;~ logger($logmsg)

EndFunc ;==>getTDEFNTime

Func getAlogentVersion($val, $driveletter)

$AlogentversionNumberServer = IniRead($driveletter & '\Sierra Xpedite\Company\Update\TellerExpressUpdate.ini', 'Alogent', 'versionNumber', "ERROR")

$AlogentversionNumberMaster = IniRead($masterdriveletter & '\CodeDelivery\GUICodeLoader\' & $val & '\TellerExpressUpdate.ini', 'Alogent', 'versionNumber', "ERROR")

;~ $logmsg = "Alogent Server Version Number is: " & $AlogentversionNumberServer

;~ logger($logmsg)

;~ $logmsg = "Alogent Master Version Number is: " & $AlogentversionNumberMaster

;~ logger($logmsg)

EndFunc ;==>getAlogentVersion

Func getSortPatternVersion($val, $driveletter)

$SortPatternversionNumberServer = IniRead($driveletter & '\Sierra Xpedite\Company\Update\TellerExpressUpdate.ini', 'Sort Pattern', 'versionNumber', "ERROR")

$SortPatternversionNumberMaster = IniRead($masterdriveletter & '\CodeDelivery\GUICodeLoader\' & $val & '\TellerExpressUpdate.ini', 'Sort Pattern', 'versionNumber', "ERROR")

;~ $logmsg = "Sort Pattern Server Version Number is: " & $SortPatternversionNumberServer

;~ logger($logmsg)

;~ $logmsg = "Sort Pattern Master Version Number is: " & $SortPatternversionNumberMaster

;~ logger($logmsg)

EndFunc ;==>getSortPatternVersion

Func getSortPatternDate($val, $driveletter)

$SortPatternDateServer = IniRead($driveletter & '\Sierra Xpedite\Company\Update\TellerExpressUpdate.ini', 'Sort Pattern', 'Date', "ERROR")

$SortPatternDateMaster = IniRead($masterdriveletter & '\CodeDelivery\GUICodeLoader\' & $val & '\TellerExpressUpdate.ini', 'Sort Pattern', 'Date', "ERROR")

;~ $logmsg = "Sort Pattern Server Date is: " & $SortPatternDateServer

;~ logger($logmsg)

;~ $logmsg = "Sort Pattern Master Date is: " & $SortPatternDateMaster

;~ logger($logmsg)

EndFunc ;==>getSortPatternDate

Func getSortPatternTime($val, $driveletter)

$SortPatternTimeServer = IniRead($driveletter & '\Sierra Xpedite\Company\Update\TellerExpressUpdate.ini', 'sort Pattern', 'Time', "ERROR")

$SortPatternTimeMaster = IniRead($masterdriveletter & '\CodeDelivery\GUICodeLoader\' & $val & '\TellerExpressUpdate.ini', 'sort Pattern', 'Time', "ERROR")

;~ $logmsg = "Sort Pattern Server Time is: " & $SortPatternTimeServer

;~ logger($logmsg)

;~ $logmsg = "Sort Pattern Master Time is: " & $SortPatternTimeMaster

;~ logger($logmsg)

EndFunc ;==>getSortPatternTime

Func getServerDate($val, $driveletter)

$ServerDateDateServer = IniRead($driveletter & '\Sierra Xpedite\Company\Update\TellerExpressUpdate.ini', 'Server Date', 'Date', "ERROR")

$ServerDateDateMaster = IniRead($masterdriveletter & '\CodeDelivery\GUICodeLoader\' & $val & '\TellerExpressUpdate.ini', 'Server Date', 'Date', "ERROR")

;~ $logmsg = "Sort Pattern Server Date is: " & $SortPatternDateServer

;~ logger($logmsg)

;~ $logmsg = "Sort Pattern Master Date is: " & $SortPatternDateMaster

;~ logger($logmsg)

EndFunc ;==>getServerDate

Func getCodeversion($val, $driveletter)

$CodeversionServer = IniRead($driveletter & '\ServerConfig\ServerConfig.ini', '', 'Version', "ERROR")

$CodeversionMaster = IniRead($masterdriveletter & '\CodeDelivery\GUICodeLoader\' & $val & '\ServerConfig.ini', '', 'Version', "ERROR")

;~ $logmsg = "Code Server Version Number is: " & $CodeversionServer

;~ logger($logmsg)

;~ $logmsg = "Code Master Version Number is: " & $CodeversionMaster

;~ logger($logmsg)

EndFunc ;==>getCodeversion

Func UpdateServer()

$iCurrentTab = _GUICtrlTabGetCurFocus($tab)

$x = $iCurrentTab + 1

$Server = $serversInINI[$x]

ChangedBeforeUpdate($Server)

WriteINI($Server)

RefreshTab()

GUICtrlSetData($UpdateServerbutton, "&Update")

EndFunc ;==>UpdateServer

Func WriteINI($val)

IniWrite($masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\ServerConfig.ini", "", "Version", $CodeversionMaster)

$logmsg = "INI write: " & $masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\ServerConfig.ini Version" & $CodeversionMaster

logger($logmsg)

IniWrite($masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini", "ARGO", "versionNumber", $ArgoMaster)

$logmsg = "INI write: " & $masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini ARGO versionNumber" & $ArgoMaster

logger($logmsg)

IniWrite($masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini", "TDEFN", "versionNumber", $TDEFNversionNumberMaster)

$logmsg = "INI write: " & $masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini TDEFN versionNumber" & $TDEFNversionNumberMaster

logger($logmsg)

IniWrite($masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini", "TDEFN", "Date", $TDEFNDateMaster)

$logmsg = "INI write: " & $masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini TDEFN Date" & $TDEFNDateMaster

logger($logmsg)

IniWrite($masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini", "TDEFN", "Time", $TDEFNTimeMaster)

$logmsg = "INI write: " & $masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini TDEFN Time" & $TDEFNTimeMaster

logger($logmsg)

IniWrite($masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini", "Alogent", "versionNumber", $AlogentversionNumberMaster)

$logmsg = "INI write: " & $masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini Alogent versionNumber" & $AlogentversionNumberMaster

logger($logmsg)

IniWrite($masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini", "Sort Pattern", "versionNumber", $SortPatternversionNumberMaster)

$logmsg = "INI write: " & $masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini Sort Pattern versionNumber" & $SortPatternversionNumberMaster

logger($logmsg)

IniWrite($masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini", "Sort Pattern", "Date", $SortPatternDateMaster)

$logmsg = "INI write: " & $masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini Sort Pattern Date" & $SortPatternDateMaster

logger($logmsg)

IniWrite($masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini", "Sort Pattern", "Time", $SortPatternTimeMaster)

$logmsg = "INI write: " & $masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini Sort Pattern Time" & $SortPatternTimeMaster

logger($logmsg)

IniWrite($masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini", "Server Date", "Date", $ServerDateDateMaster)

$logmsg = "INI write: " & $masterdriveletter & "\CodeDelivery\GUICodeLoader\" & $val & "\TellerExpressUpdate.ini Server Date Date" & $ServerDateDateMaster

logger($logmsg)

EndFunc ;==>WriteINI

Func logger($logmsg)

$log = FileOpen($masterdriveletter & "\CodeDelivery\GUICodeLoader\Logs\GuiCodeLoader.log", 1)

getTimeStamp()

FileWriteLine($log, $timestamp & " " & $logmsg)

FileClose($log)

EndFunc ;==>logger

Func CompleteLog()

RunWait("Notepad.exe " & $masterdriveletter & "\CodeDelivery\GUICodeLoader\Logs\GuiCodeLoader.log", "", @SW_MAXIMIZE)

Sleep(3000)

WinWaitClose("GuiCodeLoader.log - Notepad")

EndFunc ;==>CompleteLog

Func getTimeStamp()

$month = @MON

$day = @MDAY

$year = @YEAR

$hour = @HOUR

$min = @MIN

$sec = @SEC

$timestamp = $year & $month & $day & " " & $hour & ":" & $min & ":" & $sec

$time = $hour & $min

EndFunc ;==>getTimeStamp

Func CheckSSO($strUser, $strPW)

$strCred = "cn=" & $strUser & ",ou=people,dc=company,dc=net"

$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; Install a custom error handler

$cn = ObjGet("LDAP:")

$iSecurity = $ADS_SECURE_AUTHENTICATION + $ADS_SERVER_BIND

$strSvrPort = $PORT_CLEARTEXT

$strSvr = "www.company.net"

$strLDAP = "LDAP://" & $strSvr & $strSvrPort & "/cn=" & $strUser & ",ou=people,dc=company,dc=net"

Dim $usrArray[4]

$usrArray[0] = "user1"

$usrArray[1] = "user2"

$usrArray[2] = "user3"

$usrArray[3] = "user4"

_ArraySort($usrArray)

$iKeyIndex = _ArrayBinarySearch($usrArray, $strUser)

If @error Then

MsgBox(0, "ERROR", "Sorry you do not have rights to run this script!")

$logmsg = "Chop off the finger of the owner of SID: " & $UserID

logger($logmsg)

Exit

Else

$iDobj = $cn.OpenDSObject ($strLDAP, $strCred, $strPW, $iSecurity)

If @error <> 0 Then

MsgBox(0, "ERROR", $oMyError.windescription)

Exit

EndIf

EndIf

EndFunc ;==>CheckSSO

Func MyErrFunc()

If IsObj($oMyError) Then

$HexNumber = Hex($oMyError.number, 8)

;~ Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _

;~ "Number is: " & $HexNumber & @CRLF & _

;~ "Windescription is: " & $oMyError.windescription )

SetError($HexNumber) ; something to check for when this function returns

EndIf

Return 0

EndFunc ;==>MyErrFunc

Func logon()

; Check for Valid user to run this program!

$counter = 1

$logonfrm = GUICreate("Logon", 275, 150)

GUISetOnEvent($GUI_EVENT_CLOSE, "LogonSpecialEvents")

GUISetOnEvent($GUI_EVENT_MINIMIZE, "LogonSpecialEvents")

GUISetOnEvent($GUI_EVENT_RESTORE, "LogonSpecialEvents")

GUICtrlCreateLabel("Enter your SID", 10, 20)

$UserIDField = GUICtrlCreateInput("", 150, 20, 100, 20)

GUICtrlCreateLabel("Enter your password", 10, 60)

$PasswordField = GUICtrlCreateInput("", 150, 60, 100, 20, $ES_PASSWORD)

$button1 = GUICtrlCreateButton("&OK", 45, 100, 80, 30, $BS_DEFPUSHBUTTON)

$button2 = GUICtrlCreateButton("&Cancel", 160, 100, 80, 30)

GUISetState(@SW_SHOW)

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

If $msg = $button2 Then Exit

If $msg = $button1 Then

$UserID = GUICtrlRead($UserIDField)

$Password = GUICtrlRead($PasswordField)

$logmsg = "User " & $UserID & " is running GUICodeLoader.exe"

logger($logmsg)

CheckSSO($UserID, $Password)

GUIDelete($logonfrm)

ExitLoop

EndIf

WEnd

EndFunc ;==>logon

Func LogonSpecialEvents()

Select

Case @GUI_CtrlId = $GUI_EVENT_CLOSE

Exit

Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE

Case @GUI_CtrlId = $GUI_EVENT_RESTORE

EndSelect

EndFunc ;==>LogonSpecialEvents

Share this post


Link to post
Share on other sites



Script is too long to go through, can you make a short reproducer?


IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

Here is a trimmed down version of the code. To reproduce issue you have to click second tab then tab through each of the fields. It will pull first tab's info then go back to second tab info.

In folder where you put this code add a file server.ini file and two folders ist1 and ist2 the files are below.

server.ini file

[iST1]

[iST2]

IST1 & IST2 folders have same two files in it with different numbers

IST2 Folder

ServerConfig.ini

[]

version=1.1 A 01/01/2007

TellerExpressUpdate.ini

[ARGO]

versionNumber=1.1

[TDEFN]

versionNumber=1.1

Date=01/01/2007

Time=06:00AM

[Alogent]

versionNumber=1.1

[sort Pattern]

versionNumber=1.1

Date=01/01/2007

Time=06:00AM

[server Date]

Date=01/01/2007

IST2 Folder

ServerConfig.ini

[]

version=2.2 A 02/02/2007

TellerExpressUpdate.ini

[ARGO]

versionNumber=2.2

[TDEFN]

versionNumber=2.2

Date=02/02/2007

Time=06:00AM

[Alogent]

versionNumber=2.2

[sort Pattern]

versionNumber=2.2

Date=02/02/2007

Time=06:00AM

[server Date]

Date=02/02/2007

CODE

#include <guitab.au3>

#include <GuiConstants.au3>

#include <array.au3>

#include <file.au3>

Dim $tab, $UpdateServerbutton, $serversInINI, $ArgoFieldFuture, $TDEFNversionNumberFieldFuture, $TDEFNDateFieldFuture, $TDEFNTimeFieldFuture, $AlogentversionNumberFieldFuture, _

$SortPatternversionNumberFieldFuture, $SortPatternDateFieldFuture, $SortPatternTimeFieldFuture, $ServerDateDateFieldFuture, $CodeversionFieldFuture, _

$ArgoMaster, $TDEFNversionNumberMaster, $TDEFNDateMaster, $TDEFNTimeMaster, _

$AlogentversionNumberMaster, $SortPatternversionNumberMaster, $SortPatternDateMaster, $SortPatternTimeMaster, $ServerDateDateMaster, $CodeversionMaster, _

$SortPatternversionNumberMaster, $masterdriveletter

;Read Servers INI

$serversInINI = IniReadSectionNames("Servers.ini")

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

displayGUI()

Exit

Func displayGUI()

GUICreate("Code Loader GUI", 600, 830)

GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")

GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")

GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")

Tabs()

TabClick()

GUISetState(@SW_SHOW)

GUICtrlSetOnEvent($tab, "TabClick")

GUICtrlSetOnEvent($UpdateServerbutton, "UpdateServer")

While 1

Sleep(10000)

WEnd

GUIDelete()

EndFunc ;==>displayGUI

Func ExitGUI()

Exit

EndFunc ;==>ExitGUI

Func SpecialEvents()

Select

Case @GUI_CtrlId = $GUI_EVENT_CLOSE

Exit

Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE

Case @GUI_CtrlId = $GUI_EVENT_RESTORE

EndSelect

EndFunc ;==>SpecialEvents

Func Tabs()

$tab = GUICtrlCreateTab(5, 5, 590, 800)

For $x = 1 To $serversInINI[0]

GUITab($serversInINI[$x])

Next

GUICtrlCreateTabItem("")

EndFunc ;==>Tabs

Func GUITab($val)

GUICtrlCreateTabItem($val)

GUICtrlCreateLabel("Future INI on " & $val, 10, 400)

GUICtrlCreateLabel("ARGO - versionNumber", 10, 430)

GUICtrlCreateLabel("TDEFN - versionNumber", 10, 460)

GUICtrlCreateLabel("TDEFN - Date", 10, 490)

GUICtrlCreateLabel("TDEFN - Time", 10, 520)

GUICtrlCreateLabel("Alogent - versionNumber", 10, 550)

GUICtrlCreateLabel("Sort Pattern - versionNumber", 10, 580)

GUICtrlCreateLabel("Sort Pattern - Date", 10, 610)

GUICtrlCreateLabel("Sort Pattern - Time", 10, 640)

GUICtrlCreateLabel("Server Date - Date", 10, 670)

GUICtrlCreateLabel("Code Delivery Folder - version", 10, 700)

GUICtrlSetData($UpdateServerbutton, "&Update")

EndFunc ;==>GUITab

Func TabClick()

LoadFields()

$iCurrentTab = _GUICtrlTabGetCurFocus($tab)

$x = $iCurrentTab + 1

getINIInfo($serversInINI[$x])

ReadFields()

RefreshTab()

GUICtrlSetData($UpdateServerbutton, "&Update")

EndFunc ;==>TabClick

Func LoadFields()

$ArgoFieldFuture = GUICtrlCreateInput("", 180, 430, 200, 20)

$TDEFNversionNumberFieldFuture = GUICtrlCreateInput("", 180, 460, 200, 20)

$TDEFNDateFieldFuture = GUICtrlCreateInput("", 180, 490, 200, 20)

$TDEFNTimeFieldFuture = GUICtrlCreateInput("", 180, 520, 200, 20)

$AlogentversionNumberFieldFuture = GUICtrlCreateInput("", 180, 550, 200, 20)

$SortPatternversionNumberFieldFuture = GUICtrlCreateInput("", 180, 580, 200, 20)

$SortPatternDateFieldFuture = GUICtrlCreateInput("", 180, 610, 200, 20)

$SortPatternTimeFieldFuture = GUICtrlCreateInput("", 180, 640, 200, 20)

$ServerDateDateFieldFuture = GUICtrlCreateInput("", 180, 670, 200, 20)

$CodeversionFieldFuture = GUICtrlCreateInput("", 180, 700, 200, 20)

$UpdateServerbutton = GUICtrlCreateButton("&Update", 100, 750, 200, 30)

EndFunc ;==>LoadFields

Func ReadFields()

$ArgoFieldFutureNew = GUICtrlRead($ArgoFieldFuture)

$TDEFNversionNumberFieldFutureNew = GUICtrlRead($TDEFNversionNumberFieldFuture)

$TDEFNDateFieldFutureNew = GUICtrlRead($TDEFNDateFieldFuture)

$TDEFNTimeFieldFutureNew = GUICtrlRead($TDEFNTimeFieldFuture)

$AlogentversionNumberFieldFutureNew = GUICtrlRead($AlogentversionNumberFieldFuture)

$SortPatternversionNumberFieldFutureNew = GUICtrlRead($SortPatternversionNumberFieldFuture)

$SortPatternDateFieldFutureNew = GUICtrlRead($SortPatternDateFieldFuture)

$SortPatternTimeFieldFutureNew = GUICtrlRead($SortPatternTimeFieldFuture)

$ServerDateDateFieldFutureNew = GUICtrlRead($ServerDateDateFieldFuture)

$CodeversionFieldFutureNew = GUICtrlRead($CodeversionFieldFuture)

EndFunc ;==>ReadFields

Func RefreshTab()

$iCurrentTab = _GUICtrlTabGetCurFocus($tab)

$x = $iCurrentTab + 1

getINIInfo($serversInINI[$x])

RefreshFields()

EndFunc ;==>RefreshTab

Func RefreshFields()

GUICtrlSetData($ArgoFieldFuture, $ArgoMaster)

GUICtrlSetData($TDEFNversionNumberFieldFuture, $TDEFNversionNumberMaster)

GUICtrlSetData($TDEFNDateFieldFuture, $TDEFNDateMaster)

GUICtrlSetData($TDEFNTimeFieldFuture, $TDEFNTimeMaster)

GUICtrlSetData($AlogentversionNumberFieldFuture, $AlogentversionNumberMaster)

GUICtrlSetData($SortPatternversionNumberFieldFuture, $SortPatternversionNumberMaster)

GUICtrlSetData($SortPatternDateFieldFuture, $SortPatternDateMaster)

GUICtrlSetData($SortPatternTimeFieldFuture, $SortPatternTimeMaster)

GUICtrlSetData($ServerDateDateFieldFuture, $ServerDateDateMaster)

GUICtrlSetData($CodeversionFieldFuture, $CodeversionMaster)

EndFunc ;==>RefreshFields

Func getINIInfo($val)

$ArgoMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'ARGO', 'versionNumber', "ERROR")

$TDEFNversionNumberMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'TDEFN', 'versionNumber', "ERROR")

$TDEFNDateMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'TDEFN', 'Date', "ERROR")

$TDEFNTimeMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'TDEFN', 'Time', "ERROR")

$AlogentversionNumberMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'Alogent', 'versionNumber', "ERROR")

$SortPatternversionNumberMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'Sort Pattern', 'versionNumber', "ERROR")

$SortPatternDateMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'Sort Pattern', 'Date', "ERROR")

$SortPatternTimeMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'sort Pattern', 'Time', "ERROR")

$ServerDateDateMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'Server Date', 'Date', "ERROR")

$CodeversionMaster = IniRead('.\' & $val & '\ServerConfig.ini', '', 'Version', "ERROR")

EndFunc ;==>getINIInfo

Func UpdateServer()

$iCurrentTab = _GUICtrlTabGetCurFocus($tab)

$x = $iCurrentTab + 1

$Server = $serversInINI[$x]

MsgBox(0, "Update", "I clicked update on Server " & $Server)

EndFunc ;==>UpdateServer

Share this post


Link to post
Share on other sites

You aren't ever writing anything to your .ini's, so they just keep loading old info. I'm not sure I understand what you're trying to accomplish/what the exact issue i. This is still not a short reproducer, you should be able to make something under 100 lines that reproduces the situation. And IMO, creating files and folders and copying/pasting info isn't fun. When I need help with something, I try to make it as easy as possible for someone to help me.


IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

I'm sorry I cut the code down as much as possible. If you take the 157 lines of code well i could subtract all the comments as well as all the nice extra blank lines between function and get it down to almost 100 lines of code. I'm sorry but copy&paste isn't rocket science. I cut out a lot of the unneeded code but when you make tabs and fill them with a gui you will get several lines to do what is needed. I hope someone else will take a few minutes to help me out.

For everyone else but mikehunt114

The entire proble is that when you tab through the fields on the second tab the values are reloaded on focus to a previous tab or all tabs that you have clicked on.

If someone could take a few minutes and help me with this issue I would appricate it.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I'm sorry I cut the code down as much as possible. If you take the 157 lines of code well i could subtract all the comments as well as all the nice extra blank lines between function and get it down to almost 100 lines of code. I'm sorry but copy&paste isn't rocket science. I cut out a lot of the unneeded code but when you make tabs and fill them with a gui you will get several lines to do what is needed. I hope someone else will take a few minutes to help me out.

For everyone else but mikehunt114

The entire proble is that when you tab through the fields on the second tab the values are reloaded on focus to a previous tab or all tabs that you have clicked on.

If someone could take a few minutes and help me with this issue I would appricate it.

I think you should take notice of what mikehunt114 says. It's a lot of code to plough through and after that there is no certainty that you will be able to see the problem. In any case, cutting down the script to isolate the problem can be a good way of finding the problem yourself.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I understand this and the script that was trimmed down to only what was needed. I did however figure out the issue. Here is completed working code. This code works great! I was told once that making tabs on the fly by reading from a ini file was a hack or not a smart thing to do. But when you go from trying to do this on one or two servers to 5 over night would you want to rewrite the code?

Oh Mike I would like to apologize to you. All you were doing was trying to help me out. I'm sorry for my last post. Please forgive me for being rude or anyother word you feel like using for my comments.

CODE

#include <guitab.au3>

#include <GuiConstants.au3>

#include <array.au3>

#include <file.au3>

Global $val

Dim $tab, $UpdateServerbutton, $serversInINI, $ArgoFieldFuture, $TDEFNversionNumberFieldFuture, $TDEFNDateFieldFuture, $TDEFNTimeFieldFuture, $AlogentversionNumberFieldFuture, _

$SortPatternversionNumberFieldFuture, $SortPatternDateFieldFuture, $SortPatternTimeFieldFuture, $ServerDateDateFieldFuture, $CodeversionFieldFuture, _

$ArgoMaster, $TDEFNversionNumberMaster, $TDEFNDateMaster, $TDEFNTimeMaster, _

$AlogentversionNumberMaster, $SortPatternversionNumberMaster, $SortPatternDateMaster, $SortPatternTimeMaster, $ServerDateDateMaster, $CodeversionMaster, _

$SortPatternversionNumberMaster, $masterdriveletter

$serversInINI = IniReadSectionNames("Servers.ini")

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

displayGUI()

Exit

Func displayGUI()

GUICreate("Code Loader GUI", 600, 830)

GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")

GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")

GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")

Tabs()

GUISetState(@SW_SHOW)

GUICtrlSetOnEvent($tab, "TabClick")

GUICtrlSetOnEvent($UpdateServerbutton, "UpdateServer")

While 1

Sleep(10000)

WEnd

GUIDelete()

EndFunc ;==>displayGUI

Func ExitGUI()

Exit

EndFunc ;==>ExitGUI

Func SpecialEvents()

Select

Case @GUI_CtrlId = $GUI_EVENT_CLOSE

Exit

Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE

Case @GUI_CtrlId = $GUI_EVENT_RESTORE

EndSelect

EndFunc ;==>SpecialEvents

Func Tabs()

$tab = GUICtrlCreateTab(5, 5, 590, 800)

For $x = 1 To $serversInINI[0]

GUITab($serversInINI[$x])

Next

GUICtrlCreateTabItem("")

LoadFields()

$iCurrentTab = _GUICtrlTabGetCurFocus($tab)

$x = $iCurrentTab + 1

$val = $serversInINI[$x]

getINIInfo($val)

RefreshTab()

EndFunc ;==>Tabs

Func GUITab($val)

GUICtrlCreateTabItem($val)

GUICtrlCreateLabel("Future INI on " & $val, 10, 400)

GUICtrlCreateLabel("ARGO - versionNumber", 10, 430)

GUICtrlCreateLabel("TDEFN - versionNumber", 10, 460)

GUICtrlCreateLabel("TDEFN - Date", 10, 490)

GUICtrlCreateLabel("TDEFN - Time", 10, 520)

GUICtrlCreateLabel("Alogent - versionNumber", 10, 550)

GUICtrlCreateLabel("Sort Pattern - versionNumber", 10, 580)

GUICtrlCreateLabel("Sort Pattern - Date", 10, 610)

GUICtrlCreateLabel("Sort Pattern - Time", 10, 640)

GUICtrlCreateLabel("Server Date - Date", 10, 670)

GUICtrlCreateLabel("Code Delivery Folder - version", 10, 700)

GUICtrlSetData($UpdateServerbutton, "&Update")

EndFunc ;==>GUITab

Func TabClick()

;LoadFields()

$val = ""

$iCurrentTab = _GUICtrlTabGetCurFocus($tab)

$x = $iCurrentTab + 1

$val = $serversInINI[$x]

getINIInfo($val)

ReadFields()

RefreshTab()

GUICtrlSetData($UpdateServerbutton, "&Update")

EndFunc ;==>TabClick

Func LoadFields()

$ArgoFieldFuture = GUICtrlCreateInput("", 180, 430, 200, 20)

$TDEFNversionNumberFieldFuture = GUICtrlCreateInput("", 180, 460, 200, 20)

$TDEFNDateFieldFuture = GUICtrlCreateInput("", 180, 490, 200, 20)

$TDEFNTimeFieldFuture = GUICtrlCreateInput("", 180, 520, 200, 20)

$AlogentversionNumberFieldFuture = GUICtrlCreateInput("", 180, 550, 200, 20)

$SortPatternversionNumberFieldFuture = GUICtrlCreateInput("", 180, 580, 200, 20)

$SortPatternDateFieldFuture = GUICtrlCreateInput("", 180, 610, 200, 20)

$SortPatternTimeFieldFuture = GUICtrlCreateInput("", 180, 640, 200, 20)

$ServerDateDateFieldFuture = GUICtrlCreateInput("", 180, 670, 200, 20)

$CodeversionFieldFuture = GUICtrlCreateInput("", 180, 700, 200, 20)

$UpdateServerbutton = GUICtrlCreateButton("&Update", 100, 750, 200, 30)

EndFunc ;==>LoadFields

Func ReadFields()

$ArgoFieldFutureNew = GUICtrlRead($ArgoFieldFuture)

$TDEFNversionNumberFieldFutureNew = GUICtrlRead($TDEFNversionNumberFieldFuture)

$TDEFNDateFieldFutureNew = GUICtrlRead($TDEFNDateFieldFuture)

$TDEFNTimeFieldFutureNew = GUICtrlRead($TDEFNTimeFieldFuture)

$AlogentversionNumberFieldFutureNew = GUICtrlRead($AlogentversionNumberFieldFuture)

$SortPatternversionNumberFieldFutureNew = GUICtrlRead($SortPatternversionNumberFieldFuture)

$SortPatternDateFieldFutureNew = GUICtrlRead($SortPatternDateFieldFuture)

$SortPatternTimeFieldFutureNew = GUICtrlRead($SortPatternTimeFieldFuture)

$ServerDateDateFieldFutureNew = GUICtrlRead($ServerDateDateFieldFuture)

$CodeversionFieldFutureNew = GUICtrlRead($CodeversionFieldFuture)

EndFunc ;==>ReadFields

Func RefreshTab()

getINIInfo($val)

RefreshFields()

EndFunc ;==>RefreshTab

Func RefreshFields()

GUICtrlSetData($ArgoFieldFuture, $ArgoMaster)

GUICtrlSetData($TDEFNversionNumberFieldFuture, $TDEFNversionNumberMaster)

GUICtrlSetData($TDEFNDateFieldFuture, $TDEFNDateMaster)

GUICtrlSetData($TDEFNTimeFieldFuture, $TDEFNTimeMaster)

GUICtrlSetData($AlogentversionNumberFieldFuture, $AlogentversionNumberMaster)

GUICtrlSetData($SortPatternversionNumberFieldFuture, $SortPatternversionNumberMaster)

GUICtrlSetData($SortPatternDateFieldFuture, $SortPatternDateMaster)

GUICtrlSetData($SortPatternTimeFieldFuture, $SortPatternTimeMaster)

GUICtrlSetData($ServerDateDateFieldFuture, $ServerDateDateMaster)

GUICtrlSetData($CodeversionFieldFuture, $CodeversionMaster)

EndFunc ;==>RefreshFields

Func getINIInfo($val)

$ArgoMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'ARGO', 'versionNumber', "ERROR")

$TDEFNversionNumberMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'TDEFN', 'versionNumber', "ERROR")

$TDEFNDateMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'TDEFN', 'Date', "ERROR")

$TDEFNTimeMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'TDEFN', 'Time', "ERROR")

$AlogentversionNumberMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'Alogent', 'versionNumber', "ERROR")

$SortPatternversionNumberMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'Sort Pattern', 'versionNumber', "ERROR")

$SortPatternDateMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'Sort Pattern', 'Date', "ERROR")

$SortPatternTimeMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'sort Pattern', 'Time', "ERROR")

$ServerDateDateMaster = IniRead('.\' & $val & '\TellerExpressUpdate.ini', 'Server Date', 'Date', "ERROR")

$CodeversionMaster = IniRead('.\' & $val & '\ServerConfig.ini', '', 'Version', "ERROR")

EndFunc ;==>getINIInfo

Func UpdateServer()

MsgBox(0, "Update", "I clicked update on Server " & $val)

EndFunc ;==>UpdateServer

Share this post


Link to post
Share on other sites

Apology accepted. However, I have something I would like to make clear, not just to the OP, but to anyone else who happens to read this thread.

A reproducer is short. You can easily reproduce almost any situation with less than 100 lines of code. This does not mean trimming white spaces and comments. This means removing anything that is unnecessary. This means you don't have the person trying to help you do extra work (in this case creating new files and folders). Do some work to make it easy for us to help you. We aren't here to be your slaves, but we are willing to help.

You can make a successful reproducer by creating an entirely new script. In the case of this OP, write a GUI that creates a tab with two tab items, load a single label and input onto each, and then have them populate by means of a single ini file (which you include as an attachment).

Personally, I'm getting very tired of trying to decipher long code, condense scripts myself, or make assumptions and such in an effort to help the poster. Make us a viable reproducer that is SMALL and UNCOMPLICATED. Half of the time, you'll figure the problem out yourself when you do this. The other half of the time, it'll be much easier for US to help YOU.

You might think me arrogant or a grumpy old scripter.....tough. I'm tired of doing this over and over, and I know I'm not the only person on this forum that is irritated.

*end venting*


IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

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

Create an account

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


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0