stafe Posted October 25, 2007 Share Posted October 25, 2007 this is a weird problem and I am at a loss to understand what is going on. The problem is inconsistent and has started when I bought a new or and much faster PC. I have written a little routine that I had been using for some time. What happens is at some stage is through the day when I activate it it comes up in the background and not in focus as it should. Once it starts doing that the only way to rectify the problem is to reboot the machine. I am not sure how to fix it or what is causing it. The code for my routine is as follows:- CODE #include <GuiConstants.au3> #Include <Misc.au3> Sleep(200) Global $mydata2 $myWindow=GUICreate("Insert Pathology Tests", 210, 300) GUISetIcon(@SystemDir & "\mspaint.exe", 0) Sleep(100) $testSelected=GuiCtrlCreateList("", 5, 60, 200, 200) GuiCtrlSetData(-1, "1 Lipid Review|2 Diabetes Review|3 Thyroid Tests|4 Dementia Screen|5 STD Screen|6 Hepatitis Screen|7 Antenatal Screen|8 GTT with insulin levels", "1 Lipid Review") $OK_Btn = GUICtrlCreateButton("OK", 20, 21, 70, 25) $Cancel_Btn = GUICtrlCreateButton("Cancel", 110, 21, 70, 25) Sleep(200) GUISetState(@SW_SHOW, $myWindow) Sleep(200) While 1 $msg = GUIGetMsg() $mydata = GUICtrlRead($testSelected) Select case $mydata = "1 Lipid Review" $mydata2= "FBE/ESR; U&Es&Creat; LFTs; Chol, TG, HDL; FBS" case $mydata = "2 Diabetes Review" $mydata2= "FBE/ESR; U&Es&Creat; LFTs; Chol, TG, HDL; HbA1c; Microalbumin-urine" case $mydata = "3 Thyroid Tests" $mydata2= "TSH; Free T4; Free T3" case $mydata = "4 Dementia Screen" $mydata2= "FBE/ESR; U&Es&Creat; LFTs; Chol, TG, HDL; FBS; B12; Red cell Folate; Ca & PO4; Syphilis (treponema) serology; MSU; TSH" case $mydata = "5 STD Screen" $mydata2= "first catch urine Chlamydia PCR; first catch urine gonorrhoea PCR; HIV; Hep B & C abs and hep B antigen; herpes serology (type 1 &2)" case $mydata = "6 Hepatitis Screen" $mydata2= "Hepatitis A, B & C antibodies and hep B antigen" case $mydata = "7 Antenatal Screen" $mydata2= "MSU; Iron Studies; Blood group and antibodies; Rubella abs(immune status); HIV; Syphilis (treponema) serology, Folic Acid, FBE/ESR, Hep B & C abs and hep B antigen" Case $mydata="8 GTT with insulin levels" $mydata2= "GTT with insulin levels to be done at each time point" EndSelect Select Case $msg = $OK_Btn or _IsPressed ("0D") GUISetState (@SW_MINIMIZE) ExitLoop Case $msg = $Cancel_Btn Or $msg = $GUI_Event_Close Exit EndSelect WEnd Sleep(100) Send($mydata2) Exit Does anyone know what is happening and how to rectify it ? Thanks Stafe Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 25, 2007 Moderators Share Posted October 25, 2007 (edited) I don't really see the issue, but I set WinSetOnTop() in there, and changed your code up to be more proficient (in my eyes at least)expandcollapse popup#include <GuiConstants.au3> #Include <Misc.au3> Global $mydata2 $myWindow = GUICreate("Insert Pathology Tests", 210, 300) GUISetIcon(@SystemDir & "\mspaint.exe", 0) Sleep(100) $testSelected = GUICtrlCreateList("", 5, 60, 200, 200) GUICtrlSetData(-1, "1 Lipid Review|2 Diabetes Review|3 Thyroid Tests|4 Dementia Screen|" & _ "5 STD Screen|6 Hepatitis Screen|7 Antenatal Screen|8 GTT with insulin levels", "1 Lipid Review") $OK_Btn = GUICtrlCreateButton("OK", 20, 21, 70, 25) $Cancel_Btn = GUICtrlCreateButton("Cancel", 110, 21, 70, 25) WinSetOnTop($myWindow, '', 1) GUISetState(@SW_SHOW, $myWindow) While 1 $msg = GUIGetMsg() Select Case $msg = $OK_Btn Or _IsPressed("0D") GUISetState(@SW_MINIMIZE) ExitLoop Case $msg = $Cancel_Btn Or $msg = $GUI_Event_Close Exit Case Else Switch GUICtrlRead($testSelected) Case "1 Lipid Review" $mydata2 = "FBE/ESR; U&Es&Creat; LFTs; Chol, TG, HDL; FBS" Case "2 Diabetes Review" $mydata2 = "FBE/ESR; U&Es&Creat; LFTs; Chol, TG, HDL; HbA1c; Microalbumin-urine" Case "3 Thyroid Tests" $mydata2 = "TSH; Free T4; Free T3" Case "4 Dementia Screen" $mydata2 = "FBE/ESR; U&Es&Creat; LFTs; Chol, TG, HDL; FBS; B12; Red cell Folate; Ca & PO4; Syphilis (treponema) serology; MSU; TSH" Case "5 STD Screen" $mydata2 = "first catch urine Chlamydia PCR; first catch urine gonorrhoea PCR; HIV; Hep B & C abs and hep B antigen; herpes serology (type 1 &2)" Case "6 Hepatitis Screen" $mydata2 = "Hepatitis A, B & C antibodies and hep B antigen" Case "7 Antenatal Screen" $mydata2 = "MSU; Iron Studies; Blood group and antibodies; Rubella abs(immune status); HIV; " & _ "Syphilis (treponema) serology, Folic Acid, FBE/ESR, Hep B & C abs and hep B antigen" Case "8 GTT with insulin levels" $mydata2 = "GTT with insulin levels to be done at each time point" EndSwitch EndSelect WEnd Send($mydata2) Exit Edit: Added codebox tags instead. Edit2: Removed codbox tags .. because it took away spacing. Edited October 25, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now