Leaderboard
Popular Content
Showing content with the highest reputation on 12/09/2017 in all areas
-
Keep duplicates from array
Earthshine and one other reacted to rootx for a topic
I'm sorry I have read to fast!!! Your solution.. #include<array.au3> Local $aArray[10] = [1,1,2,3,3,3,3,4,5,5] for $i = ubound($aArray) - 1 to 0 step -1 $aFound = _ArrayFindAll($aArray , $aArray[$i]) $i -= ubound($aFound) - 1 If ubound($aFound) > 1 Then ConsoleWrite("This Value "&$aArray[$aFound[0]] & " Is duplicate N Times " & ubound($aFound)&@CRLF) EndIf next2 points -
This is a program that I made to help my self learn better regular expressions. There are a lot of other programs/website with the similar functions. The main advantage of this program is that you don't have to click a button after every changes. The program detected changes and react on it. Function: Match Match of arrays Match and replace Load source data from website Load source data from a website with GET/POST Load text data from file Clear fields Export and Import settings (you can finish the expression a other time, just export/import it) Cheat sheet DPI aware Generate AutoIt code example code The source code is not difficult and I think most user will understand it. In the zip file there is a export files (reg back example), you can drag and drop this files on the gui to import it. EDIT: Updated to version V1.2.0 Changes are: Expand and collapse of the cheat sheet (Thanks to Melba23 for the Guiextender UDF) Usefull regular expressions websites links included in the program Text data update time EDIT: Updated to version V1.3.0 Changes are: Automatic generate AutoIt code Icons on the tab Few minor bug fixes EDIT: Updated to version V1.4.0 Changes are: Link to AutoIt regex helpfile If the regular expression has a error than the text becomes red Option Offset with Match and array of Matches Option Count with Match and replace Some small minor bug fixed EDIT: Updated to version V1.4.1 Changes are: Small bug in "create AutoIt" code fixed EDIT: Updated to version V1.4.2 Changes are: Small bug in "create AutoIt" code fixed Bug with website data fixed EDIT: Updated to version V1.4.3 Changes are: DPI aware Click function on cheat sheet to insert function in the regex input field (Sourcode, example and compiled exe file) Regex toolkit.zip1 point
-
CompileIt - an experimental AutoIt-to-machine code compiler
Dotaznik reacted to scintilla4evr for a topic
Okay, this is exciting. I'm proud to introduce CompileIt - an experimental compiler, that allows to compile AutoIt to machine code. ...Kind of. CompileIt does compilation in a similar way the Glasgow Haskell compiler does: translates the code into a lower-level language (in CompileIt's case it's C), and then compiles the code in that language. Now, this project is still in its infancy, since, although it is simple to use, AutoIt is incredibly complex on the inside (automation, COM, etc.). So, CompileIt can compile only a very small subset of what we know as AutoIt. Here's a list of things CompileIt (partially) supports (or not): Numbers, booleans, strings Some built-in functions If, For and While statements Exporting DLL functions (you can now write DLL's in AutoIt, guys!) No arrays, automation, GUI or COM. A more detailed list is included with CompileIt. CompileIt is written in AutoIt (the compiler interface), JavaScript (parser, executed with ChakraCore), and of course C. GCC is required to compile scripts. After you extract the files, run CompileIt.exe and configure it to work with GCC.1 point -
Most print preview solutions use the MFC Doc/View architecture which limits it usefulness outside of c++. I found an article where a Delphi programmer used Enhanced Meta Files wrapped in a custom header and packaged together to create a print preview control. After a little more searching, It looks like using EMFs is a solution that would work. Some people suggest to create the document in Word or HTML and use Word or a browser to view it. Indeed, I have rendered documents to HTML and used the IE UDF to display the contents and/or print them. Not quite as ideal as one would like. Using GRS's printwin.au3 as a start, I came up with a print preview solution which others may be able to expand upon. The zip file contains the udf files necessary. Screenshot: Here is an example. #include <WinAPI.au3> #include "WinPrint.au3" #include "Preview.au3" #include "PrintDialog.au3" Global $PixelsPerInchY, $TwipsPerPixelY, $PixelsPerInchX, $TwipsPerPixelX, $PageWidth, $PageHeight ;1 print to default printer ;2 print preview ;3 use the second parameter as the device Context ;anything else, show printer dialog and get device context. _Print(2, 0) _ShowPreview() Func _Print($iMode = 0, $hPrintDC = 0) Local $s_DefaultPrinter, $s_DocName,$DocName, $DOCINFO, $result Switch $iMode Case 1, 2 ;print to default printer $s_DefaultPrinter = _WinSpool_GetDefaultPrinter() If $s_DefaultPrinter = "" Then Return SetError(1, 0, 0) $hPrintDC = _WinAPI_CreateDC("winspool", $s_DefaultPrinter) If $hPrintDC = 0 Then Return SetError(1, 0, 0) Case 3 ;use dc provided If $hPrintDC = 0 Then Return SetError(1, 0, 0) Case Else ;Show printer dialog Local $tPD $hPrintDC = _ShowPrintDialog($tPD) $tPD = 0 If $hPrintDC = 0 Then Return SetError(1, 0, 0) EndSwitch ; get pixel and twips info $PixelsPerInchY = _WinAPI_GetDeviceCaps($hPrintDC, $__WINAPICONSTANT_LOGPIXELSY) ; Get Pixels Per Inch Y $TwipsPerPixelY = 1440 / $PixelsPerInchY $PixelsPerInchX = _WinAPI_GetDeviceCaps($hPrintDC, $__WINAPICONSTANT_LOGPIXELSX) ; Get Pixels Per Inch X $TwipsPerPixelX = 1440 / $PixelsPerInchX ; get page width and height $PageWidth = _WinAPI_GetDeviceCaps($hPrintDC, $HORZRES) ; Get width, in millimeters, of the physical screen $PageHeight = _WinAPI_GetDeviceCaps($hPrintDC, $VERTRES) ; Get height, in millimeters, of the physical screen. Local $hBrush, $hBrushOld, $hLF, $hFont, $hOldFont, $DESIREDFONTSIZE, $s_TextOut Local $OutSize, $xLeft, $yTop, $tLF, $iColorOld, $LastPoint Local $hPen0,$hPen1,$hPen2,$hPen3,$hPen4,$hPen5,$hPen6,$hPen7,$hPen8,$hPen9,$hPenOld ; set docinfo $s_DocName = "Printing from AutoIt with WinAPI" $DocName = DllStructCreate("char DocName[" & StringLen($s_DocName & Chr(0)) & "]") DllStructSetData($DocName, "DocName", $s_DocName & Chr(0)) ; Size of DOCINFO structure ;$DocOutput = DllStructCreate("char DocOutput[" & StringLen($s_DocOutput & chr(0)) & "]") ;DllStructSetData($DocOutput, "DocOutput", $s_DocOutput) $DOCINFO = DllStructCreate($tagDOCINFO) ; Structure for Print Document info DllStructSetData($DOCINFO, "Size", 20) ; Size of DOCINFO structure DllStructSetData($DOCINFO, "DocName", DllStructGetPtr($DocName)) ; Set name of print job (Optional) ;DllStructSetData($DOCINFO, "Output", DllStructGetPtr($DocOutput)) ; Set name of print job (Optional) If $iMode = 2 Then $result += _MetaFile_StartDoc($hPrintDC, $DOCINFO) $result += _MetaFile_StartPage($hPrintDC) Else $result += _WinAPI_StartDoc($hPrintDC, $DOCINFO) ; start new page $result += _WinAPI_StartPage($hPrintDC) EndIf ; create font $DESIREDFONTSIZE = 18 $hFont = _WinAPI_CreateFont((($DESIREDFONTSIZE * - 20) / $TwipsPerPixelY), 0, 0, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Times New Roman') ; set newfont, save old font $hOldFont = _WinAPI_SelectObject($hPrintDC, $hFont) ; print centered test message $s_TextOut = "This is a test..." $OutSize = _WinAPI_GetTextExtentPoint32($hPrintDC, $s_TextOut) ; Compute the starting point for the text-output operation(centered) $xLeft = (($PageWidth / 2) - (DllStructGetData($OutSize, "X") / 2)) ; Compute the starting point for the text-output 2 lines down $yTop = DllStructGetData($OutSize, "Y") * 2 ; Send text $xLeft = Inch2PixelX(0.781250) $yTop = Inch2PixelY(0.260417) $result += _WinAPI_TextOut($hPrintDC, $xLeft, $yTop, $s_TextOut) ; create font structure, rotated 180 degrees $tLF = DllStructCreate($tagLOGFONT) $DESIREDFONTSIZE = 12 DllStructSetData($tLF, "Escapement", 2700) DllStructSetData($tLF, "Height", (($DESIREDFONTSIZE * - 20) / $TwipsPerPixelY)) DllStructSetData($tLF, "Italic", False) DllStructSetData($tLF, "Underline", False) DllStructSetData($tLF, "FaceName", "Arial") ; set font $hLF = _WinAPI_CreateFontIndirect($tLF) $result += _WinAPI_SelectObject($hPrintDC, $hLF) ; Send rotated text to printer, starting at location 1000, 1000 $xLeft = 1000 $yTop = 1000 $s_TextOut = "Testing...123" $result += _WinAPI_TextOut($hPrintDC, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($tLF) DllStructSetData($tLF, "Escapement", 2250) $hLF = _WinAPI_CreateFontIndirect($tLF) $result += _WinAPI_SelectObject($hPrintDC, $hLF) ; Send rotated text to printer, starting at location 1000, 1000 $result += _WinAPI_TextOut($hPrintDC, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * - 20) / $TwipsPerPixelY), 0, 1800, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result += _WinAPI_SelectObject($hPrintDC, $hLF) ; Send rotated text to printer, starting at location 1000, 1000 $result += _WinAPI_TextOut($hPrintDC, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * - 20) / $TwipsPerPixelY), 0, 1500, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result += _WinAPI_SelectObject($hPrintDC, $hLF) ; Send rotated text to printer, starting at location 1000, 1000 $result += _WinAPI_TextOut($hPrintDC, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * - 20) / $TwipsPerPixelY), 0, 1200, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result += _WinAPI_SelectObject($hPrintDC, $hLF) ; Send rotated text to printer, starting at location 1000, 1000 $result += _WinAPI_TextOut($hPrintDC, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * - 20) / $TwipsPerPixelY), 0, 900, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result += _WinAPI_SelectObject($hPrintDC, $hLF) ; set textcolor, save last textcolor $iColorOld = _WinAPI_SetTextColor($hPrintDC, 0xFF0000) ; Send rotated text to printer, starting at location 1000, 1000 $result += _WinAPI_TextOut($hPrintDC, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * - 20) / $TwipsPerPixelY), 0, 600, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result += _WinAPI_SelectObject($hPrintDC, $hLF) ; set textcolor, save last textcolor $result += _WinAPI_SetTextColor($hPrintDC, 0x00FF00) ; Send rotated text to printer, starting at location 1000, 1000 $result += _WinAPI_TextOut($hPrintDC, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * - 20) / $TwipsPerPixelY), 0, 300, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result += _WinAPI_SelectObject($hPrintDC, $hLF) ; set textcolor, save last textcolor $result += _WinAPI_SetTextColor($hPrintDC, 0x0000FF) ; Send rotated text to printer, starting at location 1000, 1000 $result += _WinAPI_TextOut($hPrintDC, $xLeft, $yTop, $s_TextOut) ; update font _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * - 20) / $TwipsPerPixelY), 0, 0, 0, $FW_BOLD, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result += _WinAPI_SelectObject($hPrintDC, $hLF) ; set textcolor, save last textcolor $result += _WinAPI_SetTextColor($hPrintDC, 0x0) ; Send rotated text to printer, starting at location 1000, 1000 $result += _WinAPI_TextOut($hPrintDC, $xLeft, $yTop, $s_TextOut) ; set textcolor $result += _WinAPI_SetTextColor($hPrintDC, 0x0000FF) ; restore original font $result += _WinAPI_SelectObject($hPrintDC, $hOldFont) ; restore original color $result += _WinAPI_SetTextColor($hPrintDC, $iColorOld) ; delete fonts _WinAPI_SelectObject($hPrintDC, $hOldFont) _WinAPI_DeleteObject($hFont) _WinAPI_DeleteObject($hLF) $tLF = 0 ; create pens to draw with (PenStyle, Width, RGB-Color) $hPen0 = _WinAPI_CreatePen($PS_SOLID, 0, 0x000000) $hPen1 = _WinAPI_CreatePen($PS_DASH, 0, 0x000000) $hPen2 = _WinAPI_CreatePen($PS_DOT, 0, 0x000000) $hPen3 = _WinAPI_CreatePen($PS_DASHDOT, 0, 0x000000) $hPen4 = _WinAPI_CreatePen($PS_DASHDOTDOT, 0, 0x000000) $hPen5 = _WinAPI_CreatePen($PS_SOLID, 20, 0x000000) $hPen6 = _WinAPI_CreatePen($PS_SOLID, 40, 0x000000) $hPen7 = _WinAPI_CreatePen($PS_SOLID, 40, 0x0000FF) $hPen8 = _WinAPI_CreatePen($PS_SOLID, 40, 0x00FF00) $hPen9 = _WinAPI_CreatePen($PS_SOLID, 40, 0xFF0000) ; set starting point $LastPoint = DllStructCreate($tagPOINT) $result += _WinAPI_MoveToEx($hPrintDC, 1000, 2000, $LastPoint) ; select pen, save old pen $hPenOld = _WinAPI_SelectObject($hPrintDC, $hPen2) ; draw line $result += _WinAPI_LineTo($hPrintDC, 1100, 3000) ; select pen $result += _WinAPI_SelectObject($hPrintDC, $hPen4) ; draw line $result += _WinAPI_LineTo($hPrintDC, 1200, 2000) ; select pen $result += _WinAPI_SelectObject($hPrintDC, $hPen3) ; draw line $result += _WinAPI_LineTo($hPrintDC, 1300, 3000) ; select pen $result += _WinAPI_SelectObject($hPrintDC, $hPen1) ; draw line $result += _WinAPI_LineTo($hPrintDC, 1400, 2000) ; select pen $result += _WinAPI_SelectObject($hPrintDC, $hPen0) ; draw line $result += _WinAPI_LineTo($hPrintDC, 1500, 3000) ; select pen $result += _WinAPI_SelectObject($hPrintDC, $hPen5) ; draw line $result += _WinAPI_LineTo($hPrintDC, 1600, 2000) ; select pen $result += _WinAPI_SelectObject($hPrintDC, $hPen6) ; draw line $result += _WinAPI_LineTo($hPrintDC, 1700, 3000) ; select pen $result += _WinAPI_SelectObject($hPrintDC, $hPen7) ; draw line $result += _WinAPI_LineTo($hPrintDC, 1800, 2000) ; select pen $result += _WinAPI_SelectObject($hPrintDC, $hPen8) ; draw line $result += _WinAPI_LineTo($hPrintDC, 1900, 3000) ; select pen $result += _WinAPI_SelectObject($hPrintDC, $hPen9) ; draw line $result += _WinAPI_LineTo($hPrintDC, 2000, 2000) ; draw arch connected from current point $result += _WinAPI_SetArcDirection($hPrintDC, $AD_CLOCKWISE) $result += _WinAPI_ArcTo($hPrintDC, 2500, 2000, 3000, 2500, 2500, 2500, 3000, 2500) ; select pen $result += _WinAPI_SelectObject($hPrintDC, $hPen4) ; draw arch $result += _WinAPI_Arc($hPrintDC, 2500, 1000, 3500, 1500, 0, 0, 0, 0) ; select pen $result += _WinAPI_SelectObject($hPrintDC, $hPen5) ; create brush $hBrush = _WinAPI_CreateSolidBrush(0x0000FF) ; select brush $hBrushOld = _WinAPI_SelectObject($hPrintDC, $hBrush) ; draw rectangles $result += _WinAPI_Rectangle($hPrintDC, 3500, 2000, 4500, 2500) $result += _WinAPI_RoundRect($hPrintDC, 3500, 2600, 4500, 3100, 200, 200) ; draw circle $result += _WinAPI_Ellipse($hPrintDC, 3300, 1800, 3700, 2200) ; restore original brush $result += _WinAPI_SelectObject($hPrintDC, $hBrushOld) ; select pen $result += _WinAPI_SelectObject($hPrintDC, $hPen2) $result += _WinAPI_Arc($hPrintDC, 3300, 1900, 3700, 2300, 0, 0, 0, 0) ;============================================================================== ; If $iMode = 2 Then ; End the page $result += _MetaFile_EndPage($hPrintDC) ; start new page $result += _MetaFile_StartPage($hPrintDC) ;Each page is a new dc. Else ; End the page $result += _WinAPI_EndPage($hPrintDC) ; start new page $result += _WinAPI_StartPage($hPrintDC) EndIf _WinAPI_DeleteObject($hLF) $hLF = _WinAPI_CreateFont((($DESIREDFONTSIZE * - 20) / $TwipsPerPixelY), 0, 0, 0, $FW_NORMAL, False, False, False _ , $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') $result += _WinAPI_SelectObject($hPrintDC, $hLF) ; print centered test message $s_TextOut = "This is page 2" $OutSize = _WinAPI_GetTextExtentPoint32($hPrintDC, $s_TextOut) ; Compute the starting point for the text-output operation(centered) $xLeft = (($PageWidth / 2) - (DllStructGetData($OutSize, "X") / 2)) ; Compute the starting point for the text-output 2 lines down $yTop = DllStructGetData($OutSize, "Y") * 2 ; Send text $result += _WinAPI_SetTextColor($hPrintDC, 0x0000FF) $result += _WinAPI_TextOut($hPrintDC, $xLeft, $yTop, $s_TextOut) ; restore original font $result += _WinAPI_SelectObject($hPrintDC, $hOldFont) ; restore original color $result += _WinAPI_SetTextColor($hPrintDC, $iColorOld) ; delete pens _WinAPI_DeleteObject($hPen0) _WinAPI_DeleteObject($hPen1) _WinAPI_DeleteObject($hPen2) _WinAPI_DeleteObject($hPen3) _WinAPI_DeleteObject($hPen4) _WinAPI_DeleteObject($hPen5) _WinAPI_DeleteObject($hPen6) _WinAPI_DeleteObject($hPen7) _WinAPI_DeleteObject($hPen8) _WinAPI_DeleteObject($hPen9) ; delete brush _WinAPI_DeleteObject($hBrush) ; delete font _WinAPI_DeleteObject($hLF) ; restore original font $result += _WinAPI_SelectObject($hPrintDC, $hOldFont) ; restore original pen $result += _WinAPI_SelectObject($hPrintDC, $hPenOld) ; restore original brush $result += _WinAPI_SelectObject($hPrintDC, $hBrushOld) If $iMode = 2 Then ; End the page $result += _MetaFile_EndPage($hPrintDC) ; End the print job $result += _MetaFile_EndDoc($hPrintDC) Else ; End the page $result += _WinAPI_EndPage($hPrintDC) ; End the print job $result += _WinAPI_EndDoc($hPrintDC) ; Delete the printer device context EndIf _WinAPI_ReleaseDC(0, $hPrintDC) _WinAPI_DeleteDC($hPrintDC) Return $result EndFunc ;==>_Print Func Inch2PixelX($iInchesx) Return Int($iInchesx * $PixelsPerInchX) EndFunc ;==>Inch2PixelX Func Inch2PixelY($iInchesy) Return Int($iInchesy * $PixelsPerInchY) EndFunc ;==>Inch2PixelY Some thing that needs to be noted are: Each "page" is a new device context. This is significant in that GDI objects (like fonts and brushes) loaded to the dc are lost with the dc then page ends. I could not find a way to clear the meta file and reuse to device context.The page size is fixed at letter size portrait.Each page is a separate emf file. The meta files are dumped into a temp folder with an ini file. The preview window reads the ini file for the title and page count then loads the preview. When the preview dialog is closed, the meta files and ini are erased. The zip file is here. The zip contains: WinPrint.au3 - GRS's printwin script modified.PrintDialog.au3 -- Show the printer common dialog.MetaFile.au3 -- Windows enhanced meta file api calls in AutoIt3Preview.au3 -- Shows the print preview window.PreviewTest.au3 -- A little demonstration.A basic overview for print preview: Include Preview.au3 Get a handle to a printer device context Setup the DOCINFO structure Use _MetaFIle_StartDoc in place of _WinAPI_StartDoc Use _MetaFile_StartPage in place of _WinAPI_StartPage Draw on the device context use gdi functions. Use _MetaFile_EndPage in place of _WinAPI_EndPage Repeat from _MetaFile_StartPage as necessary. Use _MetaFile_EndDoc in place of _WinAPI_EndDoc Call _ShowPreview() Please look at the example to see how it works. ::eltorro edit: changed topic description, added link to top, added screenshot link.1 point
-
Good coding practices in AutoIt
Earthshine reacted to Skysnake for a topic
From here https://www.autoitscript.com/forum/topic/191475-good-coding-rules-was-case-statement-structure/ By @LarsJ The rule is that Case statements with most events should be in top of the list. Explained by @jchd It isn't a rule, but something you can consider in any on-the-fly interpreted language. Consider this simple sequence: If <Condition> Then [13,000 lines of code] Else [Action] End It's obvious that, unless a form of compilation has taken place which can jump direct to [Action] when <Condition> isn't met, the interpreter will have to read and ignore 13,000 lines, something which wastes time. Hence if you expect the false branch to be significantly more frequent than the true branch, you should swap them and negate Condition. Contributed by @Earthshine Follow Modular design patterns in general. Split things into small autonomous units. Never glom everything into a monolithic structure. (this one is important. Having one place to edit in case of changes instead of many files to edit. maintainability) Use good meaningful variable names Don't get carried away with macros, not to say don't use them Keep functions small, over 50 lines and you need new supporting functions (this works well with C/C++/C# but not sure if applicable to AutoIT and otehr scripting languages, but I try to do this with AutoIT. Most of what makes my functions longer are just logging if they get long in AutoIT cause I am a logging fool Don't follow the Single Entry Single Exit nonsense bullcrap either. If you run into a condition you need to break from the function, then do it Don't use GoTo statements (obviously they lead to spaghetti logic that can't be maintained) Use Constants for strings and stuff that does not change. that way, when something needs to change, it changes in one spot, not many never send an IF to do a SWITCH's (case) job1 point -
Keep duplicates from array
Earthshine reacted to jchd for a topic
Correct, but _ArrayFindAll runs in O². That won't make a difference in small samples but will explode on serious input.1 point -
So why do you delete the Input control and create a new one? This new one is not member of the AAAAA Tab. GUICtrlDelete($dump) $dump= GUICtrlCreateInput($PATH, 150, 90, 120, 20) Why not use the original input control? ;GUICtrlDelete($dump) ;$dump= GUICtrlCreateInput($PATH, 150, 90, 120, 20) GUICtrlSetData($dump,$PATH) A-Jay1 point
-
1 point