adamski Posted January 26, 2009 Share Posted January 26, 2009 (edited) I have a small script to copy DXL code from Crimson Editor into my Doors applications code window and press run. It then copys any output and uses consolewrite to put it into Crimson Editors Output pane. Additionally it will ok a runtime error mesage box if there is one. It all worked fine until I wrote some DXL to export alot of data. Because it was slow, the autoit script coppied the output before it had all been writen. The only indication that the code has not finished is that the window has a busy icon (hourglass) and the controls are unclickable. Is there a way to detect this and when it stops? I don't want to use a delay as then it takes that long to show the output with fast scripts. On a vaguely related note: Does anyone have DXL config files for SciTe so I can ditch Crimson Editor? - Or know how to convert the Crimson Editor ones? expandcollapse popup$CrimsonWindow = "Crimson Editor - [" $DoorsWindow = "DXL Interaction - DOORS" If WinExists($CrimsonWindow) Then If WinExists($DoorsWindow) Then $CrimsonText = WinGetText($CrimsonWindow) $CrimsonTextLine = StringSplit ($CrimsonText, @LF) $IncludeString = "#include <" & $CrimsonTextLine[1] & ">" ControlSetText($DoorsWindow, "", "[CLASS:RichEdit20W; INSTANCE:2]", $IncludeString) ControlClick($DoorsWindow, "", "[CLASS:Button; INSTANCE:8]") $DXLOutputText = WinGetText($DoorsWindow) $DXLOutputTextLine = StringSplit ($DXLOutputText, @LF) ConsoleWrite(@LF) For $i = 10 To $DXLOutputTextLine[0]-3 ConsoleWrite($DXLOutputTextLine[$i] & @LF) Next $ErrorWindow = "DOORS report" If WinExists($ErrorWindow) Then ControlClick($ErrorWindow, "", "[CLASS:Button; INSTANCE:1]") ConsoleWrite(@LF & "************************************************************" & @LF) ConsoleWrite("Runtime Error!" & @LF) ConsoleWrite(@LF & "************************************************************" & @LF) EndIf Else ConsoleWrite(@LF & "************************************************************" & @LF) ConsoleWrite("Doors DXL code window '" & $DoorsWindow & "' is not open!" & @LF) ConsoleWrite(@LF & "************************************************************" & @LF) EndIf Else MsgBox(0, "Error", "Crimson Editor must be open with a file loaded!") EndIf Edited January 26, 2009 by adamski Link to comment Share on other sites More sharing options...
KaFu Posted January 26, 2009 Share Posted January 26, 2009 May loop while GUICtrlGetState(ID) = $GUI_DISABLE ? OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
adamski Posted January 26, 2009 Author Share Posted January 26, 2009 May loop while GUICtrlGetState(ID) = $GUI_DISABLE ?Thanks, I'll give it a go at work tomorrow but I'm not convinced it will work. The controls aren't disabled (grayed out), they just cant be clicked - I guess because of the window state. Your suggestion led me to WinGetState so I'll give that a go too. Link to comment Share on other sites More sharing options...
adamski Posted January 27, 2009 Author Share Posted January 27, 2009 (edited) For anybody who is interested: I managed to solve the problem (eventually) with the use of ControlSend. After the window is 'busy' I use ControlSend to write some text to the end of an editable control. I then read the control in a loop until it has been written. This is when the window is released and clickable again. Before this I tried many other methods which all failed: Activate returned sucess whatever the state of the window. WinGetState didn't change throughout. Focus couldn't be used. It seems that ControlSetText works instantly as does ControlClick. A MouseClick only happens when the window is released so that worked but then I had the mouse flying across the screen to the window which was anoying. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.12.1 Author: Adam Cadamally Script Function: Run the file in Crimson Editor as an included DXL code file in the DOORS DXL Interaction window. Copy any Doors DXL output to Crimson Editors output pane. OK a runtime error message box if there is one. #ce ---------------------------------------------------------------------------- ; MAIN PROGRAM $CrimsonWindow = "Crimson Editor - [" $DoorsWindow = "DXL Interaction - DOORS" If WinExists($CrimsonWindow) Then If WinExists($DoorsWindow) Then $CrimsonText = WinGetText($CrimsonWindow) $CrimsonTextLine = StringSplit ($CrimsonText, @LF) $IncludeString = "#include <" & $CrimsonTextLine[1] & ">" ControlSetText($DoorsWindow, "", "[CLASS:RichEdit20W; INSTANCE:2]", $IncludeString) ControlClick($DoorsWindow, "", "[CLASS:Button; INSTANCE:8]") ControlSend ($DoorsWindow, "", "[CLASS:RichEdit20W; INSTANCE:2]", "{END}{ENTER}// ENDED") $DXLOutputText = WinGetText($DoorsWindow) ConsoleWrite(@LF) If StringRight($DXLOutputText, 2) <> ">" & @LF Then $DXLOutputTextLine = StringSplit ($DXLOutputText, @LF) For $i = 10 To $DXLOutputTextLine[0]-4 ConsoleWrite($DXLOutputTextLine[$i] & @LF) Next Else $OutputLineNumber = 11 While StringRight($DXLOutputText, 2) == ">" & @LF $DXLOutputTextLine = StringSplit ($DXLOutputText, @LF) For $i = $OutputLineNumber-1 To $DXLOutputTextLine[0]-4 ConsoleWrite($DXLOutputTextLine[$i] & @LF) Next $OutputLineNumber = $DXLOutputTextLine[0]-2 Sleep(2000) $DXLOutputText = WinGetText($DoorsWindow) WEnd $DXLOutputTextLine = StringSplit ($DXLOutputText, @LF) For $i = $OutputLineNumber-1 To $DXLOutputTextLine[0]-4 ConsoleWrite($DXLOutputTextLine[$i] & @LF) Next EndIf $ErrorWindow = "DOORS report" If WinExists($ErrorWindow) Then ControlClick($ErrorWindow, "", "[CLASS:Button; INSTANCE:1]") ConsoleWrite(@LF & "************************************************************" & @LF) ConsoleWrite("Runtime Error!" & @LF) ConsoleWrite(@LF & "************************************************************" & @LF) EndIf Else ConsoleWrite(@LF & "************************************************************" & @LF) ConsoleWrite("Doors DXL code window '" & $DoorsWindow & "' is not open!" & @LF) ConsoleWrite(@LF & "************************************************************" & @LF) EndIf Else MsgBox(0, "Error", "Crimson Editor must be open with a file loaded!") EndIf Edited January 28, 2009 by adamski 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