pixelsearch Posted January 21, 2019 Share Posted January 21, 2019 (edited) Hi everyone I wanted to display a Msgbox (with Retry/Cancel options) while _ArrayDisplay() is being shown. This allows the user to choose an option, with a complete error message in Msgbox, while he can analyze the results in the _ArrayDisplay() window, scroll into it etc... To try this, this is a quick script I prepared, unfinished, but you got the idea : #include <Array.au3> #include <MsgBoxConstants.au3> Global $aArray[4] = ["element 0", "element 4", "element 2", "element 3"] AdlibRegister("MyAdLibFunc", 500) ; each half second (500ms) _ArrayDisplay($aArray, "Elements") AdlibUnRegister("MyAdLibFunc") Func MyAdLibFunc() If WinExists("Elements") Then AdlibUnRegister("MyAdLibFunc") MsgBox(BitOr($MB_TOPMOST, $MB_RETRYCANCEL), "Error in Array", _ "Element 4 shouldn't be placed in Row 1") WinClose("Elements") EndIf EndFunc ;==>MyAdLibFunc Is there another easy way you're thinking of, instead of using AdlibRegister ? (though it shouldn't consume too much CPU load as it's called each half second) Thanks Edited January 22, 2019 by pixelsearch Link to comment Share on other sites More sharing options...
BrewManNH Posted January 21, 2019 Share Posted January 21, 2019 Don't use _ArrayDisplay for this, create your own listview. _ArrayDisplay is a blocking function and should only be used for troubleshooting an array's contents. If you want your script to do other things while displaying the contents of an array without using a workaround, you should build it yourself. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Nine Posted January 21, 2019 Share Posted January 21, 2019 Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(.....)') _ArrayDisplay (....) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
pixelsearch Posted January 21, 2019 Author Share Posted January 21, 2019 Thanks for your both answers Link to comment Share on other sites More sharing options...
LarsJ Posted January 22, 2019 Share Posted January 22, 2019 Try this: expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #pragma compile(AutoItExecuteAllowed, True) Opt( "MustDeclareVars", 1 ) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <Array.au3> Example() Func Example() Local $hGui = GUICreate( "My GUI", 250, 100 ) GUIRegisterMsg( $WM_USER, "WM_USER" ) Local $sMbTitle = "Error in Array", $sMbText = "Element 4 shouldn't be placed in Row 1" Run( @AutoItExe & ' /AutoIt3ExecuteLine "DllCall(''user32.dll'', ''lresult'', ''SendMessageW'', ''hwnd'', ""' & $hGui & '"", ''uint'', ""' & $WM_USER & '"", ''wparam'', ""' & 0 & '"", ''lparam'', MsgBox( ""' & $MB_TOPMOST+$MB_RETRYCANCEL & '"", ""' & $sMbTitle & '"", ""' & $sMbText & '"" ))"' ) GUISetState() Local $aArray = ["element 0", "element 4", "element 2", "element 3"] _ArrayDisplay( $aArray ) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete( $hGui ) EndFunc Func WM_USER( $hWnd, $iMsg, $wParam, $lParam ) Switch $lParam Case $IDCANCEL ConsoleWrite( "MsgBox Cancel" & @CRLF ) Case $IDRETRY ConsoleWrite( "MsgBox Retry" & @CRLF ) EndSwitch #forceref $hWnd, $iMsg, $wParam EndFunc Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
pixelsearch Posted January 22, 2019 Author Share Posted January 22, 2019 Thanks LarsJ, it works too 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