NassauSky Posted September 23 Share Posted September 23 (edited) @argumentum very interesting. OK so I didn't see it that way as far as modifying the original UDF ArrayDisplayInternals.au3 until you clarified it. So OK now that's another option but then if I'm going that far I'd add another button on the _Array_Display for "Hold" in cases that I'm inspecting the array for a bit longer. If I opt for that option, I'll have to share my new UDF with my other endpoints and make sure I update it if there are any more updates to the Autoit core code down the road. Thanks again! Edited September 23 by NassauSky argumentum 1 Link to comment Share on other sites More sharing options...
argumentum Posted September 23 Share Posted September 23 (edited) 39 minutes ago, NassauSky said: ..add another button on the _Array_Display for "Hold" in cases that I'm inspecting the array.. If $aMsg[1] = $hGUI Then Switch $aMsg[0] Case $GUI_EVENT_MINIMIZE If $__g_ArrayDisplay_Timeout_msReturn Or $__g_ArrayDisplay_Timeout_msExit Then $__g_ArrayDisplay_Timeout_msReturn = 0 $__g_ArrayDisplay_Timeout_msExit = 0 WinSetTitle($hGUI, "", '(#) ' & $sTitle) EndIf again, for personal use, you'd minimize and restore to cancel the timeout. Makes the code simple. If there's no one at the keyboard, it'll never minimize on it's own. I think the above is good enough for debugging. Edited September 23 by argumentum added title change Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
ioa747 Posted September 24 Share Posted September 24 (edited) here is a different approach expandcollapse popup; https://www.autoitscript.com/forum/topic/208379-close-_arraydisplay-using-timeout/?do=findComment&comment=1537145 #include <GUIConstantsEx.au3> #include <Array.au3> _ArrayDisplayEx("--ArrayDisplayKiller") Example() Func Example() Local $hGUI = GUICreate("Example", 400, 400) Local $idOK = GUICtrlCreateButton("ArrayDisplay Timeout", 250, 370, 115, 25) GUISetState(@SW_SHOW, $hGUI) Local $aArray[5] = [1, 2, 3, 4, 5] _ArrayDisplayEx($aArray, "Ordinary Array Display") Sleep(2000) _ArrayDisplayEx($aArray, "3second Array Display", 3) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idOK _ArrayDisplayEx($aArray, "Array Display", 3) EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example ;---------------------------------------------------------------------------------------- Func _ArrayDisplayEx($aArray, $sTitle = "Array Display", $iTimeout = 0) Local Static $Watcher = False If $aArray = "--ArrayDisplayKiller" Then If $CmdLine[0] > 0 Then If $CmdLine[1] = "--ArrayDisplayEx" Then If $CmdLine[0] > 1 Then $sTitle = $CmdLine[2] If $CmdLine[0] > 2 Then $iTimeout = $CmdLine[3] Local $hWnd = WinWaitActive($sTitle, "", 5) Sleep($iTimeout * 1000) If $hWnd Then WinClose($hWnd) Exit EndIf EndIf Return EndIf If $iTimeout > 0 Then ConsoleWrite('"' & @AutoItExe & '" "' & @ScriptFullPath & '" --ArrayDisplayEx "' & $sTitle & '" ' & $iTimeout & @CRLF) Run('"' & @AutoItExe & '" "' & @ScriptFullPath & '" --ArrayDisplayEx "' & $sTitle & '" ' & $iTimeout) EndIf _ArrayDisplay($aArray, $sTitle) EndFunc ;==>_ArrayDisplayEx ;---------------------------------------------------------------------------------------- Edited September 24 by ioa747 I know that I know nothing Link to comment Share on other sites More sharing options...
NassauSky Posted September 24 Share Posted September 24 @ioa747 you're function is haunting me. 😁 It opens up an _ArrayDisplay titled "Ordinary Array Display" which doesn't auto close after 3 seconds but if I manually close the _ArrayDisplay it now opens a new _ArrayDisplay titled "3second Array Display" without me hitting the ArrayDisplay Timeout button 😮 After it has a mind of it's own from those last 2 times it auto opened _ArrayDisplay dialogs, it then functions normally after that 😁 Link to comment Share on other sites More sharing options...
ioa747 Posted September 24 Share Posted September 24 the first two calls are to demonstrate how to call _ArrayDisplayEx() ; with out $iTimeout Ordinary Array Display _ArrayDisplayEx($aArray, "Ordinary Array Display") Sleep(2000) ; with $iTimeout 3second Array Display _ArrayDisplayEx($aArray, "3second Array Display", 3) NassauSky 1 I know that I know nothing Link to comment Share on other sites More sharing options...
NassauSky Posted September 24 Share Posted September 24 (edited) @ioa747 aha got it. OK with that being said, it still runs into an issue that the end user needs autoit installed on their PC's (or at least an extra component) Run('"' & @AutoItExe & '" "' & @ScriptFullPath & '" --ArrayDisplayEx "' & $sTitle & '" ' & $iTimeout) and I've been deploying without that requirement. Good to see the option though! Thanks! Edited September 24 by NassauSky Link to comment Share on other sites More sharing options...
IronFine Posted September 24 Share Posted September 24 No, it does not need to be installed. @AutoItExe will will resolved to the FullPath of the executed script, once it is compiled. NassauSky, argumentum and ioa747 2 1 Link to comment Share on other sites More sharing options...
ioa747 Posted September 26 Share Posted September 26 (edited) I added an escape mechanism if click on the ToolTip icon, extend $iTimeout timer += 1 HOUR expandcollapse popup; https://www.autoitscript.com/forum/topic/208379-close-_arraydisplay-using-timeout/?do=findComment&comment=1537145 #include <GUIConstantsEx.au3> #include <Array.au3> #include <Misc.au3> _ArrayDisplayEx("--$CmdLineWatcher") Example() Func Example() Local $hGUI = GUICreate("Example", 400, 400) Local $idOK = GUICtrlCreateButton("ArrayDisplay Timeout", 250, 370, 115, 25) GUISetState(@SW_SHOW, $hGUI) Local $aArray[5] = [1, 2, 3, 4, 5] ;~ ; with out $iTimeout Ordinary Array Display ;~ _ArrayDisplayEx($aArray, "Ordinary Array Display") ;~ Sleep(2000) ;~ ; with $iTimeout 3second Array Display ;~ _ArrayDisplayEx($aArray, "3second Array Display", 3) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idOK _ArrayDisplayEx($aArray, "Array Display", 7) EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example ;---------------------------------------------------------------------------------------- Func _ArrayDisplayEx($aArray, $sTitle = "Array Display", $iTimeout = 0) If $aArray = "--$CmdLineWatcher" Then If $CmdLine[0] And ($CmdLine[1] = "--ArrayDisplayEx") Then If $CmdLine[0] > 1 Then $sTitle = $CmdLine[2] If $CmdLine[0] > 2 Then $iTimeout = $CmdLine[3] Local $hWnd = WinWaitActive($sTitle, "", 5) ; *** <- some Array Displays need much more Local $aWPos = WinGetPos($hWnd) Local $Tick, $sMsg = "", $iflag = 1, $iElapsedTime, $aMPos, $aTPos[4], $bShowMsg Local $hTimer = TimerInit() While WinExists($hWnd) $iElapsedTime = Round(TimerDiff($hTimer) / 1000, 0) ; in seconds If $Tick <> $iElapsedTime Then $Tick = $iElapsedTime If $iElapsedTime > $iTimeout Then ExitLoop If ($iTimeout - $iElapsedTime <= 3) Then $iflag = 2 If ($iTimeout - $iElapsedTime <= 1) Then $iflag = 3 If ($iTimeout - $iElapsedTime <= 10) Then $bShowMsg = True $sMsg = "auto close in " & $iTimeout - $iElapsedTime & " seconds" EndIf If Not WinExists($hWnd) Then ExitLoop $aWPos = WinGetPos($hWnd) If $bShowMsg Then ToolTip("< Click to escape", $aWPos[0] + 8, $aWPos[1] + $aWPos[3] - 44, $sMsg, $iflag) ;$aWPos[0]=Xposition ;$aWPos[1]=Yposition ;$aWPos[2]=Width ;$aWPos[3]=Height ; Set escape clikc area (ToolTip icon) $aTPos[0] = $aWPos[0] + 8 ; Xposition $aTPos[1] = $aWPos[1] + $aWPos[3] - 44 ; Yposition $aTPos[2] = 36 ; Width $aTPos[3] = 36 ; Height $aMPos = MouseGetPos() ; Mouse position ; if MouseOver escape clikc area, and click 01 Left mouse button, then iTimeout += 1 HOUR If $aMPos[0] > $aTPos[0] And $aMPos[1] > $aTPos[1] And $aMPos[0] < $aTPos[0] + $aTPos[2] And $aMPos[1] < $aTPos[1] + $aTPos[3] Then If _IsPressed("01") Then ; 01 Left mouse button $iTimeout += (60 * 60) ; iTimeout += 1 HOUR $bShowMsg = False ToolTip("") EndIf EndIf Sleep(100) WEnd ToolTip("") If WinExists($hWnd) Then WinClose($hWnd) ;~ ToolTip("TimerDiff: " & Round(TimerDiff($hTimer) / 1000, 3) & " seconds ") ;~ Sleep(3000) ;~ ToolTip("") Exit EndIf Return EndIf If $iTimeout > 0 Then ConsoleWrite('"' & @AutoItExe & '" "' & @ScriptFullPath & '" --ArrayDisplayEx "' & $sTitle & '" ' & $iTimeout & @CRLF) Run('"' & @AutoItExe & '" "' & @ScriptFullPath & '" --ArrayDisplayEx "' & $sTitle & '" ' & $iTimeout) EndIf _ArrayDisplay($aArray, $sTitle) EndFunc ;==>_ArrayDisplayEx ;---------------------------------------------------------------------------------------- in this case I run 'ArrayDisplayKiller' in a separate application and the required parameters are $sTitle , $iTimeout , which are easily transferred via $CmdLine But if I wanted to open the ArrayDisplay in a separate application how will I transfer the Array to the other application? I convert it to text to pass it, ... and then from text to Array ? what is the most appropriate way ? Edited September 26 by ioa747 I know that I know nothing Link to comment Share on other sites More sharing options...
argumentum Posted September 26 Share Posted September 26 .. if to keep for later, run _SQLite_Display2DResult() and save to a text file. Or use _ArrayToString() and save it to a file that you can load and read back to array with _ArrayFromString(). And the file name could be: timestamp + @ScriptLineNumber .txt If you make a log file, point to each "array.txt" file you made. The above is because am not sure if you using this for coding or debugging. ioa747 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. 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