
Burgaud
-
Posts
129 -
Joined
-
Last visited
Reputation Activity
-
Burgaud reacted to jpm in How to send text to a specific window ?
some control should be reference so controlID is a necessity. AutoIt cannot decide which one.
Use send for this purpose
-
Burgaud reacted to Melba23 in Sort Listview Items Alphabetically
Reinhardt1julian,
Search for "listview sort" in the Help file and _GUICtrlListView_SimpleSort would jump out as a candidate.
M23
-
Burgaud reacted to Musashi in How to exclude ESC from $GUI_EVENT_CLOSE?
Put
Opt("GUICloseOnESC", 0) ;1=ESC closes, 0=ESC won't close somewhere in the top region of your script
-
Burgaud reacted to ioa747 in How to exclude ESC from $GUI_EVENT_CLOSE?
I don't know if there is anything special, but you can with
HotKeySet("{ESC}", "_dumy") Func _dumy() ConsoleWrite("{ESC}" & @CRLF) EndFunc ;==>_dumy
-
Burgaud reacted to trancexx in Avoid "AutoIt Error" message box in unknown errors
Here, let me then:
#include <WinApi.au3> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AddHookApi("user32.dll", "MessageBoxW", "Intercept_MessageBoxW", "int", "hwnd;wstr;wstr;uint") Func Intercept_MessageBoxW($hWnd, $sText, $sTitle, $iType) Local $aCall = DllCall("user32.dll", "int", "MessageBoxW", _ "hwnd", $hWnd, _ "wstr", $sText, _ "wstr", StringReplace($sTitle, "AutoIt", @ScriptName), _ "uint", $iType) If @error Or Not $aCall[0] Then Return 0 Return $aCall[0] EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Let's try it ; Usual message box MsgBox(0, 'Test', 'Some text') ; Cause error that would say some AutoIt shit happened, but now it wouldn't say "AutoIt" DllStructCreate("byte[123456789097]") ; The End ; The magic is down below Func AddHookApi($sModuleName, $vFunctionName, $vNewFunction, $sRet = "", $sParams = "") Local Static $pImportDirectory, $hInstance Local Const $IMAGE_DIRECTORY_ENTRY_IMPORT = 1 If Not $pImportDirectory Then $hInstance = _WinAPI_GetModuleHandle(0) $pImportDirectory = ImageDirectoryEntryToData($hInstance, $IMAGE_DIRECTORY_ENTRY_IMPORT) If @error Then Return SetError(1, 0, 0) EndIf Local $iIsInt = IsInt($vFunctionName) Local $iRestore = Not IsString($vNewFunction) Local $tIMAGE_IMPORT_MODULE_DIRECTORY Local $pDirectoryOffset = $pImportDirectory Local $tModuleName Local $iInitialOffset, $iInitialOffset2 Local $iOffset2 Local $tBufferOffset2, $iBufferOffset2 Local $tBuffer, $tFunctionOffset, $pOld, $fMatch, $pModuleName, $pFuncName Local Const $PAGE_READWRITE = 0x04 While 1 $tIMAGE_IMPORT_MODULE_DIRECTORY = DllStructCreate("dword RVAOriginalFirstThunk;" & _ "dword TimeDateStamp;" & _ "dword ForwarderChain;" & _ "dword RVAModuleName;" & _ "dword RVAFirstThunk", _ $pDirectoryOffset) If Not DllStructGetData($tIMAGE_IMPORT_MODULE_DIRECTORY, "RVAFirstThunk") Then ExitLoop $pModuleName = $hInstance + DllStructGetData($tIMAGE_IMPORT_MODULE_DIRECTORY, "RVAModuleName") $tModuleName = DllStructCreate("char Name[" & _WinAPI_StringLenA($pModuleName) & "]", $pModuleName) If DllStructGetData($tModuleName, "Name") = $sModuleName Then ; function from this module $iInitialOffset = $hInstance + DllStructGetData($tIMAGE_IMPORT_MODULE_DIRECTORY, "RVAFirstThunk") $iInitialOffset2 = $hInstance + DllStructGetData($tIMAGE_IMPORT_MODULE_DIRECTORY, "RVAOriginalFirstThunk") If $iInitialOffset2 = $hInstance Then $iInitialOffset2 = $iInitialOffset $iOffset2 = 0 While 1 $tBufferOffset2 = DllStructCreate("dword_ptr", $iInitialOffset2 + $iOffset2) $iBufferOffset2 = DllStructGetData($tBufferOffset2, 1) If Not $iBufferOffset2 Then ExitLoop If $iIsInt Then If BitAND($iBufferOffset2, 0xFFFFFF) = $vFunctionName Then $fMatch = True; wanted function Else $pFuncName = $hInstance + $iBufferOffset2 + 2 ; 2 is size od "word", see line below... $tBuffer = DllStructCreate("word Ordinal; char Name[" & _WinAPI_StringLenA($pFuncName) & "]", $hInstance + $iBufferOffset2) If DllStructGetData($tBuffer, "Name") == $vFunctionName Then $fMatch = True; wanted function EndIf If $fMatch Then $tFunctionOffset = DllStructCreate("ptr", $iInitialOffset + $iOffset2) VirtualProtect(DllStructGetPtr($tFunctionOffset), DllStructGetSize($tFunctionOffset), $PAGE_READWRITE) If @error Then Return SetError(3, 0, 0) $pOld = DllStructGetData($tFunctionOffset, 1) If $iRestore Then DllStructSetData($tFunctionOffset, 1, $vNewFunction) Else DllStructSetData($tFunctionOffset, 1, DllCallbackGetPtr(DllCallbackRegister($vNewFunction, $sRet, $sParams))) EndIf Return $pOld EndIf $iOffset2 += DllStructGetSize($tBufferOffset2) WEnd ExitLoop EndIf $pDirectoryOffset += 20 ; size of $tIMAGE_IMPORT_MODULE_DIRECTORY WEnd Return SetError(4, 0, 0) EndFunc Func VirtualProtect($pAddress, $iSize, $iProtection) Local $aCall = DllCall("kernel32.dll", "bool", "VirtualProtect", "ptr", $pAddress, "dword_ptr", $iSize, "dword", $iProtection, "dword*", 0) If @error Or Not $aCall[0] Then Return SetError(1, 0, 0) Return 1 EndFunc Func ImageDirectoryEntryToData($hInstance, $iDirectoryEntry) ; Get pointer to data Local $pPointer = $hInstance ; Start processing passed binary data. 'Reading' PE format follows. Local $tIMAGE_DOS_HEADER = DllStructCreate("char Magic[2];" & _ "word BytesOnLastPage;" & _ "word Pages;" & _ "word Relocations;" & _ "word SizeofHeader;" & _ "word MinimumExtra;" & _ "word MaximumExtra;" & _ "word SS;" & _ "word SP;" & _ "word Checksum;" & _ "word IP;" & _ "word CS;" & _ "word Relocation;" & _ "word Overlay;" & _ "char Reserved[8];" & _ "word OEMIdentifier;" & _ "word OEMInformation;" & _ "char Reserved2[20];" & _ "dword AddressOfNewExeHeader", _ $pPointer) Local $sMagic = DllStructGetData($tIMAGE_DOS_HEADER, "Magic") ; Check if it's valid format If Not ($sMagic == "MZ") Then Return SetError(1, 0, 0) ; MS-DOS header missing. Btw 'MZ' are the initials of Mark Zbikowski in case you didn't know. ; Move pointer $pPointer += DllStructGetData($tIMAGE_DOS_HEADER, "AddressOfNewExeHeader") ; move to PE file header ; In place of IMAGE_NT_SIGNATURE structure Local $tIMAGE_NT_SIGNATURE = DllStructCreate("dword Signature", $pPointer) ; Check signature If DllStructGetData($tIMAGE_NT_SIGNATURE, "Signature") <> 17744 Then ; IMAGE_NT_SIGNATURE Return SetError(2, 0, 0) ; wrong signature. For PE image should be "PE\0\0" or 17744 dword. EndIf ; Move pointer $pPointer += 4 ; size of $tIMAGE_NT_SIGNATURE structure ; In place of IMAGE_FILE_HEADER structure ; Move pointer $pPointer += 20 ; size of $tIMAGE_FILE_HEADER structure ; Determine the type Local $tMagic = DllStructCreate("word Magic;", $pPointer) Local $iMagic = DllStructGetData($tMagic, 1) Local $tIMAGE_OPTIONAL_HEADER If $iMagic = 267 Then ; x86 version ; Move pointer $pPointer += 96 ; size of $tIMAGE_OPTIONAL_HEADER ElseIf $iMagic = 523 Then ; x64 version ; Move pointer $pPointer += 112 ; size of $tIMAGE_OPTIONAL_HEADER Else Return SetError(3, 0, 0) ; unsupported module type EndIf ; Validate input by checking available number of structures that are in the module Local Const $IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16 ; predefined value that PE modules always use (AutoIt certainly) If $iDirectoryEntry > $IMAGE_NUMBEROF_DIRECTORY_ENTRIES - 1 Then Return SetError(4, 0, 0) ; invalid input ; Calculate the offset to wanted entry (every entry is 8 bytes) $pPointer += 8 * $iDirectoryEntry ; At place of correst directory entry Local $tIMAGE_DIRECTORY_ENTRY = DllStructCreate("dword VirtualAddress; dword Size", $pPointer) ; Collect data Local $pAddress = DllStructGetData($tIMAGE_DIRECTORY_ENTRY, "VirtualAddress") If $pAddress = 0 Then Return SetError(5, 0, 0) ; invalid input ; $pAddress is RVA, add it to base address Return $hInstance + $pAddress EndFuncedit: because this is better than before. -
Burgaud reacted to JSThePatriot in Append TXT files in one
Or we can go with the AutoIt solution... not really sure which would be faster in your case, but here we are.
Dim $fileAll Dim $lastFile $lastFile = 10 ;This is the number that is on the last file. Ex. ;You have work1.txt thru work11.txt then $lastFile ;should be 11. $fileAll = FileOpen("all.txt", 1) ;Write mode = Append to end of file. For $i = 1 To $lastFile Step 1 FileWrite($fileAll, FileRead("work" & $i & ".txt")) Next FileClose($fileAll)
I hope it helps,
JS
-
Burgaud reacted to jchd in Can you pass an array as a literal in the function call?
You can even streamline things:
$iStat = MyFunc(StringSplit("4|7", "|", $STR_NOCOUNT)) Func MyFunc ($aInputArray) ... EndFunc Bonus: this still allows you to pass an existing array in other invokations.
Drawback: all array entries are string type.
-
Burgaud reacted to RTFC in Code Scanner
Hi Everyone,
This is my first-ever post to this forum, and it's also the first forum I ever joined, after visiting anonymously for some time. I've been very impressed by both the level of expertise and the friendly, helpful, generous, and funny replies to OPs by the large majority of members. My main intention in joining was to share some potentially useful scripts of mine with the community. I've been programming for many years, and since a few months, also in AutoIt. On the other hand, I've no clue about posting stuff, so here goes (fingers crossed):
I wrote this one to help solve dependency issues in some larger AutoIt projects of mine, but it should be equally useful for small/simple projects. It's not meant to replace AU3check, but to provide additional info on your project, and identify *possible* runtime issues that the compiler does not pick up. You then have to figure out yourself whether/where/how to change your code. Also be warned that the file I/O is tectonically slow (definitely room for improvement there).
Download CodeScanner and associated UDFs in the CodeScannerCrypterBundle.
This utility scans an AutoIt code project with multiple #includes and/or UDFs for inconsistencies, clashes, and various other hidden (potential) problems. It also generates MetaCode files for use with CodeCrypter and the MCf library.
It does NOT alter your code; it just reads, evaluates, and reports.
36 Optional Outputs (from version 2.0😞
status report (text file), identifying: missing #includes, duplicate UDFs (lists all occurrences with their resp. parameters); issues with global definitions, unresolved function parameters... searchable treeviews of code architecture (nested #includes, nested function calls (UDF + native AUtoIt); detailed stats for each selected branch (who calls X, who is called by X) array listings (some 2-D) of: identified potential issues; unique #includes, redundant #includes; unique UDFs with calling stats; globals; all locations/definitions of UDF func def/endfunc, all calls, all #includes, all globals, all variables, all literal strings, all native AutoIt functions (with parameters) definition list of all globals identified only within UDFs, written out as script for easy inclusion at top of your script (so all globals are predefined in main code) MetaCode files (see the MetaCode thread (esp. the Tutorial) for details: '?do=embed' frameborder='0' data-embedContent>>) all results can be written to text files and read in to other scripts in their original array formats with an additionally supplied small UDF.
You can edit the code to add more yourself; I'm gradually extending its functionality as/when required for my own projects.
Hope it helps!
-
Burgaud reacted to seadoggie01 in need help with regex
I guess since y'all are using StringRegExpReplace, yes. However, if you use StringRegExp instead, then you don't have to worry about it.
Local $aRet = StringRegExp($sText, "(CPU\s+.*)", 3) return $aRet[0] ; Or, if you're feeling daring, assume that you always want the first line... Local $aRet = StringRegExp($sText, "(.*)", 3) return $aRet[0] As an added bonus, I got it in 4 characters, @Musashi
-
Burgaud reacted to Musashi in need help with regex
Isn't there still a .* missing before (CPU.*?°C) ? Otherwise the lines before the "CPU line" are included.
Example :
Local $sText, $sTextNew $sText = "some text before CPU line" & @CRLF & _ "CPU 51°C" & @CRLF & _ "GPU 45°C" & @CRLF & _ "C0% 9.6" & @CRLF & _ "MHz 2968" & @CRLF & _ "FID 29.75" ConsoleWrite("----> Original : ------------------------------------- " & @CRLF) ConsoleWrite($sText & @CRLF) ConsoleWrite("----> Marc : ----------------------------------------- " & @CRLF) $sTextNew = StringRegExpReplace($sText,"(?s)(CPU.*?°C).*", "$1") ConsoleWrite($sTextNew & @CRLF) ConsoleWrite("----> Musashi : -------------------------------------- " & @CRLF) $sTextNew = StringRegExpReplace($sText,"(?s).*(CPU.*?°C).*", "$1") ConsoleWrite($sTextNew & @CRLF) -> Output :
Now we only have to wait for @mikell , who will provide a pattern which is only 5 characters long .
-
Burgaud reacted to Marc in need help with regex
$text = StringRegExpReplace($text,"(?s)(CPU.*?°C).*", "$1") Try this way
-
Burgaud got a reaction from seadoggie01 in Please explain GUICtrlCreateDummy , GUICtrlSendToDummy.
I have no idea what these two functions do..
Please explain.
Sample script direct from the help file:
#include <GUIConstantsEx.au3> Example() Func Example() GUICreate("GUICtrlCreateDummy", 250, 200, 100, 200) GUISetBkColor(0x00E0FFFF) ; will change background color Local $idUser = GUICtrlCreateDummy() Local $idButton_Event = GUICtrlCreateButton("event", 75, 170, 70, 20) Local $idButton_Cancel = GUICtrlCreateButton("Cancel", 150, 170, 70, 20) GUISetState(@SW_SHOW) Local $idMsg ; Loop until the user exits. Do $idMsg = GUIGetMsg() Select Case $idMsg = $idButton_Event GUICtrlSendToDummy($idUser) Case $idMsg = $idButton_Cancel GUICtrlSendToDummy($idUser) Case $idMsg = $idUser ; special action before closing ; ... Exit EndSelect Until $idMsg = $GUI_EVENT_CLOSE EndFunc ;==>Example
What does GUICtrlSendToDummy($idUser) actually do?
-
Burgaud reacted to LarsJ in Using controls to edit cells in a listview
In the forums you can find several questions about how to edit the text in a ListView cell with a standard control eg. an Edit control or a ComboBox. The zip below contains three examples with an Edit control, a ComboBox and a DateTimePicker.
How?
A description from MicroSoft of how to edit a ListView cell with a ComboBox can be found here. When you click a cell the position and size is calculated, and the ComboBox is created on top of the cell. The text is shown in the Edit box. You can edit the text or select a value in the Listbox. Press Enter to save the text in the ListView cell and close the ComboBox. The ComboBox exists only while the text is edited.
Code issues
Especially because the control to edit the ListView cell is created on top of the ListView and is not part of the ListView, there are some issues you should be aware of. To get everything to look as good as possible most actions should be carried out when a mouse button is pressed and not when it's released. You should also be aware that the new code you add, does not conflict with existing functionality for example multiple selections. The examples consists of small but fairly many pieces of code to respond to events and messages.
Keyboard support
To edit a text value you are more or less forced to use the keyboard to type in the text. It would be nice if you could also select the current cell in the ListView with the keyboard.
Cell selection with the keyboard is not too hard to implement with custom draw code. The current cell is drawn with a specific background color. It looks like this. You can select the current cell with the arrow keys.
Open the control
There must be a way to initiate the creation of the control. This is typically done with a single or double click in the ListView. Or with Enter or Space key in the examples with keyboard support. Default in the examples is double click and Enter key. You can change this in global variables in top of the scripts.
A WM_NOTIFY message handler created with GUIRegisterMsg is used to watch for single and double click in the ListView. This message handler is also used to handle custom draw messages for keyboard support.
Because the control is created on top of the ListView cell, it's very important that the ListView is set as the parent window. This ensures that mouse clicks and key presses are captured by the control and not by the ListView.
Events in the control
In a ComboBox and a DateTimePicker an additional control (Listbox and MonthCal, respectively) is opened if you click the Dropdown arrow (or press <Alt+Down arrow> on the keyboard). Click the Dropdown arrow again to close the control (or press <Alt+Up arrow> on the keyboard).
The interesting messages (DROPDOWN, SELECTION, CLOSEUP) from such an additional control are usually contained in WM_COMMAND or WM_NOTIFY messages which are sent to the parent window. The parent window is the ListView. To catch the messages the ListView must be subclassed.
Messages from the Edit control, the Edit box of the ComboBox, or the client area of the DateTimePicker are catched by subclassing the controls (Edit control, Edit box and DateTimePicker) directly. The interesting information here is dialog codes to accept (Enter) or cancel (Esc) the value and close the control. Dialog codes are sent as $WM_GETDLGCODE messages.
In all examples the value in the control can also be accepted and saved with a double click.
Close the control
A mouse click in the ListView outside the control should close the control and cancel editing of the current cell. Because the control is not part of the ListView in particular mouse clicks on the Scrollbars should close the control immediately. The control will not be repainted properly on scrolling.
Mouse clicks in the ListView and on Scrollbars can be identified by WM_LBUTTONDOWN and WM_NCLBUTTONDOWN messages. The area which is filled by Scrollbars in a ListView is non-client area. Mouse clicks in non-client area generates WM_NCLBUTTONDOWN messages. To catch the messages you have to subclass the ListView.
A mouse click in the GUI outside the ListView and in non-client GUI area (eg. the Titlebar) should also close the control. Mouse clicks in GUI are catched through GUI_EVENT_PRIMARYDOWN messages. Mouse clicks in non-client GUI area are catched through WM_NCLBUTTONDOWN messages by subclassing the GUI.
Finish the code
A great part of the code is running in message handlers created with GUIRegisterMsg or created by subclassing a window. Lengthy code to open or close the control should not be executed in these message handlers. Instead of a message is sent to the AutoIt main loop where the control is opened or closed.
Some of the message handlers are only needed while the control is open. They are created and deleted as part of the control open and close code.
In the context of the updates May 26 the $LVS_EX_HEADERDRAGDROP extended style (rearranging columns by dragging Header items with the mouse) is added to all ListViews. See post 20 and 21.
A few lines of code are added to better support usage of the keyboard. See image above. The code provides for horizontal scrolling of the ListView to make sure that a subitem (or column) is fully visible when it's selected with left or right arrow. Among other things, the code takes into account rearranging and resizing of columns as well as resizing of the GUI and ListView. A new example EditControlKeyboardTenCols.au3 demonstrates the features. See post 22.
A few lines of code is added to handle multiple selections. Multiple selections is enabled in all examples.
Pressing the Tab key in the control closes the control.
The image shows a DateTimePicker control.
Zip file
The zip contains three examples with an Edit control, a ComboBox and a DateTimePicker. For each control there are two scripts with and without keyboard support. In the script with keyboard support you can select the current cell in the ListView with the arrow keys and open the control with the Enter (default) or the Space key.
You need AutoIt 3.3.10 or later. Tested on Windows 7 32/64 bit and Windows XP 32 bit.
Comments are welcome. Let me know if there are any issues.
(Set tab width = 2 in SciTE to line up comments by column.)
ListViewEditingCells.7z
-
Burgaud reacted to AZJIO in Using _GUICtrlListView_EditLabel to edit ANY item!
SYRAU3
http://pastebin.com/WhPLnjRN
-
Burgaud reacted to Melba23 in GUIListViewEx - New Version 11Dec 24
[New VERSION] - 11 Dec 24
Added: New function _GUIListViewEx_EditProcessActive which returns the handle of the ListView concerned if an element is being edited. Usage scenario: prevent HotKeys from working when editing is underway.
Fixed: A couple of bugs with columns: added columns were automatically sortable; dragging columns meant editing pop-up could appear in wrong place. Thanks to ValentinM for the reports.
New UDF in the zip below.
--------------------------------------------------------------------------------------
Note: This is a new recoded and expanded version of my earlier UDF of the same name. If you move to this new version there might well be several script-breaking changes, particularly when setting which columns are to be editable. Please read the "Beginner's Guide" and look at the included example scripts to see where things have changed.
--------------------------------------------------------------------------------------
This UDF allows you to do much more with ListView controls (either native or UDF created):
Edit the content with plain text, combos or date-time pickers - and edit the headers too Move rows within the ListView Drag rows both within the ListView and to other ListViews in the same GUI (or not as required) Insert and delete columns and rows Sort columns by simply clicking the header Colour individual ListView items and headers Only select a single cell rather then the entire row Save and load entire ListViews For the advanced user: If you use certain Windows message handlers (In particular WM_NOTIFY) in your script, please read the function headers for the equivalent handlers within the UDF.
Here is the UDF, with 6 examples and the guide, in zip format: GUIListViewEx.zip
Credit to: martin (basic drag code), Array.au3 authors (array functions), KaFu and ProgAndy (font function), LarsJ (colouring code)
Happy to take compliments or criticism - preferably the former!
M23
-
Burgaud reacted to Subz in ugly TAB resizing
You can use GuiResizeMode to stop the controls moving for example:
Opt("GUIResizeMode", 802) You can also use GUICtrlSetResizing to change specific controls resizing.
-
Burgaud reacted to TreatJ in Double Click Detection in a ListView
😀 This is the very first time I have posted anything on this Forum. I have been using AutoIt since 2006 believe it or not
I have attached a script here that holds info that may help someone who is having a hard time understanding how to
detect double clicking inside a ListView. It has lots (and I mean lots!) of comments through out the script. Hope this helps!
DoubleClickListView.au3
-
Burgaud reacted to Subz in _ArrayAdd() not incrementing array size?
You would need to update the first array item using something like:
$GROUP[0][0] = Ubound($GROUP) - 1 Or you can use Ubound for looping
For $i = 1 To Ubound($GROUP) - 1 ConsoleWrite($GROUP[$i][0] & @CRLF) Next
-
Burgaud reacted to Dan_555 in How to HotkeySet RightCtrl-x?
Hi,
you could use the GUISetAccelerators instead of hotkey. (maybe)
-
Burgaud reacted to argumentum in _Timer_SetTimer and AdlibRegister
I owe you an apology. My assumption was based due to inexperience with timers.
The only way to have a reliable timer is with WM_TIMER.
So use Adlib unless, you must stop the world. Then, if you must, use _WinAPI_SetTimer/_WinAPI_KillTimer with WM_TIMER as shown in the link above.
The reason is described here.
-
Burgaud reacted to water in Need help understanding _Singleton()
Exactly.
_Singleton uses parameter 1 to identify a script instance. It doesn't matter which script uses the identifier.
-
Burgaud reacted to TheXman in problem with $aArray = WinList()
Because the array created by WinList has 2 columns (Title & Hwnd). You attempted to place a value (Window state) in a non-existent 3rd column. One way to do what you are trying to do is to add a 3rd column to the array by using ReDim and then add your window states.
#include <Array.au3> #include <Process.au3> #include <WinAPIProc.au3> Global $aArray = WinList() ;$aArray[0][0] = Number of windows returned ;$aArray[1][0] = 1st window title ;$aArray[1][1] = 1st window handle (HWND) ReDim $aArray[UBound($aArray)][3] ;Add 3rd column to the WinList array For $i = 1 To $aArray[0][0] $aArray[$i][2] = WinGetState($aArray[$i][1]) Next _ArrayDisplay($aArray, "WinList", "", 0, Default, "Title|Hwnd|State")
-
Burgaud reacted to JockoDundee in How do you know if a running app is a game?
Child processes can be hard to track
-
Burgaud reacted to mikell in Ubound($array) vs $array[0]
Whatever way is the most suitable to use, this should always be done anyway, as it is THE best coding practice
-
Burgaud reacted to Musashi in Ubound($array) vs $array[0]
Using UBound($Array) or $Array[0] is not a question of "better coding practice".
It depends on how the array was created. Let's take a 1-Dim array as an example. In functions you can often specify the structure with a parameter, see $STR_NOCOUNT / $STR_COUNT.
If the number of elements is specified in the [0] index, then use $Array[0]. If index [0] already contains the first data element then use UBound (simplified description).
@Burgaud : This is important, e.g. when applying StringSplit to an empty string. IsArray() indicates Success, but @error does not.
#include <Array.au3> Global $sStr, $aArr, $sDelimiter, $iAtError $sDelimiter = "," ; ---- string is empty ---- $sStr = "" $aArr = StringSplit($sStr, $sDelimiter) $iAtError = @error ConsoleWrite("> >> String = " & $sStr & @CRLF) ConsoleWrite(" >> @error = " & $iAtError & " (0=No Error , 1=Error)" & @CRLF) ConsoleWrite(" >> IsArray = " & IsArray($aArr) & " (1=Success , 0=Failure) " & @CRLF) ; ---- string is not empty ---- $sStr = "Have,a,nice,day" $aArr = StringSplit($sStr, $sDelimiter) $iAtError = @error ConsoleWrite("> >> String = " & $sStr & @CRLF) ConsoleWrite(" >> @error = " & $iAtError & " (0=No Error , 1=Error)" & @CRLF) ConsoleWrite(" >> IsArray = " & IsArray($aArr) & " (1=Success , 0=Failure) " & @CRLF)