Eventually I want this to feed into another app (as read only) that our operations uses so they can see any priority/severity tickets the helpdesk is coordinating.
The first load works fine. The listview is scrollable.
After the listview refreshes (10 seconds to start) 2 odd things happen that i can't figure out why:
* The Gui size gets slightly larger, just a little bit, one time, both in width and height
* The ListView is no longer scrollable
Any idea why?
below is the Proof of concept.
Warning: Running this script will create a TEMP folder on your C drive and create a TEST.CSV with some generic data for use in the test in that directory
(only if you choose Yes at the msgbox prompt).
Code: Select all
#SingleInstance force
refreshtime = %A_MM%/%A_DD%/%A_YYYY% at %A_Hour%:%A_Min%:%A_Sec%
Filecsv = C:\Temp\test.csv
Filetext = C:\Temp\test.txt
IfNotExist, C:\Temp\test.csv ; Check for presence of file. Warn & exit if non existent or create a test file
{
MsgBox, 4, ,Unable to locate %Filecsv%`nPlease check for network connection or create the file in: %filecsv%.`n`nWOULD YOU LIKE TO CREATE A TEST.CSV in C:\Temp\?
IfMsgBox, yes
{
IfNotExist C:\Temp\
FileCreateDir, C:\Temp\
loop, 20
{
FileAppend, 1010%a_index%`,IT is investigating`,Something was broken`n, %filecsv%
}
}
else,
return
}
loop
{
refreshtime = %A_MM%/%A_DD%/%A_YYYY% at %A_Hour%:%A_Min%:%A_Sec%
gosub, Delete_LV
gosub, datagrab
gosub, create_LV
WinGetPos, X, Y, W, H, Sev Status Tracker
Gui, add, text, cred, Last update was %refreshtime%
if x =
{
Gui, Show, NoActivate h250 w600 x300 y300, Sev Status Tracker
Gui, +resize
}
else,
{
Gui, Show, NoActivate h250 w600 x%x% y%y%, Sev Status Tracker
Gui, +resize
}
sleep, 10000
}
Delete_LV:
gui, submit, nohide
LV_Delete()
return
datagrab:
filedelete, %Filetext% ; Delete Text file
Fileread, sevtext, %Filecsv% ; read the contents of the CSV
FileAppend, %sevtext%, %Filetext% ; Recreate Text file with new data from CSV
return
create_LV:
Gui, Add, ListView,grid x8 y8 r10 w575 +hscroll, Row|P-Ticket#|Status|Description
LV_ModifyCol(1,auto)
LV_ModifyCol(2,80)
LV_ModifyCol(3,100)
LV_ModifyCol(4,200)
loop, read, %Filetext%
{
Loop, parse, A_loopreadline, `, ; Loop each line of file and parse each line by comma
{
p%a_index% = %a_loopField%
}
if p4 != Arch!ve ; Resolved escalations: Skip over Priorities marked as "Arch!ve" in the 4th column when the issue is resolved.
{
LV_Add("",a_index,p1,p2,p3)
}
}
Return
GUIClose:
GUIEscape:
ExitApp