Jump to content

boogieoompa

Active Members
  • Posts

    187
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

boogieoompa's Achievements

Prodigy

Prodigy (4/7)

0

Reputation

  1. Absolutely positively PERFECT! Incidently the "advanced mode" field also works as well using the same syntax. Thank you a TON!
  2. After a rather long break from AutoIt work calls for a new app. I am trying to hot key a UI that has multiple controls with no control IDs but unique text. ControlFocus("RobotControl", "zoomInBtn","") ControlClick("RobotControl", "zoomInBtn","") I don't want to have to resort to coordinates (for obvious reasons), is there a way of identifying the control simply by the text and clicking on it? Thank you very much,
  3. Thanks for the feedback! I changed the array back to 2d and redifned $arry_bill[5000] everytime before it gets populated and I still get the same error in the same place. #include <Excel.au3> #include <Array.au3> HotKeySet("q","Fun_End") ;Excel Books Global $xls_billing = _ExcelBookOpen(@ScriptDir & "\Billing.xlsx") WinWaitActive("Microsoft Excel - Billing") ;wait for the excel file to load Global $xls_clinical = _ExcelBookOpen(@ScriptDir & "\Clinical.xlsx") WinWaitActive("Microsoft Excel - Clinical") ;wait for the excel file to load ;Setting Arrays Global $arry_clin[5000][4] ;the current patient's clinical events stored in an array Global $arry_bill[5000][6] ;the current patient's billing events stored in an array Global $arry_master_bill = _ExcelReadSheetToArray($xls_billing,1,1,0,5) ;Application Specific Variables Global $var_current_row = 2 ;the current row. Updated after each patient Global $var_current_pt ;the current patient's MR Global $var_previous_row = $var_current_row;the previous last patient's MR Global $var_result Sleep(5000) ;wait for all sheets to load and memory to recover... just to be safe Fun_Start() ;begins the recursion thru the clinical data Fun_End() Func Fun_Start() While _ExcelReadCell($xls_clinical,$var_current_row) <> "" Fun_Read_Clinical($var_current_row) Fun_Read_Billing($var_current_pt) $i = 1 Fun_Clean() $var_previous_row = $var_current_row WEnd EndFunc ;Load the patients into 2 arrays basaed on MR ;Subtract/cancel out the negative quantities ; Func Fun_Clean() ; _ArrayDisplay($arry_clin) _ArrayDisplay($arry_bill) $i = 1 While $i < 5000 If $arry_bill[$i][5] < 0 Then $cancel = abs[$arry_bill[$i][5]] $z = 1 While $z < $cancel + 1 $y = 1 While $y < 5000 If $arry_bill[$i][4] = $arry_bill[$y][4] and $arry_bill[$i][3] = $arry_bill[$y][3] and $arry_bill[$y][5] > 0 Then $arry_bill[$y][5] = $arry_bill[$y][5] - 1 EndIf $y = $y + 1 WEnd $z = $z + 1 WEnd EndIf $i = $i + 1 WEnd EndFunc Func Fun_Read_Billing($mr) ;A = Fin ;B = CDM ;C = Amount ;D = DOS ;E = Quantity $i = 2 Global $arry_bill[5000][6] ;the current patient's billing events stored in an array While $i < UBound($arry_master_bill) $z = 1 $y = 1 If $arry_master_bill[$i][1] = $mr Then While $z < 6 $arry_bill[$y][$z] = $arry_master_bill[$i][$z] $z = $z + 1 WEnd $y = $y + 1 Else ExitLoop EndIf $i = $i + 1 WEnd EndFunc Func Fun_Read_Clinical($start_row) ;A = Fin ;B = DOS ;C = CDM Global $arry_clin[5000][4] ;the current patient's clinical events stored in an array $y = 1 $var_current_pt = _ExcelReadCell($xls_clinical,$var_current_row,1) While _ExcelReadCell($xls_clinical,$var_current_row,1) = $var_current_pt $z = 1 While $z < 4 $arry_clin[$y][$z] = _ExcelReadCell($xls_clinical,$var_current_row,$z) $z = $z + 1 WEnd $y = $y + 1 $var_current_row = $var_current_row + 1 WEnd EndFunc Func Fun_End() Global $xls_billing ; Clears Memory Global $xls_clinical ;Clears Memory MsgBox(0,"Finally", "Done") Exit EndFunc
  4. So I have spent many o' hours trying to figure this out buy I think I need to escalate it to the forum. I have a script that basically opens up 2 excel files. Once the 2 are open it picks a common field (found in column 1) to match, and creates 2 arrays where I can then apply logic. Its basically like an advanced vlookup. The problem is after the first compare I get a "Subscript used on non-accessible variable." error. Specifically $cancel = abs[$arry_bill[$i][5]] $cancel = abs^ ERROR I'm assuming this has to do with the way I'm clearing the array (by re defining them as global variables inside a function) but I do not know another way of clearing out an array so that it can be used later. Any ideas? Thanks #include <Excel.au3> #include <Array.au3> HotKeySet("q","Fun_End") ;Excel Books Global $xls_billing = _ExcelBookOpen(@ScriptDir & "\Billing.xlsx") WinWaitActive("Microsoft Excel - Billing") ;wait for the excel file to load Global $xls_clinical = _ExcelBookOpen(@ScriptDir & "\Clinical.xlsx") WinWaitActive("Microsoft Excel - Clinical") ;wait for the excel file to load ;Setting Arrays Global $arry_clin[5000][4] ;the current patient's clinical events stored in an array Global $arry_bill[5000][6] ;the current patient's billing events stored in an array Global $arry_master_bill = _ExcelReadSheetToArray($xls_billing,1,1,0,5) ;Application Specific Variables Global $var_current_row = 2 ;the current row. Updated after each patient Global $var_current_pt ;the current patient's MR Global $var_previous_row = $var_current_row;the previous last patient's MR Global $var_result Sleep(5000) ;wait for all sheets to load and memory to recover... just to be safe Fun_Start() ;begins the recursion thru the clinical data Fun_End() Func Fun_Start() While _ExcelReadCell($xls_clinical,$var_current_row) <> "" Fun_Read_Clinical($var_current_row) Fun_Read_Billing($var_current_pt) $i = 1 Fun_Clean() #cs While $arry_clin[$i][1] <> "" Fun_Analysis_1($arry_clin,$i) Fun_Analysis_2($arry_clin,$arry_bill,$i) _ExcelWriteCell($var_clinical_sheet,$var_result,$var_previous_row + $i - 1 , 9) $var_result = "" $i = $i + 1 WEnd $i = 1 While $arry_clin[$i][1] <> "" Fun_Analysis_3($arry_clin,$arry_bill,$i) _ExcelWriteCell($var_clinical_sheet,$var_result,$var_previous_row + $i - 1 , 10) $var_result = "" $i = $i + 1 WEnd Fun_Analysis_5($arry_clin,$arry_bill) _ExcelWriteCell($var_clinical_sheet,$var_result,$var_current_row - 1, 11) $var_result = "" #ce $var_previous_row = $var_current_row Global $arry_clin[5000][4] ;the current patient's clinical events stored in an array Global $arry_bill[5000][6] ;the current patient's billing events stored in an array WEnd EndFunc ;Load the patients into 2 arrays basaed on MR ;Subtract/cancel out the negative quantities ; Func Fun_Clean() ; _ArrayDisplay($arry_clin) _ArrayDisplay($arry_bill) $i = 1 While $i < 5000 If $arry_bill[$i][5] < 0 Then $cancel = abs[$arry_bill[$i][5]] $z = 1 While $z < $cancel + 1 $y = 1 While $y < 5000 If $arry_clin[2] = $arry_bill[4] and $arry_clin[3] = $arry_bill[2] and $arry_bill[5] > 0 Then $arry_bill[5] = $arry_bill[5] - 1 EndIf $y = $y + 1 WEnd $z = $z + 1 WEnd EndIf $i = $i + 1 WEnd _ArrayDisplay($arry_clin) _ArrayDisplay($arry_bill) EndFunc Func Fun_Read_Billing($mr) ;A = Fin ;B = CDM ;C = Amount ;D = DOS ;E = Quantity $i = 2 While $i < UBound($arry_master_bill) $z = 1 $y = 1 If $arry_master_bill[$i][1] = $mr Then While $z < 6 $arry_bill[$y][$z] = $arry_master_bill[$i][$z] $z = $z + 1 WEnd $y = $y + 1 Else ExitLoop EndIf $i = $i + 1 WEnd EndFunc Func Fun_Read_Clinical($start_row) ;A = Fin ;B = DOS ;C = CDM $y = 1 $var_current_pt = _ExcelReadCell($xls_clinical,$var_current_row,1) While _ExcelReadCell($xls_clinical,$var_current_row,1) = $var_current_pt $z = 1 While $z < 4 $arry_clin[$y][$z] = _ExcelReadCell($xls_clinical,$var_current_row,$z) $z = $z + 1 WEnd $y = $y + 1 $var_current_row = $var_current_row + 1 WEnd EndFunc Func Fun_End() Global $xls_billing ; Clears Memory Global $xls_clinical ;Clears Memory MsgBox(0,"Finally", "Done") Exit EndFunc
  5. WOW, thanks that is a ton faster! Thank you both!
  6. So I'm writing a script that has to crunch thru 3 excel spreadsheets. One is 98k x 5 the other is 25k x 4 and the last is 90k x 6. Obviously this is tons of data and _excelreadcell is looking like its very, very slow. Does anyone know of a better way to load/analyze these? I'm debating extracting them into a CSV or something and loading them all in memory (I have access to a PC with 16 GB of RAM) but I'm not sure. Does anyone have any experience or tips at chugging thru this beast? Thank you
  7. Well I would suggest looking at the IE.Au3 and File.Au3 UDFs (Should be included in your autoit). Basically you can open up a PDF in a brouser by simply directing to it like a website say with a Func FunOpenPDF($filename) $oIE = _IECreate (@ScriptDir & "\" & $filename & ".pdf") EndFunc This will open up any PDF file you want by simply calling the function with the PDF that was recently added. So bascially you will just need to make a loop that checks for new files, if it finds one just simply call the FunOpenPDF($filename) with the delta. You may want to use something like _FileListToArray(@ScriptDir) Off the top of my head here is a sample format (doesn't actually work, but hopefully you get the idea). #include <IE.au3> #Include <File.au3> $OldList = _FileListToArray(@ScriptDir) While 1 Sleep(5000) $CurrentList = _FileListToArray(@ScriptDir) ;;;;compare CurrentList and OldList ;;;;;fire off FunOpenPDF WEnd Func FunOpenPDF($filename) $oIE = _IECreate (@ScriptDir & $filename & ".pdf") EndFunc This checks the folder that the script is running from every 5 seconds and opens up whatever files were not there 5 seconds ago... that is assuming I'm not missing something in your question. If so sorry for missing the mark ;-)
  8. Excellent! Thank you so much for your help. I decided to do a winwaitactive thing so I can put it as part of my boot menu and have it disable the key whenever the "World of Warcraft" window is open. My arena team thanks you ;-)
  9. OK so for like the 50th time I died playing a video game because I accidentally hit the windows start screen button (in windows 8) instead of Alt. I almost took a screw driver and ripped out the key but than it occurred to me I could block it very easy using Autoit. Does anyone know how I "Hotkeyset" the windows 8 button? Thanks
  10. This is a 1/2 way working example but I think you get the gist. Basically if you _arraydisplay($parsed_by_row) you will get each row, if you _ArrayDisplay($parsed_by_column) (which is in the loop currently) you will get each row broken out. There is the unintentonal effect of having an extra array populate when using @crlf but it is mentioned in the helpfile under stringsplit so my guess is there is example code on the forum to fix that. #include <Array.au3> ;put code here to activate your excel document and send a ^c Local $parsed_by_row Local $parsed_by_column $excel_string = ClipGet() ;;;;seperates each row by looking for linecarriages... right now I'm getting 2... not sure why $parsed_by_row = StringSplit($excel_string,@crlf) $i = 1 While $i < UBound($parsed_by_row) $parsed_by_column = StringSplit($parsed_by_row[$i],@tab) $i = $i+1 _ArrayDisplay($parsed_by_column) WEnd
  11. I dont know if the UDF has a function that can get what the user selected but cant you activate excel, copy it and than ClipGet() it? You can than parse it into an array... I think they are delimited by tabs (and @crlf for next line, or next array).
  12. The odd thing is it does it right away. I tested it and if I launch my script and immediatly alt tab into Citrix I get a delay. Here is the full code though it is a bit long. There is also 1 device that cannot even launch the application. Here is the full code #include <Array.au3> #include <GuiConstants.au3> #include <GuiConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <guilistview.au3> #include <GuiRichEdit.au3> #include <String.au3> #NoTrayIcon ;Checks to see if the kill file exsists (for upgrade/hot fix purposes) If FileExists(@scriptdir & "\kill.txt") Then MsgBox(0,"Error", "The system is currently being updated. You will now be logged out.",5) Exit EndIf Opt("GUIOnEventMode", 1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAIN WINDOW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $mainwindow = GuiCreate("Patient Tracker 2.0", @DesktopWidth, @DesktopHeight, 0, 0,BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPCHILDREN)) GUISetOnEvent($GUI_EVENT_CLOSE, "FunClose") GUISetState(@SW_SHOW,$mainwindow) $font = "Comic Sans MS" GUISetFont(12, 400, 0, $font) ; will display underlined characters $btnnew = GUICtrlCreateButton("New",10, 10, 70, 70, $BS_BITMAP) GUICtrlSetImage($btnnew, @ScriptDir & "\Icons\new.bmp") GUICtrlSetOnEvent($btnnew, "FunNew") GUICtrlSetTip($btnnew, "Create New Patient") $btnrefresh = GUICtrlCreateButton("Refresh",90, 10, 70, 70, $BS_BITMAP) GUICtrlSetImage($btnrefresh, @ScriptDir & "\Icons\refresh.bmp") GUICtrlSetOnEvent($btnrefresh, "FunRead") GUICtrlSetTip($btnrefresh, "Refresh List") $btnfilter = GUICtrlCreateButton("Filter",170, 10, 70, 70, $BS_BITMAP) GUICtrlSetImage($btnfilter, @ScriptDir & "\Icons\filter.bmp") GUICtrlSetOnEvent($btnfilter, "FunFilters") GUICtrlSetTip($btnfilter, "Change Filter / Search Criteria") $btnwait = GUICtrlCreateButton("Wait",250, 10, 70, 70, $BS_BITMAP) GUICtrlSetImage($btnwait, @ScriptDir & "\Icons\wait.bmp") GUICtrlSetOnEvent($btnwait, "FunWait") GUICtrlSetTip($btnwait, "Current Wait Time") GUICtrlSetState($btnwait, $GUI_DISABLE) $btnuser = GUICtrlCreateButton(@UserName,@DesktopWidth - 250, 25,200) GUICtrlSetOnEvent($btnuser, "FunChangeUser") GUICtrlSetTip($btnwait, "Current User Name") ; MENU $filemenu1 = GuiCtrlCreateMenu("File") $fileitem11 = GUICtrlCreateMenuItem("New Patient", $filemenu1) GUICtrlSetOnEvent($fileitem11, "FunNew") $fileitem12 = GUICtrlCreateMenuItem("Filter", $filemenu1) GUICtrlSetOnEvent($fileitem12,"FunFilters") $fileitem13 = GUICtrlCreateMenuItem("Exit", $filemenu1) GUICtrlSetOnEvent($fileitem13,"FunClose") $filemenu2 = GuiCtrlCreateMenu("Help") $fileitem21 = GUICtrlCreateMenuItem("What's New", $filemenu2) $fileitem22 = GUICtrlCreateMenu("Reference", $filemenu2) $fileitem221 = GUICtrlCreateMenuItem("Front Desk", $fileitem22) $fileitem222 = GUICtrlCreateMenuItem("Registration", $fileitem22) $fileitem223 = GUICtrlCreateMenuItem("Tech", $fileitem22) GUICtrlSetOnEvent($fileitem21, "FunVersion") GUICtrlSetOnEvent($fileitem221, "FunFront") GUICtrlSetOnEvent($fileitem222, "FunReg") GUICtrlSetOnEvent($fileitem223, "FunTech") ;List Local $iExWindowStyle = BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE) Local $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER) Global $mainlist = GUICtrlCreateListView("", 10, 90, @DesktopWidth - 20, @DesktopHeight - 200, $iExWindowStyle) _GUICtrlListView_SetExtendedListViewStyle($mainlist, $iExListViewStyle) GUICtrlSetOnEvent($mainlist, "FunEdit") $columnlabels = StringSplit(IniRead("listview.ini","LISTVIEW","COLUMNSLABEL","ERROR|ERROR") & "|ID","|") $columnwidth = StringSplit(IniRead("listview.ini","LISTVIEW","COLUMNSWIDTH","100|100") & "|0","|") $i = 1 While $i < UBound($columnlabels) _GUICtrlListView_AddColumn($mainlist, $columnlabels[$i], $columnwidth[$i]) $i = $i + 1 WEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GLOBAL VARIABLES;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Global $dropdown1order Global $tablename = @MDAY Global $varcombo1 Global $varcombo2 Global $varcombo1default Global $varcombo2default Global $varcheckbox1 Global $radio1[10] Global $chkbox1[10] Global $cmbstatus1 Global $cmbstatus2 Global $fieldstring = "ID|LastName|FirstName|Notes|" Global $TheQuery[100] Global $combocheckbox[10] Global $combocheckbox2[10] Global $columnlabels Global $columnwidth Global $columntranslate $columntranslate = IniRead("listview.ini","LISTVIEW", "COLUMNSTRANSLATE", "BLANK") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CHILD PATIENT WINDOW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $childGui2 = GUICreate("Add/Edit Patient", IniRead("Patient.ini", "GUI", "WIDTH", 500), IniRead("Patient.ini", "GUI", "HEIGHT", 500), 100, 100, BitOR($WS_POPUP, $WS_THICKFRAME), $WS_EX_MDICHILD, $mainwindow) $lbllast = GUICtrlCreateLabel("Last Name", 10,10) $iptlast = GUICtrlCreateInput("", 20, 35, 150,20,0x0008) $lblfirst = GUICtrlCreateLabel("First Name", 10,65) $lblID = GUICtrlCreateLabel("",-500,100,0) $iptfirst = GUICtrlCreateInput("", 20, 90, 150,20,0x0008) $btnpromote = GUICtrlCreateButton("Promote",20,250,120) $btnDemote = GUICtrlCreateButton("Demote", 170,250,120) $btnaudit = GUICtrlCreateButton("Audit", 330, 250,120) $iptnotes = GUICtrlCreateInput("",10, 300, 480, 150) $btnaddupdate = GUICtrlCreateButton("Add", 30, 460,150) $btnaddcancel = GUICtrlCreateButton("Cancel", 180, 460,150) $btnaddelete = GUICtrlCreateButton("Delete", 330, 460,150) GUICtrlSetOnEvent($btnDemote,"FunDemote") GUICtrlSetOnEvent($btnpromote,"FunPromote") GUICtrlSetOnEvent($btnaudit,"FunCreateAudit") GUICtrlSetOnEvent($btnaddupdate,"FunAdd_Update") GUICtrlSetOnEvent($btnaddcancel,"FunPTClose") GUICtrlSetOnEvent($btnaddelete,"FunDelete_Update") FunPopulatePatient() ;Loads the patient.ini file to populate the patient window UI ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CHILD FILTER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;only filters on combo1 and checkbox1 at the moment $childGui = GUICreate("Filters", IniRead("Filter.ini", "GUI", "WIDTH",300), IniRead("Filter.ini", "GUI", "Height",300), 300,100,BitOR($WS_POPUP, $WS_THICKFRAME), $WS_EX_MDICHILD, $mainwindow) $childbtnclose = GUICtrlCreateButton("Close Filter Window", 10,270, 280) GUICtrlSetOnEvent($childbtnclose,"FunChildClose") GUICtrlCreateLabel(IniRead("filter.ini", "GUI", "CHECKBOX1LABEL ", "Modality"),10, 10) $lblfilter2 = GUICtrlCreateLabel(IniRead("filter.ini", "GUI", "DROPDOWN1LABEL", "Modality"),IniRead("filter.ini", "GUI", "CHECKBOX1LABELWIDTH ", "Modality") + 25,10) GUICtrlCreateLabel("Auto Refresh (Mins)",10,200) $childcmbtime = GUICtrlCreateCombo("", 10, 220) $refreshtime = 2;IniRead(@scriptdir & "\config\" & @username & ".ini", "Defaults","refresh",0) GUICtrlSetData(-1, "2|3|4|5|6|7|8|9|10", $refreshtime) FunPopulateFilter() ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CHILD Wait;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;only filters on combo1 and checkbox1 at the moment $childGui3 = GUICreate("Wait Time Check", 200, 200, 300,100,BitOR($WS_POPUP, $WS_THICKFRAME), $WS_EX_MDICHILD, $mainwindow) $childbtncalc = GUICtrlCreateButton("Check Wait Time", 10,150) GUICtrlSetOnEvent($childbtncalc,"FunWaitTimeCalc") GUICtrlCreateLabel("Choose Modality",20,20) $childcmbmodality = GUICtrlCreateCombo("", 10, 50) GUICtrlSetData(-1, "CT|XR|MR|US", 'CT') GUICtrlCreateLabel("Choose Schedule Status",20,80) $childcmbstatus = GUICtrlCreateCombo("", 10, 110) GUICtrlSetData(-1, "WALK-IN|SCHEDULED", 'WALK-IN') FunRead() GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") GUIRegisterMsg($WM_SIZE, "WM_SIZE") $zz = 1 _GUICtrlListView_RegisterSortCallBack($mainlist) While 1 If $zz > $refreshtime * 600 Then If FileExists(@scriptdir & "\kill.txt") Then MsgBox(0,"Error", "The system is currently being updated. You will now be logged out.",5) Exit Else FunRead() $zz = 1 EndIf EndIf $zz = $zz + 1 Sleep(250) WEnd _GUICtrlListView_UnRegisterSortCallBack($mainlist) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunPopulateListView($Parse) _GUICtrlListView_DeleteAllItems ($mainlist) $i = 1 While $Parse[$i] <> "" GUICtrlCreateListViewItem($Parse[$i],$mainlist) $i = $i + 1 WEnd EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunClean($theQuery) ;First extract modality info from filters, save them to an array $filtermodalities $i = 1 $z = 1 $tempfiltermodalaties = "" While $i < UBound($combocheckbox) If GUICtrlRead($combocheckbox[$i]) = $GUI_CHECKED Then If $z = 1 Then $tempfiltermodalaties = ControlGetText("Filters","",$combocheckbox[$i]) $z = $z + 1 Else $tempfiltermodalaties = $tempfiltermodalaties & "~" & ControlGetText("Filters","",$combocheckbox[$i]) $z = $z + 1 EndIf EndIf $i = $i + 1 WEnd $filtermodalaties = StringSplit($tempfiltermodalaties, "~") Local $theQuery2[200] $columntranslate2 = StringSplit($columntranslate,"|") $z = 1 While $theQuery[$z] <> "" $splitquery = StringSplit($theQuery[$z],"|") $cleanstring = "" $i = 1 While $i < UBound($columntranslate2) Select Case $columntranslate2[$i] = "ID" $cleanstring = $cleanstring & $splitquery[1] & "|" Case $columntranslate2[$i] = "LastName" $cleanstring = $cleanstring & $splitquery[2] & "|" Case $columntranslate2[$i] = "FirstName" $cleanstring = $cleanstring & $splitquery[3] & "|" Case $columntranslate2[$i] = "TotalTime" $cleanstring = $cleanstring & FunTimeDeltaTotal($splitquery) & "|" Case $columntranslate2[$i] = "CurrentStatusTime" $cleanstring = $cleanstring & FunTimeDeltaCurrent($splitquery) & "|" Case $columntranslate2[$i] = "Combo1" $cleanstring = $cleanstring & $splitquery[6] & "|" Case $columntranslate2[$i] = "Combo2" $cleanstring = $cleanstring & $splitquery[7] & "|" Case $columntranslate2[$i] = "Check1" $cleanstring = $cleanstring & StringReplace($splitquery[8], "~", " ") & "|" Case $columntranslate2[$i] = "Radio1" $cleanstring = $cleanstring & $splitquery[9] & "|" Case $columntranslate2[$i] = "Check2" $cleanstring = $cleanstring & $splitquery[10] & "|" Case $columntranslate2[$i] = "Radio2" $cleanstring = $cleanstring & $splitquery[11] & "|" Case $columntranslate2[$i] = "Notes" $cleanstring = $cleanstring & $splitquery[12] & "|" Case $columntranslate2[$i] = "ExactDay" $cleanstring = $cleanstring & $splitquery[13] & "|" Case $columntranslate2[$i] = "BlankField" $cleanstring = $cleanstring & $splitquery[14] & "|" Case $columntranslate2[$i] = "Lock" $cleanstring = $cleanstring & $splitquery[15] & "|" EndSelect $i = $i + 1 WEnd $TheQuery2[$z] = $cleanstring $z= $z + 1 Wend Return($TheQuery2) EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunRead() $TheQuery = "" Global $TheQuery[100] Local $title,$adoCon,$dbname,$adoRs, $_output ; create connection $adoCon = ObjCreate("ADODB.Connection") $dbname = @ScriptDir & "\" & "Patient Database.mdb" ; this is for Access 2007 / 2010 according to Microsoft $adoCon.Open ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $dbname) ; create recordset $adoRs = ObjCreate ("ADODB.Recordset") $adoRs.CursorType = 1 $adoRs.LockType = 3 $query = "SELECT * FROM "& $tablename & " WHERE (Combo1 = " ;Looking for status in filters $i = 1 $z = 1 While $i < UBound($combocheckbox2) If GUICtrlRead($combocheckbox2[$i]) = $GUI_CHECKED Then If $z = 1 Then $query = $query & "'" & ControlGetText("Filters","",$combocheckbox2[$i]) & "'" $z = $z + 1 Else $query = $query & " or Combo1 = '" & ControlGetText("Filters","",$combocheckbox2[$i]) & "'" $z = $z + 1 EndIf EndIf $i = $i + 1 WEnd If $z > 1 Then ;make sure there is a status selected $query = $query & ") AND (" ; Looking for modalaties in filters $i = 1 $z = 1 While $i < UBound($combocheckbox) If GUICtrlRead($combocheckbox[$i]) = $GUI_CHECKED Then If $z = 1 Then $query = $query & "Check1 LIKE '%" & ControlGetText("Filters","",$combocheckbox[$i]) & "%'" $z = $z + 1 Else $query = $query & " or Check1 LIKE '%" & ControlGetText("Filters","",$combocheckbox[$i]) & "%'" $z = $z + 1 EndIf EndIf $i = $i + 1 WEnd $query = $query & ");" If $z > 1 Then ;make sure a modality was selected $adoRs.Open ($query, $adoCon) $i = 1 While $i < 99 if $adoRs.RecordCount then If not ($adoRs.EOF) Then $TheQuery[$i] = $adoRs.Fields("ID").Value & "|" & _StringEncrypt(0,$adoRs.Fields("LastName").Value,"RandoPassword321") & "|" & _StringEncrypt(0,$adoRs.Fields("FirstName").Value,"RandoPassword321") & "|" & _ $adoRs.Fields("TotalTime").Value & "|" & $adoRs.Fields("CurrentStatusTime").Value & "|" & $adoRs.Fields("Combo1").Value & "|" & _ $adoRs.Fields("Combo2").Value & "|" & $adoRs.Fields("Check1").Value & "|" & $adoRs.Fields("Radio1").Value & "|" & _ $adoRs.Fields("Check2").Value & "|" & $adoRs.Fields("Radio2").Value & "|" & $adoRs.Fields("Notes").Value & "|" & _ $adoRs.Fields("ExactDay").Value & "|" & $adoRs.Fields("BlankField").Value & "|" & $adoRs.Fields("Lock").Value $adoRs.MoveNext Else ExitLoop Endif EndIf $i = $i + 1 WEnd EndIf EndIf FunPopulateListView(FunClean($TheQuery)) $adoCon.Close _GUICtrlListView_SortItems($mainlist, GUICtrlGetState($mainlist)) _GUICtrlListView_SortItems($mainlist, GUICtrlGetState($mainlist)) EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunSQL($type, $data) Select Case $type = "Add" $fields = StringSplit($fieldstring,"|") $info = Stringsplit($data,"|") $query = "INSERT INTO "& $tablename & " ( ID" $i = 2 While $i < UBound($info) $query = $query & ", " & $fields[$i] $i = $i + 1 WEnd $query = $query & ", TotalTime, CurrentStatusTime, ExactDay ) VALUES ( '" & $info[1] & "'" $i = 2 While $i < UBound($info) $query = $query & ", '" & $info[$i] & "'" $i = $i + 1 WEnd $query = $query & ", '" & @HOUR & ":" & @MIN & "', '" & @HOUR & ":" & @MIN & "', '" & @Mon & "/" & @MDAY & "');" Case $type = "Update" $fields = StringSplit($fieldstring,"|") $info = Stringsplit($data,"|") $query = "Update "& $tablename & " SET LastName = '" & $info[2] & "'" $i = 3 While $i < UBound($info) $query = $query & ", " & $fields[$i] & " = '" & $info[$i] & "'" $i = $i + 1 WEnd $query = $query & ", CurrentStatusTime = '" & @HOUR & ":" & @MIN & "', ExactDay = '" & @Mon & "/" & @MDAY & "' Where ID = " & $info[1] & ";" Case $type = "Delete" $fields = StringSplit($fieldstring,"|") $info = Stringsplit($data,"|") $query = "Update "& $tablename & " SET LastName = '" & $info[2] & "'" $i = 3 While $i < UBound($info) $query = $query & ", " & $fields[$i] & " = '" & $info[$i] & "'" $i = $i + 1 WEnd $query = $query & " Where ID = " & $info[1] & ";" ;$query = "Update "& $tablename & " SET LastName = 'MUD', FirstName = 'MYNAME' Where ID = 42129;" $fields = StringSplit($fieldstring,"|") $info = Stringsplit($data,"|") $query = "Update "& $tablename & " SET Combo1 = 'DELETE' Where ID = " & $info[1] & ";" EndSelect Local $title,$adoCon,$dbname,$adoRs, $_output $adoCon = ObjCreate("ADODB.Connection") $dbname = @ScriptDir & "\" & "Patient Database.mdb" $adoCon.Open ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $dbname) $adoRs = ObjCreate ("ADODB.Recordset") $adoRs.CursorType = 1 $adoRs.LockType = 3 $adoRs.open($query, $adoCon) $adoCon.Close EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunFinishCheck($fields,$info) $i = 1 While $i < UBound($fields) If $fields[$i] = "Combo1" Then If $info[$i] = "Finished" Then Return 1 Else Return 0 EndIf EndIf $i = $i + 1 WEnd EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunExtract() Local $extractstring $extractstring = GUICtrlRead($lblID) $extractstring = $extractstring & "|" & _StringEncrypt(1,StringReplace(GUICtrlRead($iptlast), "'",""),"RandoPassword321") $extractstring = $extractstring & "|" & _StringEncrypt(1,StringReplace(GUICtrlRead($iptfirst), "'",""),"RandoPassword321") $extractstring = $extractstring & "|" & StringReplace(GUICtrlRead($iptnotes), "'","") $extractstring = $extractstring & "|" $i = 1 While $i < 10 If GUICtrlRead($chkbox1[$i]) = "1" Then $extractstring = $extractstring & "~" & ControlGetText ("Add/Edit Patient", "", $chkbox1[$i] ) EndIf $i = $i + 1 WEnd $extractstring = $extractstring & "|" & GUICtrlRead($cmbstatus1) ; $extractstring = $extractstring & "|" & GUICtrlRead($cmbstatus2) $extractstring = $extractstring & "|" $i = 1 While $i < 10 If GUICtrlRead($radio1[$i]) = "1" Then $extractstring = $extractstring & ControlGetText ("Add/Edit Patient", "", $radio1[$i] ) EndIf $i = $i + 1 WEnd Return $extractstring EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunEdit() If GUICtrlRead(GUICtrlRead($mainlist)) <> "0" Then $listviewstring = StringSplit(GUICtrlRead(GUICtrlRead($mainlist)),"|") If $listviewstring[1] <> "" And $listviewstring[1] <> GUICtrlRead($btnuser) Then MsgBox(0,"Ooops", "You have locked a patient at the same time as " & $listviewstring[1]) Else ;Set combo1 to default If GUICtrlGetState($cmbstatus1) > 0 Then GUICtrlSetData($cmbstatus1, "") GUICtrlSetData($cmbstatus1,$varcombo1,$varcombo1default) EndIf ;Set combo2 to default If GUICtrlGetState($cmbstatus2) > 0 Then GUICtrlSetData($cmbstatus2, "") GUICtrlSetData($cmbstatus2,$varcombo2,$varcombo2default) EndIf ;Set radio1 to default $i = 1 While $i < 10 If GUICtrlGetState($chkbox1[$i]) > 0 Then GUICtrlSetState($chkbox1[$i],$GUI_UNCHECKED) $i = $i + 1 WEnd ;Set checkbox1 to default GUICtrlSetData($btnaddupdate,"Edit") GUICtrlSetState($btnnew,$GUI_DISABLE) GUICtrlSetState($btnrefresh,$GUI_DISABLE) GUICtrlSetState($btnfilter,$GUI_DISABLE) GUICtrlSetState($btnuser,$GUI_DISABLE) GUICtrlSetState($mainlist,$GUI_DISABLE) GUICtrlSetData($iptlast,"") GUICtrlSetData($iptfirst,"") GUICtrlSetData($iptnotes,"") GUICtrlSetState($radio1[1], $GUI_CHECKED) $i = 1 While $i < UBound($chkbox1) GUICtrlSetState($chkbox1[$i] ,$GUI_UNCHECKED) $i = $i + 1 WEnd GUISetState(@SW_SHOW, $childGui2) $columntranslate2 = StringSplit($columntranslate,"|") $i = 1 While $i < Ubound($columntranslate2) If $columntranslate2[$i] = "LastName" Then GUICtrlSetData($iptlast,$listviewstring[$i]) $i = $i + 1 WEnd $i = 1 While $i < Ubound($columntranslate2) If $columntranslate2[$i] = "FirstName" Then GUICtrlSetData($iptfirst,$listviewstring[$i]) $i = $i + 1 WEnd $i = 1 While $i < Ubound($columntranslate2) If $columntranslate2[$i] = "Notes" Then GUICtrlSetData($iptnotes,$listviewstring[$i]) $i = $i + 1 WEnd $i = 1 While $i < Ubound($columntranslate2) If $columntranslate2[$i] = "ID" Then GUICtrlSetData($lblID,$listviewstring[$i]) $i = $i + 1 WEnd $i = 1 While $i < Ubound($columntranslate2) If $columntranslate2[$i] = "Combo1" Then GUICtrlSetData($cmbstatus1,$listviewstring[$i]) $i = $i + 1 WEnd $i = 1 While $i < Ubound($columntranslate2) If $columntranslate2[$i] = "Combo2" Then GUICtrlSetData($cmbstatus2,$listviewstring[$i]) $i = $i + 1 WEnd $i = 1 While $i < Ubound($columntranslate2) If $columntranslate2[$i] = "Radio1" Then GUICtrlSetData($radio1, $listviewstring[$i]) $i = $i + 1 WEnd $i = 1 While $i < Ubound($columntranslate2) If $columntranslate2[$i] = "Check1" Then $modalitysplit = StringSplit($listviewstring[$i]," ") $n = 1 While $n < UBound($chkbox1) $j = 1 While $j < UBound($modalitysplit) If ControlGetText("Add/Edit Patient","",$chkbox1[$n]) = StringReplace(StringReplace($modalitysplit[$j]," ", ""),"|","") Then GUICtrlSetState($chkbox1[$n] ,$GUI_CHECKED) $j = $j + 1 WEnd $n = $n + 1 Wend EndIf $i = $i + 1 WEnd $lockname = FunLockCheck() If $lockname <> "" And $lockname <> GUICtrlRead($btnuser) Then MsgBox(0,"Ooops", "You have locked a patient at the same time as " & $lockname) Else FunLockPatient("Lock") GUISetState(@SW_SHOW, $childGui2) FunAudit("Opened Patient") Sleep(1500) $lockname = FunLockCheck() If $lockname <> "" And $lockname <> GUICtrlRead($btnuser) Then MsgBox(0,"Ooops", "You have locked a patient at the same time as " & $lockname) EndIf EndIf EndIf EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunLockPatient($type) Select Case $type = "Lock" $query = "Update "& $tablename & " SET Lock = '" & GUICtrlRead($btnuser) & "' Where ID = " & GUICtrlRead($lblID) & ";" Case $type = "UnLock" $query = "Update "& $tablename & " SET Lock = '' Where ID = " & GUICtrlRead($lblID) & ";" EndSelect Local $title,$adoCon,$dbname,$adoRs, $_output $adoCon = ObjCreate("ADODB.Connection") $dbname = @ScriptDir & "\" & "Patient Database.mdb" $adoCon.Open ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $dbname) $adoRs = ObjCreate ("ADODB.Recordset") $adoRs.CursorType = 1 $adoRs.LockType = 3 $adoRs.open($query, $adoCon) $adoCon.Close EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunLockCheck() $query = "SELECT * FROM "& $tablename & " WHERE ID=" & GUICtrlRead($lblID) & ";" Local $title,$adoCon,$dbname,$adoRs, $_output $adoCon = ObjCreate("ADODB.Connection") $dbname = @ScriptDir & "\" & "Patient Database.mdb" $adoCon.Open ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $dbname) $adoRs = ObjCreate ("ADODB.Recordset") $adoRs.CursorType = 1 $adoRs.LockType = 3 $adoRs.open($query, $adoCon) $lockname = $adoRs.fields("lock").value $adoCon.Close Return $lockname EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunAdd_Update() $data = FunExtract() $error = FunCheck($data) If $error = "Passed" Then If GUICtrlRead($btnaddupdate) = "Add" Then FunSQL("Add", $data) FunAudit("Added Patient") EndIf If GUICtrlRead($btnaddupdate) = "Edit" Then FunSQL("Update", $data) FunAudit("Edited Patient") EndIf FunPtClose() FunLockPatient("UnLock") Else MsgBox(0,"Error", "Please fill in " & $error) EndIf EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunCheck($stringcheck) If GUICtrlRead($iptlast) = "" Then Return " the Last Name field" If GUICtrlRead($iptfirst) = "" Then Return " the First Name field" $i = 1 $j = 0 While $i < UBound($chkbox1) If GUICtrlRead($chkbox1[$i]) = "1" Then $j = $j + 1 EndIf $i = $i + 1 WEnd If $j < 1 Then Return "a Modality" Return "Passed" EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunDelete_Update() $msgconfirmation = MsgBox(4,"Delete Confirmation", "Are you SURE you want to delete this patient? This action cannot be undone!") If $msgconfirmation = 6 Then If GUICtrlRead($btnaddupdate) = "Edit" Then $data = FunExtract() FunSQL("Delete", $data) FunPtClose() FunAudit("Deleted Patient") FunLockPatient("UnLock") Else MsgBox(0,"No action taken", "Nothing to Delete") Endif EndIf EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunAudit($action) $passingstring = FunExtract() & "|" & $action & "|" & GUICtrlRead($btnuser) & "|" & @HOUR & ":" & @MIN & ":" & @SEC & "|" & @ComputerName & @CRLF $file = FileOpen(@ScriptDir & "\" & @MON & "_" & @MDAY & "_audit.txt", 1) If $file = -1 Then MsgBox(0, "Error", "Unable to log audit, please contact Ben.") Exit EndIf FileWrite($file, $passingstring) FileClose($file) EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunChangeUser() Global $guiusername = GUICreate("Change Username",200,100,@DesktopWidth/2 - 100, @DesktopHeight/2 - 50 , BitOR($WS_POPUP, $WS_THICKFRAME), $WS_EX_MDICHILD, $mainwindow) GUISetState(@SW_SHOW,$guiusername) Global $iptnewuser = GUICtrlCreateInput(Guictrlread($btnuser), 20,20, 160) $btnchildusername = GUICtrlCreateButton(" Save ", 70, 60) GUICtrlSetOnEvent($btnchildusername,"FunUpdateUser") EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunUpdateUser() GUICtrlSetData($btnuser,GUICtrlRead($iptnewuser)) GUIDelete($guiusername) EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunDemote() $i = UBound($dropdown1order) - 1 While $i > 0 If Guictrlread($cmbstatus1) = $dropdown1order[$i] Then If $i > 1 Then GUICtrlSetData($cmbstatus1, $dropdown1order[$i-1]) ExitLoop EndIf $i = $i - 1 WEnd EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunPromote() $i = 1 $j = 1 While $i < UBound($dropdown1order) If Guictrlread($cmbstatus1) <> $dropdown1order[$i] Then $j = $j + 1 EndIf $i = $i + 1 WEnd If $j = UBound($dropdown1order) Then GUICtrlSetData($cmbstatus1, $dropdown1order[$j-1]) EndIf $i = 1 While $i < UBound($dropdown1order) If Guictrlread($cmbstatus1) = $dropdown1order[$i] Then If $i < UBound($dropdown1order) - 1 Then GUICtrlSetData($cmbstatus1, $dropdown1order[$i+1]) ExitLoop EndIf $i = $i + 1 WEnd EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunCreateListView() EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunPtClose() ;zzz If GUICtrlRead($lblID) <> "" Then FunLock(GUICtrlRead($lblID), 0) GUICtrlSetState($btnnew,$GUI_ENABLE) GUICtrlSetState($btnrefresh,$GUI_ENABLE) GUICtrlSetState($btnfilter,$GUI_ENABLE) GUICtrlSetState($btnuser,$GUI_ENABLE) GUICtrlSetState($mainlist,$GUI_ENABLE) ;zzz GUICtrlSetState($mainlist,$GUI_ENABLE) GUISetState(@SW_HIDE,$childGui2) FunLockPatient("UnLock") FunAudit("Closed Patient") FunRead() EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunNew() GUICtrlSetData( $btnaddupdate, "Add") GUICtrlSetData($lblID,Random(-99999,99999,1)) ;Set combo1 to default If GUICtrlGetState($cmbstatus1) > 0 Then GUICtrlSetData($cmbstatus1, "") GUICtrlSetData($cmbstatus1,$varcombo1,$varcombo1default) EndIf ;Set combo2 to default If GUICtrlGetState($cmbstatus2) > 0 Then GUICtrlSetData($cmbstatus2, "") GUICtrlSetData($cmbstatus2,$varcombo2,$varcombo2default) EndIf ;Set radio1 to default $i = 1 While $i < 10 If GUICtrlGetState($chkbox1[$i]) > 0 Then GUICtrlSetState($chkbox1[$i],$GUI_UNCHECKED) $i = $i + 1 WEnd ;Set check boxes to default $i = 1 While $i < UBound($chkbox1) GUICtrlSetState($chkbox1[$i] ,$GUI_UNCHECKED) $i = $i + 1 WEnd ;Set checkbox1 to default GUICtrlSetData($btnaddupdate,"Add") GUICtrlSetState($btnnew,$GUI_DISABLE) GUICtrlSetState($btnrefresh,$GUI_DISABLE) GUICtrlSetState($btnfilter,$GUI_DISABLE) GUICtrlSetState($btnuser,$GUI_DISABLE) GUICtrlSetData($iptlast,"") GUICtrlSetData($iptfirst,"") GUICtrlSetData($iptnotes,"") GUICtrlSetState($radio1[1], $GUI_CHECKED) GUISetState(@SW_SHOW, $childGui2) EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunChildClose() GUISetState(@SW_HIDE, $childGui) $i = 1 While $i < UBound($combocheckbox) If $combocheckbox[$i] <> "" Then IniWrite(@scriptdir & "\config\" & @username & ".ini", "DEFAULTS","Check1" & $i, GUICtrlRead($combocheckbox[$i])) EndIf $i = $i + 1 WEnd $i = 1 While $i < UBound($combocheckbox2) If $combocheckbox2[$i] <> "" Then IniWrite(@scriptdir & "\config\" & @username & ".ini", "DEFAULTS","Check2" & $i, GUICtrlRead($combocheckbox2[$i])) EndIf $i = $i + 1 WEnd GUISetState(@SW_HIDE, $childGui) GUISwitch($mainwindow) FunRead() EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunFilters() GUISetState(@SW_SHOW, $childGui) EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunClose() Exit EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunPopulateFilter() $combocheckboxz = StringSplit($varcheckbox1,"|") $combocheckbox2z = StringSplit($varcombo1,"|") ;Check Box 1 $i = 1 While $i < UBound($combocheckboxz) If $combocheckboxz[$i] <> "" Then $combocheckbox[$i]= GUICtrlCreatecheckbox($combocheckboxz[$i], 25, 25 * $i) EndIf $i = $i + 1 WEnd ;Check Box 2 $i = 1 While $i < UBound($combocheckbox2z) If $combocheckbox2z[$i] <> "" Then $combocheckbox2[$i]= GUICtrlCreatecheckbox($combocheckbox2z[$i], 155, 25 * $i) EndIf $i = $i + 1 WEnd $i = 1 While $i < UBound($combocheckbox) If $combocheckbox[$i] <> "" Then If IniRead(@scriptdir & "\config\" & @username & ".ini","DEFAULTS", "Check1" & $i, "1") = 1 Then GUICtrlSetState($combocheckbox[$i],$GUI_CHECKED) EndIf $i = $i + 1 WEnd $i = 1 While $i < UBound($combocheckbox2) If $combocheckbox2[$i] <> "" Then If IniRead(@scriptdir & "\config\" & @username & ".ini","DEFAULTS", "Check2" & $i, "1") = 1 Then GUICtrlSetState($combocheckbox2[$i],$GUI_CHECKED) EndIf $i = $i + 1 WEnd GUISetState(@SW_HIDE, $childGui) GUISwitch($mainwindow) FunRead() EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunPopulatePatient() ;Check Box 1 If IniRead("Patient.ini", "CHECKBOX1", "CHECKBOX1_1", "BLANK") <> "BLANK" Then $fieldstring = $fieldstring & "Check1|" $i = 1 While $i < 10 If IniRead("Patient.ini", "CHECKBOX1", "CHECKBOX1_" & $i, "BLANK") <> "BLANK" Then If $i = 1 Then $chkbox1[$i]= GUICtrlCreatecheckbox(IniRead("Patient.ini", "CHECKBOX1", "CHECKBOX1_" & $i, "BLANK"), 20, 275,IniRead("Patient.ini", "CHECKBOX1", "CHECKBOX1_" & $i & "WIDTH", "100")) $varcheckbox1 = GUICtrlRead($chkbox1[1],1) Else $pos = ControlGetPos("Add/Edit Patient","",$chkbox1[$i-1]) $chkbox1[$i]= GUICtrlCreateCheckbox(IniRead("Patient.ini", "CHECKBOX1", "CHECKBOX1_" & $i, "BLANK"), $pos[0] +$pos[2], 275,IniRead("Patient.ini", "CHECKBOX1", "CHECKBOX1_" & $i & "WIDTH", "100")) $varcheckbox1 = $varcheckbox1 & "|" & GUICtrlRead($chkbox1[$i],1) EndIf EndIf $i = $i + 1 WEnd EndIf ;Drop down 1 If IniRead("Patient.ini", "DROPDOWN1", "DROPDOWN1_LABEL ", "BLANK") <> "BLANK" Then $fieldstring = $fieldstring & "Combo1|" GUICtrlCreateLabel(IniRead("Patient.ini", "DROPDOWN1", "DROPDOWN1_LABEL ", "BLANK"), 10, 120) $cmbstatus1 = GUICtrlCreateCombo("", 20, 145,200) $varcombo1 = IniRead("Patient.ini", "DROPDOWN1", "DROPDOWN1_1", "BLANK") $dropdown1order = StringSplit(IniRead("Patient.ini", "DROPDOWN1", "DROPDOWN1_ORDER", "BLANK"),"|") $i = 1 While $i < 10 $i = $i + 1 If IniRead("Patient.ini", "DROPDOWN1", "DROPDOWN1_" & $i, "BLANK") <> "BLANK" Then $varcombo1 = $varcombo1 & "|" & IniRead("Patient.ini", "DROPDOWN1", "DROPDOWN1_" & $i, "BLANK") Else ExitLoop EndIf WEnd $i = 1 $varcombo1default = IniRead("Patient.ini", "DROPDOWN1", "DROPDOWN1_DEFAULT", "BLANK") GUICtrlSetData(-1, $varcombo1,$varcombo1default) EndIf ;Drop down 2 If IniRead("Patient.ini", "DROPDOWN2", "DROPDOWN2_LABEL ", "BLANK") <> "BLANK" Then $fieldstring = $fieldstring & "Combo2|" GUICtrlCreateLabel(IniRead("Patient.ini", "DROPDOWN2", "DROPDOWN2_LABEL ", "BLANK"), 10, 175) $cmbstatus2 = GUICtrlCreateCombo("", 20, 200,200) $varcombo2 = IniRead("Patient.ini", "DROPDOWN2", "DROPDOWN2_1", "BLANK") $i = 1 While $i < 10 $i = $i + 1 If IniRead("Patient.ini", "DROPDOWN2", "DROPDOWN2_" & $i, "BLANK") <> "BLANK" Then $varcombo2 = $varcombo2 & "|" & IniRead("Patient.ini", "DROPDOWN2", "DROPDOWN2_" & $i, "BLANK") Else ExitLoop EndIf WEnd $i = 1 $varcombo2default = IniRead("Patient.ini", "DROPDOWN2", "DROPDOWN2_DEFAULT", "BLANK") GUICtrlSetData(-1, $varcombo2,$varcombo2default) EndIf ;Radio 1 If IniRead("Patient.ini", "RADIO1", "RADIO1_1", "BLANK") <> "BLANK" Then GUIStartGroup() $fieldstring = $fieldstring & "Radio1|" $i = 1 While $i < 10 If IniRead("Patient.ini", "RADIO1", "RADIO1_" & $i, "BLANK") <> "BLANK" Then If $i <> 1 Then $pos = ControlGetPos("Add/Edit Patient","",$radio1[$i-1]) $radio1[$i] = GUICtrlCreateRadio(IniRead("Patient.ini", "RADIO1", "RADIO1_" & $i, "BLANK"), $pos[0] +$pos[2], 225,IniRead("Patient.ini", "RADIO1", "RADIO1_"& $i &"WIDTH ", "100")) Else $radio1[$i] = GUICtrlCreateRadio(IniRead("Patient.ini", "RADIO1", "RADIO1_" & $i, "BLANK"), 20, 225,IniRead("Patient.ini", "RADIO1", "RADIO1_"& $i &"WIDTH ", "100")) EndIf Else ExitLoop EndIf $i = $i+1 WEnd GUICtrlSetState($radio1[1], $GUI_CHECKED) EndIf EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunWaitTimeCalc() GUISetState(@SW_HIDE, $childGui3) Local $TheQuery2[200] $query = "SELECT * FROM "& $tablename & " WHERE Combo1 = 'Finished' AND Check1 = '~" & GUICtrlRead($childcmbmodality) & "' AND RADIO1 = '" & GUICtrlRead($childcmbstatus) & "';" Local $title,$adoCon,$dbname,$adoRs, $_output $adoCon = ObjCreate("ADODB.Connection") $dbname = @ScriptDir & "\" & "Patient Database.mdb" $adoCon.Open ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $dbname) $adoRs = ObjCreate ("ADODB.Recordset") $adoRs.CursorType = 1 $adoRs.LockType = 3 $adoRs.open($query, $adoCon) $i = 1 While $i < 99 if $adoRs.RecordCount then If not ($adoRs.EOF) Then $TheQuery2[$i] = $adoRs.Fields("TotalTime").Value & "|" & $adoRs.Fields("CurrentStatusTime").Value & "|" & $adoRs.Fields("Combo1").Value $adoRs.MoveNext Else ExitLoop Endif EndIf $i = $i + 1 WEnd _ArrayDisplay($TheQuery2) $adoCon.Close EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunWait() GUISetState(@SW_SHOW, $childGui3) EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunVersion() MsgBox(0,"Whats New", "Added in 1.2" & @CRLF & _ "Add help file" & @CRLF & _ "Make pending ONLY work with waiting for front desk" & @CRLF & _ "Add tilde infront of ID on audit trail" & @CRLF & _ "Fix pending button on filters" & @CRLF & _ "Add Delete confirmation" & @CRLF & _ "Fix Patient window locks" & @CRLF & _ "Add File<Close menu option" & @CRLF & _ "Fixed problem with adding a new patint from drop down" & @CRLF & _ "Allow window to move or be closed if 'Edit' window is open" & @CRLF & _ "Make columns and sort stay for refresh" & @CRLF & _ "Add a date sensitive querey to SQL string" & @CRLF & _ "Increase name field length") EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunFront() MsgBox(0,"Front Desk Operating Instructions", "Open the application by clicking Patient tracker icon on your desktop." & @CRLF & _ "Check your filters to set it according to your job requirement by clicking on magnifying glass and clicking the appropriate boxes." & @CRLF & _ "Transfer all the patients on sign in sheet to Patient tracker." & @CRLF & _ "To add a patient left click on + sign and input last and first name, modality and add the patient. Use pending if you don’t know the modality." & @CRLF & _ "Process patients according to the status time on patient tracker." & @CRLF & _ "Lock the patient by double clicking on the patient name as soon as you start working on the patient. It will open the window where you can change patient status. Leave the window open till you are done with the patient." & @CRLF & _ "Promote to the next status as soon as patient is ready." & @CRLF & _ "Transfer patient to problem status if there is issues with processing the patient. Please add notes, your initials and time in free text notes area.") EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunReg() MsgBox(0,"Registration Operating Instructions", "Open the application by clicking Patient tracker icon on your desktop." & @CRLF & _ "Check your filters to set it according to your job requirement by clicking on magnifying glass and clicking the appropriate boxes." & @CRLF & _ "After picking the patient paperwork make sure to lock the patient by double clicking on the patient name. It will open the window where you can change patient status. Leave the window open till you are done with the patient." & @CRLF & _ "Promote to the next status as soon as patient is ready." & @CRLF & _ "Transfer patient to problem status if there is issue with processing the patient. Please add notes, your initials and time in free text notes area.") EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunTech() MsgBox(0,"Tech Operating Instructions", "Open the application by clicking Patient tracker icon on your desktop." & @CRLF & _ "Check your filters to set it according to your job requirement by clicking on magnifying glass and clicking the appropriate boxes." & @CRLF & _ "X-Ray, CT and MRI please lock the patients when you have them in scan rooms by double clicking on the patient name. It will open the window where you can change patient status. Leave the window open till you are done with the patient." & @CRLF & _ "Promote to the next status as soon as patient is done." & @CRLF & _ "For multi modality patients simply take off check mark from your modality and leave the status same till patient is done from all the exams for the day.") EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func WM_SIZE($hWnd, $Msg, $wParam, $lParam) Local $iHeight, $iWidth $iWidth = BitAND($lParam, 0xFFFF) ; _WinAPI_LoWord $iHeight = BitShift($lParam, 16) ; _WinAPI_HiWord _WinAPI_MoveWindow($mainlist, 10, 90, $iWidth - 20, $iHeight - 200) Return $GUI_RUNDEFMSG EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iCode, $tNMHDR, $hWndListView $hWndListView = $mainlist If Not IsHWnd($mainlist) Then $hWndListView = GUICtrlGetHandle($mainlist) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Local $tStruct = DllStructCreate("hwnd hWndFrom;int IDFrom;int Code;int Item", $lParam) If @error Then Return Switch DllStructGetData($tStruct, "Code") Case $NM_DBLCLK Local $iIndex = DllStructGetData($tStruct, "Item") FunEdit() Case $LVN_COLUMNCLICK ; A column was clicked Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam) _GUICtrlListView_SortItems($hWndFrom, DllStructGetData($tInfo, "SubItem")) sleep(500) EndSwitch ;Return $__LISTVIEWCONSTANT_GUI_RUNDEFMSG EndFunc ;==>On_WM_NOTIFY ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunCreateAudit() $varID = GUICtrlRead($lblID) $file = FileOpen(@ScriptDir & "\" & @MON & "_" & @MDAY & "_audit.txt", 0) If $file = -1 Then MsgBox(0, "Error", "Unable to retrieve log, please contact Ben.") Exit EndIf Dim $auditarray[1000] Dim $auditresult[50] $i = 1 $j = 1 While 1 $line = FileReadLine($file,$i) If @error = -1 Then ExitLoop $currentline = StringSplit($line,"|") If $currentline[1] = $varID Then $auditresult[$j] = $line $j = $j + 1 EndIf $i = $i + 1 WEnd FileClose($file) $i = 1 While $auditresult[$i] <> "" $encryptbreak = StringSplit($auditresult[$i],"|") $encryptbreak[2] = _StringEncrypt(0,$encryptbreak[2],"RandoPassword321") $encryptbreak[3] = _StringEncrypt(0,$encryptbreak[3],"RandoPassword321") $j = 1 While $j < UBound($encryptbreak) $encryptfix = $encryptbreak[$j] $j = $j + 1 WEnd $auditresult[$i] = $encryptfix $i = $i + 1 WEnd _ArrayDisplay($auditresult) EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunTimeDeltaTotal($time1) If $time1[6] = "Finished" Then $timesplit = StringSplit($time1[4],":") $timesplit2 = StringSplit($time1[5],":") $hourdelta = $timesplit2[1] - $timesplit[1] If $timesplit2[2] > $timesplit[2] Then $mindelta = $timesplit2[2] - $timesplit[2] Else $mindelta = (60 - $timesplit[2]) + $timesplit2[2] $hourdelta = $hourdelta - 1 EndIf Return ( $hourdelta * 60 ) + $mindelta Else $timesplit = StringSplit($time1[4],":") $hourdelta = @HOUR - $timesplit[1] If @MIN > $timesplit[2] Then $mindelta = @MIN - $timesplit[2] Else $mindelta = (60 - $timesplit[2]) + @MIN $hourdelta = $hourdelta - 1 EndIf Return ( $hourdelta * 60 ) + $mindelta EndIf EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunTimeDeltaCurrent($time1) If $time1[6] = "Finished" Then Return "~" Else $timesplit = StringSplit($time1[5],":") $hourdelta = @HOUR - $timesplit[1] If @MIN > $timesplit[2] Then $mindelta = @MIN - $timesplit[2] Else $mindelta = (60 - $timesplit[2]) + @MIN $hourdelta = $hourdelta - 1 EndIf Return ( $hourdelta * 60 ) + $mindelta EndIf EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func FunSetFilters() If FileExists(@scriptdir & "\config\" & @username & ".ini") = 0 Then FileCopy ( @scriptdir & "\config\config.ini", @scriptdir & "\config\" & @username & ".ini",1) EndIf $i = 1 While If IniRead(@scriptdir & "\config\" & @username & ".ini", "Defaults","CT",0) = 1 Then GUICtrlSetState($childchkct,$GUI_CHECKED) WEnd EndFunc
  13. Thanks! I just took it out though I doubt it was responsible for resource hogging. Still its always nice to have cleaner code.
  14. In a nutshell I made a program that was designed to replace a front desk sign in sheet. It is a super hacky fix in many ways. The program and all of its support files (including the MSAccess database) are stored on a network drive and each user has a shortcut to the executable. When the executable it launched the program reads 4 small images for buttons and 4 small ini files (less than 50 lines total) for control settings than draws the gui, which is mostly just a listviewbox that refreshes every 2 minutes. This program has been running fine on most computers but there are a few that are having an issue (the older ones I’m sure). 5% of the computers (or so) are having serious latency issues with their Citrix applications. I have confirmed that my program is the issue because the Citrix app lags while its running and the problem immediately fixes itself when you close my application, in addition it immediately lags again when you start it back up. My program doesn’t seem to be effected, this only happens when the user is actively using the Citrix app (ie NOT using my program). I make no claims of being an expert programmer and I didn’t really think about system performance when I wrote it (I just assumed any PC could handle it). When I look at system resources I am only taking up 23k (so like the 5-8th program down the list). Is there something I am doing wrong when creating the GUI? I'm assuming there is some standard "you should never do ....when making a UI loop" or something. I have included the part of my program that draws the GUI (all other functions are called on demand or every 2 minutes so are unlikely the issue since this is a constant issue that only appears when my program is NOT being used). Thanks! #include <Array.au3> #include <GuiConstants.au3> #include <GuiConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <guilistview.au3> #include <GuiRichEdit.au3> #NoTrayIcon ;Checks to see if the kill file exsists (for upgrade/hot fix purposes) If FileExists(@scriptdir & "\kill.txt") Then MsgBox(0,"Error", "The system is currently being updated. You will now be logged out.",5) Exit EndIf Opt("GUIOnEventMode", 1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAIN WINDOW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $mainwindow = GuiCreate("Patient Tracker 2.0", @DesktopWidth, @DesktopHeight, 0, 0,BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPCHILDREN)) GUISetOnEvent($GUI_EVENT_CLOSE, "FunClose") GUISetState(@SW_SHOW,$mainwindow) $font = "Comic Sans MS" GUISetFont(12, 400, 0, $font) ; will display underlined characters $btnnew = GUICtrlCreateButton("New",10, 10, 70, 70, $BS_BITMAP) GUICtrlSetImage($btnnew, @ScriptDir & "\Icons\new.bmp") GUICtrlSetOnEvent($btnnew, "FunNew") GUICtrlSetTip($btnnew, "Create New Patient") $btnrefresh = GUICtrlCreateButton("Refresh",90, 10, 70, 70, $BS_BITMAP) GUICtrlSetImage($btnrefresh, @ScriptDir & "\Icons\refresh.bmp") GUICtrlSetOnEvent($btnrefresh, "FunRead") GUICtrlSetTip($btnrefresh, "Refresh List") $btnfilter = GUICtrlCreateButton("Filter",170, 10, 70, 70, $BS_BITMAP) GUICtrlSetImage($btnfilter, @ScriptDir & "\Icons\filter.bmp") GUICtrlSetOnEvent($btnfilter, "FunFilters") GUICtrlSetTip($btnfilter, "Change Filter / Search Criteria") $btnwait = GUICtrlCreateButton("Wait",250, 10, 70, 70, $BS_BITMAP) GUICtrlSetImage($btnwait, @ScriptDir & "\Icons\wait.bmp") GUICtrlSetOnEvent($btnwait, "FunWait") GUICtrlSetTip($btnwait, "Current Wait Time") GUICtrlSetState($btnwait, $GUI_DISABLE) $btnuser = GUICtrlCreateButton(@UserName,@DesktopWidth - 250, 25,200) GUICtrlSetOnEvent($btnuser, "FunChangeUser") GUICtrlSetTip($btnwait, "Current User Name") ; MENU $filemenu1 = GuiCtrlCreateMenu("File") $fileitem11 = GUICtrlCreateMenuItem("New Patient", $filemenu1) GUICtrlSetOnEvent($fileitem11, "FunNew") $fileitem12 = GUICtrlCreateMenuItem("Filter", $filemenu1) GUICtrlSetOnEvent($fileitem12,"FunFilters") $fileitem13 = GUICtrlCreateMenuItem("Exit", $filemenu1) GUICtrlSetOnEvent($fileitem13,"FunClose") $filemenu2 = GuiCtrlCreateMenu("Help") $fileitem21 = GUICtrlCreateMenuItem("What's New", $filemenu2) $fileitem22 = GUICtrlCreateMenu("Reference", $filemenu2) $fileitem221 = GUICtrlCreateMenuItem("Front Desk", $fileitem22) $fileitem222 = GUICtrlCreateMenuItem("Registration", $fileitem22) $fileitem223 = GUICtrlCreateMenuItem("Tech", $fileitem22) GUICtrlSetOnEvent($fileitem21, "FunVersion") GUICtrlSetOnEvent($fileitem221, "FunFront") GUICtrlSetOnEvent($fileitem222, "FunReg") GUICtrlSetOnEvent($fileitem223, "FunTech") ;List Local $iExWindowStyle = BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE) Local $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER) Global $mainlist = GUICtrlCreateListView("", 10, 90, @DesktopWidth - 20, @DesktopHeight - 200, $iExWindowStyle) _GUICtrlListView_SetExtendedListViewStyle($mainlist, $iExListViewStyle) GUICtrlSetOnEvent($mainlist, "FunEdit") $columnlabels = StringSplit(IniRead("listview.ini","LISTVIEW","COLUMNSLABEL","ERROR|ERROR") & "|ID","|") $columnwidth = StringSplit(IniRead("listview.ini","LISTVIEW","COLUMNSWIDTH","100|100") & "|0","|") $i = 1 While $i < UBound($columnlabels) _GUICtrlListView_AddColumn($mainlist, $columnlabels[$i], $columnwidth[$i]) $i = $i + 1 WEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GLOBAL VARIABLES;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Global $dropdown1order Global $tablename = @MDAY Global $varcombo1 Global $varcombo2 Global $varcombo1default Global $varcombo2default Global $varcheckbox1 Global $radio1[10] Global $chkbox1[10] Global $cmbstatus1 Global $cmbstatus2 Global $fieldstring = "ID|LastName|FirstName|Notes|" Global $TheQuery[100] Global $combocheckbox[10] Global $combocheckbox2[10] Global $columnlabels Global $columnwidth Global $columntranslate $columntranslate = IniRead("listview.ini","LISTVIEW", "COLUMNSTRANSLATE", "BLANK") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CHILD PATIENT WINDOW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $childGui2 = GUICreate("Add/Edit Patient", IniRead("Patient.ini", "GUI", "WIDTH", 500), IniRead("Patient.ini", "GUI", "HEIGHT", 500), 100, 100, BitOR($WS_POPUP, $WS_THICKFRAME), $WS_EX_MDICHILD, $mainwindow) $lbllast = GUICtrlCreateLabel("Last Name", 10,10) $iptlast = GUICtrlCreateInput("", 20, 35, 150,20,0x0008) $lblfirst = GUICtrlCreateLabel("First Name", 10,65) $lblID = GUICtrlCreateLabel("",-500,100,0) $iptfirst = GUICtrlCreateInput("", 20, 90, 150,20,0x0008) $btnpromote = GUICtrlCreateButton("Promote",20,250,120) $btnDemote = GUICtrlCreateButton("Demote", 170,250,120) $btnaudit = GUICtrlCreateButton("Audit", 330, 250,120) $iptnotes = GUICtrlCreateInput("",10, 300, 480, 150) $btnaddupdate = GUICtrlCreateButton("Add", 30, 460,150) $btnaddcancel = GUICtrlCreateButton("Cancel", 180, 460,150) $btnaddelete = GUICtrlCreateButton("Delete", 330, 460,150) GUICtrlSetOnEvent($btnDemote,"FunDemote") GUICtrlSetOnEvent($btnpromote,"FunPromote") GUICtrlSetOnEvent($btnaudit,"FunCreateAudit") GUICtrlSetOnEvent($btnaddupdate,"FunAdd_Update") GUICtrlSetOnEvent($btnaddcancel,"FunPTClose") GUICtrlSetOnEvent($btnaddelete,"FunDelete_Update") FunPopulatePatient() ;Loads the patient.ini file to populate the patient window UI ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CHILD FILTER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;only filters on combo1 and checkbox1 at the moment $childGui = GUICreate("Filters", IniRead("Filter.ini", "GUI", "WIDTH",300), IniRead("Filter.ini", "GUI", "Height",300), 300,100,BitOR($WS_POPUP, $WS_THICKFRAME), $WS_EX_MDICHILD, $mainwindow) $childbtnclose = GUICtrlCreateButton("Close Filter Window", 10,270, 280) GUICtrlSetOnEvent($childbtnclose,"FunChildClose") GUICtrlCreateLabel(IniRead("filter.ini", "GUI", "CHECKBOX1LABEL ", "Modality"),10, 10) $lblfilter2 = GUICtrlCreateLabel(IniRead("filter.ini", "GUI", "DROPDOWN1LABEL", "Modality"),IniRead("filter.ini", "GUI", "CHECKBOX1LABELWIDTH ", "Modality") + 25,10) GUICtrlCreateLabel("Auto Refresh (Mins)",10,200) $childcmbtime = GUICtrlCreateCombo("", 10, 220) $refreshtime = 2;IniRead(@scriptdir & "\config\" & @username & ".ini", "Defaults","refresh",0) GUICtrlSetData(-1, "2|3|4|5|6|7|8|9|10", $refreshtime) FunPopulateFilter() ;reads inifiles and sets control FunRead() ;function that queries the database and populates the listbox GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") GUIRegisterMsg($WM_SIZE, "WM_SIZE") $zz = 1 _GUICtrlListView_RegisterSortCallBack($mainlist) While 1 If $zz > $refreshtime * 600 Then If FileExists(@scriptdir & "\kill.txt") Then MsgBox(0,"Error", "The system is currently being updated. You will now be logged out.",5) Exit Else FunRead() $zz = 1 EndIf EndIf Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $mainlist _GUICtrlListView_SortItems($mainlist, GUICtrlGetState($mainlist)) EndSwitch $zz = $zz + 1 ;$msg = GUIGetMsg() Sleep(100) WEnd _GUICtrlListView_UnRegisterSortCallBack($mainlist)
  15. Thanks for the replies! Solution implemented :-).
×
×
  • Create New...