florisch Posted June 12, 2007 Posted June 12, 2007 I want to start another app, lets say "B", which gives back data via I/O stream. Therefore the starting script "A" should go on an process the data, but should not allow user interaction while B is running. I used GUISetState(@SW_DISABLE) and GUISetState(@SW_ENABLE). The Problem is: when B stops, A is still disabled and another Window gets focused. Getting the focus back with winactivate causes an unaesthetic flicker. But I cannot enable A before B closes. An idea somebody? Or do I just have to live with it? Here is some code for testing: #include <GUIConstants.au3> $Form1 = GUICreate("A") $BtnA = GUICtrlCreateButton("Normal", 10,10) $BtnB = GUICtrlCreateButton("A disabled", 150,10) GUISetState(@SW_SHOW, $Form1) While 1 ; Main loop, GUI-manager $aGUIMsg = GUIGetMsg(1) select Case $aGUIMsg[0] = $GUI_EVENT_CLOSE Exit Case $aGUIMsg[0] = $BtnA a() Case $aGUIMsg[0] = $BtnB b() EndSelect WEnd Func a() $pid = Run("notepad.exe", @ScriptDir) If @error Then exit While ProcessExists($pid) Sleep(100) WEnd EndFunc Func b() GUISetState(@SW_DISABLE, $Form1) a() GUISetState(@SW_ENABLE, $Form1) WinActivate($Form1) EndFunc
BrettF Posted June 12, 2007 Posted June 12, 2007 I want to start another app, lets say "B", which gives back data via I/O stream. Therefore the starting script "A" should go on an process the data, but should not allow user interaction while B is running. I used GUISetState(@SW_DISABLE) and GUISetState(@SW_ENABLE). The Problem is: when B stops, A is still disabled and another Window gets focused. Getting the focus back with winactivate causes an unaesthetic flicker. But I cannot enable A before B closes. An idea somebody? Or do I just have to live with it? Here is some code for testing: #include <GUIConstants.au3> $Form1 = GUICreate("A") $BtnA = GUICtrlCreateButton("Normal", 10,10) $BtnB = GUICtrlCreateButton("A disabled", 150,10) GUISetState(@SW_SHOW, $Form1) While 1 ; Main loop, GUI-manager $aGUIMsg = GUIGetMsg(1) select Case $aGUIMsg[0] = $GUI_EVENT_CLOSE Exit Case $aGUIMsg[0] = $BtnA a() Case $aGUIMsg[0] = $BtnB b() EndSelect WEnd Func a() $pid = Run("notepad.exe", @ScriptDir) If @error Then exit While ProcessExists($pid) Sleep(100) WEnd EndFunc Func b() GUISetState(@SW_DISABLE, $Form1) a() GUISetState(@SW_ENABLE, $Form1) WinActivate($Form1) EndFunc oÝ÷ Ûú®¢×uÛ(ëax%GºÚ"µÍYÝØÙÜÑ^Ý ][ÝÔØÙÜÓ[YSÙØÜ][ÝÊH[ÕRTÙ]Ý]H Õ×Ñ[XJB[Y into the while loop of process A Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
florisch Posted June 12, 2007 Author Posted June 12, 2007 Add something like: If Not ProcessExist ("ProcessNameOfScriptB") Then GUISetState (@SW_Enable) Endif into the while loop of process A Thats just another place for the GUISetState (@SW_Enable) and of course will be processed _after_ B closes. At this time A is already gone. (Nevertheless, I tried this, and no, it does not change anything.)
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