dimchik Posted January 23, 2008 Share Posted January 23, 2008 In this code i am trying to create automated program installer for adobe so I check if program already installed and if yes i set background of checkbox to red. And when I do it it blinks very fast. #include <GuiConstants.au3> ;#include <GuiCombo.au3> #Include <GuiStatusBar.au3> ;#include <GUIConstants.au3> #include <array.au3> Opt('MustDeclareVars', 1) Dim $a_check[50], $msg, $ret, $s_attr, $allocated, $Status, $GUI Dim $input, $group, $a_attr, $Combo, $button, $btn_exit, $i, $var6regkey $GUI = GUICreate("Software Installation", 500, 500) $var6regkey=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Adobe Acrobat\6.0\Installer", "ENU_GUID") ;key to identify adobe 6 version $group = GUICtrlCreateGroup("Software options", 10, 20, 480, 445) $a_attr = StringSplit("A,D,H,RO,RW,S,E,Drives,NB,NB,NB,NB", ",") $a_check[0] = 9 $a_check[1] = GUICtrlCreateCheckbox("Adobe Acrobat 6.0 Stnd", 15, 35, 150, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group $button = GUICtrlCreateButton("Install", 240, 335, 120, 40) $btn_exit = GUICtrlCreateButton("Exit", 240, 380, 120, 40) $i=3 GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $btn_exit Exit case $msg=$button call("install") Case BitAND(GUICtrlRead($a_check[1]), $GUI_CHECKED) call("adobe6stndcolor") EndSelect WEnd Exit Func adobe6stndcolor() ;checks if adobe stnd installed and if yes makes checkbox red select case $var6regkey="{AC76BA86-1033-0000-BA7E-000000000001}" GUICtrlSetBkColor($a_check[1], 0xff3030) EndSelect EndFunc Func install() EndFunc Link to comment Share on other sites More sharing options...
stampy Posted January 23, 2008 Share Posted January 23, 2008 From what I can tell, you are checking the checkbox on every loop, then if its checked setting the color on every loop. Might want to check / set color only if it's changed. Link to comment Share on other sites More sharing options...
Achilles Posted January 23, 2008 Share Posted January 23, 2008 (edited) expandcollapse popup#include <GuiConstants.au3> ;#include <GuiCombo.au3> #Include <GuiStatusBar.au3> ;#include <GUIConstants.au3> #include <array.au3> Opt('MustDeclareVars', 1) Dim $a_check[50], $msg, $ret, $s_attr, $allocated, $Status, $GUI Dim $input, $group, $a_attr, $Combo, $button, $btn_exit, $i, $var6regkey $GUI = GUICreate("Software Installation", 500, 500) $var6regkey=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Adobe Acrobat\6.0\Installer", "ENU_GUID");key to identify adobe 6 version $group = GUICtrlCreateGroup("Software options", 10, 20, 480, 445) $a_attr = StringSplit("A,D,H,RO,RW,S,E,Drives,NB,NB,NB,NB", ",") $a_check[0] = 9 $a_check[1] = GUICtrlCreateCheckbox("Adobe Acrobat 6.0 Stnd", 15, 35, 150, 20) GUICtrlCreateGroup("", -99, -99, 1, 1);close group $button = GUICtrlCreateButton("Install", 240, 335, 120, 40) $btn_exit = GUICtrlCreateButton("Exit", 240, 380, 120, 40) $i=3 Dim $highlighted = False; <-- Added this part GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $btn_exit Exit case $msg=$button call("install") Case BitAND(GUICtrlRead($a_check[1]), $GUI_CHECKED) call("adobe6stndcolor") EndSelect WEnd Exit Func adobe6stndcolor();checks if adobe stnd installed and if yes makes checkbox red select case $var6regkey="{AC76BA86-1033-0000-BA7E-000000000001}" If $highlighted = False then GUICtrlSetBkColor($a_check[1], 0xff3030) $highlighted = True EndIf EndSelect EndFunc Func install() EndFuncOnce the checkbox was selected it would continue to set the box to red even though it was already red. This way it works... However I don't think it is very efficient because it is still constantly checking to see if the boolean $highlighted is false, but unless you know how to use GuiRegisterMsg() there's no way (I think) to fix that... Edited January 23, 2008 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
dimchik Posted January 24, 2008 Author Share Posted January 24, 2008 I introduced sleep(100) delay before end of the loop for gui it should slow down blinking drasticly but it slows down the program respons to the close or exit. Link to comment Share on other sites More sharing options...
Achilles Posted January 25, 2008 Share Posted January 25, 2008 I introduced sleep(100) delay before end of the loop for gui it should slow down blinking drasticly but it slows down the program respons to the close or exit.Did you try what I posted? I think it worked well, and you wouldn't get the problem of the program being unresponsive... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] 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