Leaderboard
Popular Content
Showing content with the highest reputation on 01/21/2023 in all areas
-
This UDF contains functions to make the handling of arrays more effective and elegant. Besides functions which are inspired by Python's range-create and its array-slicing, most of the functions are based on the principle of being able to specify user-defined functions for subtasks. E.g. with the classic _ArraySort() it is not possible to sort "naturally" or to sort 2D arrays by multiple columns or instead by string length or or or... With these functions here you can usually realize this in only one function call. Also the possibility to display arrays nicely formatted as string (quasi the counterpart to _ArrayDisplay) was missing until now. The function list of the UDF: Therefore, here are a few code examples for selected functions: _ArrayCreate(): _ArraySlice(): _Array2String(): _ArraySortFlexible(): _ArrayBinarySearchFlex(): _ArrayGetNthBiggestElement(): >>sourcecode and download on github<<2 points
-
Assigning variables to an array
SOLVE-SMART and one other reacted to abberration for a topic
Perhaps the easiest way to create an array: #include <Array.au3> $array = StringSplit("one|two|three|birds in a tree", "|", $STR_NOCOUNT) _ArrayDisplay($array)2 points -
Collection of GitHub users (with AutoIt projects)
teodoric666 reacted to SOLVE-SMART for a topic
Hi folks ๐ , I know about several of us do have AutoIt projects on GitHub. In this hopefully growing collection I want to list forum members and their GitHub projects (AutoIt based). Why? One use case could be the contribution to some of their projects. Assume that AutoIt projects are not that wide spreaded or supported in terms of contribution (participation), as JavaScript projects for example. Wouldn't it be nice to get more contribution on your project? Wouldn't it be nice to work on bigger projects in a community? I personally would love to ๐ . Disclaimer: As the GitHub profiles (and repositories), I will list here, are public and your profiles either findable by your signature, your "About Me" page or by a simple Google or GitHub search ๐ , I see no restriction to collect these kind of information and post it here. In case you don't agree with this visualisation and you don't want to be listet here, please let me know and I will remove that entry as soon as possible ๐ค . I really hope that fits your feeling about it. Collection (in progress): @Forum username ยป GitHub username ยป Link to the GitHub projects (filtered by language=autoit) @Alan72104 ยป Alan72104 ยป Projects @alexanr1 ยป alexanr1 ยป Projects @AspirinJunkie ยป Sylvan86 ยป Projects @Centrally ยป ellysh ยป Projects @Danp2 ยป Danp2 ยป Projects @Danyfirex ยป DanysysTeam ยป Projects @DonChunior ยป DonChunior ยป Projects @ergo ยป seizu ยป Projects @genius257 ยป genius257 ยป Projects @J2TeaM ยป J2TEAM ยป Projects @James ยป jbrooksuk ยป Projects @Jefrey ยป jesobreira ยป Projects @jvanegmond ยป jvanegmond ยป Projects @kurtykurtyboy ยป KurtisLiggett ยป Projects @lamnhan066 ยป lamnhan066 ยป Projects @LinkOut ยป xLinkOut ยป Projects @LoganCH ยป loganch ยป Projects @Mat ยป MattDiesel ยป Projects @Mateocedillo ยป rmcpantoja ยป Projects @matwachich ยป matwachich ยป Projects @mLipok ยป mlipok ยป Projects @MrKm ยป MurageKabui ยป Projects @NHD ยป nomi-san ยป Projects @oHenry ยป htejera ยป Projects @OvisMaximus ยป OvisMaximus ยป Projects @philpw99 ยป philpw99 ยป Projects @rcmaehl ยป rcmaehl ยป Projects @Rurorita ยป OfficialLambdax ยป Projects @rynow ยป 4ern ยป Projects @scintilla4evr ยป scidsgn ยป Projects @seadoggie01 ยป seadoggie01 ยป Projects @seangriffin ยป seanhaydongriffin ยป Projects @smbape ยป smbape ยป Projects @SOLVE-SMART ยป Sven-Seyfert ยป Projects @Stilgar ยป THWillert ยป Projects @Surya ยป thesunRider ยป Projects @tarretarretarre ยป tarreislam ยป Projects @TheDcoder ยป TheDcoder ยป Projects @TheSaint ยป Twombs ยป Projects @trancexx ยป dragana-r ยป Projects @vietanhdev ยป vietanhdev ยป Projects ฮฃ = 41 I would love to see the list growing and I am very excited about a possibly upcoming behavior and improvement change, regarding AutoIt on GitHub ๐ . ๐ก Please help me to increase the list. Either by your GitHub link (profile) or through a link from a member you know. Best regards Sven ________________ Stay innovative!1 point -
read and write xlsx files without Excel
funkey reacted to AspirinJunkie for a topic
This UDF provides 2 functions to read data directly from xlsx files or to output data as xlsx file. Only the cell contents are considered - no cell formatting and the like. It is therefore explicitly not a full replacement for the Excel UDF, since its scope goes well beyond that. But to quickly read in data or to work with xlsx files without having Excel installed, the UDF can be quite useful. There may also be specially formatted xlsx files which I have not yet encountered during testing and which may cause problems. In this case it is best to make a message about it here and upload the file. Note: xlsx files must be unpacked for reading. To make this as fast as possible it is recommended to put a >>7za.exe<< file into the script directory, otherwise a slow alternative will be used. Otherwise an example says more than 1000 words: >>sourcecode and download on github<< Changelog:1 point -
Program crashing when I change which window is in focus.
pixelsearch reacted to Nine for a topic
The color you specify in _GDIPlus_GraphicsClear needs to be the same as the transparent color you use (in my case I decided to use 0000FF instead of ABCDEF -- so it must be FF0000FF in GraphicClear). ps. I kind of busy right now -- I'll test your modification later, if you don't mind1 point -
Program crashing when I change which window is in focus.
pixelsearch reacted to ioa747 for a topic
now work Ver: 3.3.16.11 point -
A Non-Strict JSON UDF (JSMN)
argumentum reacted to BrunoJ for a topic
I've solved it by looking at more postings by people looking for help. I can use dot notation to retrieve the values. This works: #include <Json.au3> Local $TestString = 'headerName:"Item Title", field:"ItemTitle", sortable:true, width:259, checkboxSelection:true, headerCheckboxSelection:true' local $Obj = Json_Decode('{' & $TestString & '}') Local $TestResult = Json_Get($Obj, '.headerName') msgbox(0,"Test", "$TestResult = " & $TestResult)1 point -
Collection of GitHub users (with AutoIt projects)
SOLVE-SMART reacted to Mateocedillo for a topic
Hi @SOLVE-SMART, Thanks for the collection, I'm on the list and it's also appreciated. Currently, I'm working on a project in au3, which I will publish soon once I finish fixing many bugs. Also, I apologize. I admit my above code isn't the best in the world, but I'm open to pull requests for improvements.1 point -
Program crashing when I change which window is in focus.
Nine reacted to pixelsearch for a topic
@Nine do you think the following script could be used as a 1st step ? It's based on your idea of using _WinAPI_WindowFromPoint() to retrieve any handle found at cursor position. ; 1st script ; ========== #include <GDIPlus.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) HotKeySet("{ESC}", "_Quit") ; <=================== Global $hGUI, $hGraphic, $hPen _Main() Func _Main() Local $aMPos, $aWPos, $hWnd = 0, $hWnd_Old = -1 ; Create a transparent GUI covering the desktop $hGUI = GUICreate("GDI+", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetBkColor(0xABCDEF) _WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF) ; Create a structure that defines any point to be checked. Local $tPoint = DllStructCreate($tagPOINT) _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hPen = _GDIPlus_PenCreate(0xFFFF0000, 4) ; alpha channel = 0xFF (opaque), red = 0xFF0000, width = 4 (pixels) GUISetState(@SW_SHOW, $hGUI) While 1 $aMPos = MouseGetPos() DllStructSetData($tPoint, "x", $aMPos[0]) DllStructSetData($tPoint, "y", $aMPos[1]) $hWnd = _WinAPI_WindowFromPoint($tPoint) If $hWnd <> $hWnd_Old Then ; _WinAPI_RedrawWindow($hGUI) ; works with AutoIt 3.3.14.5, not with 3.3.16.1 ; e.g. ; _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_INVALIDATE + $RDW_ERASE) ; flags 0x01 + 0x04 (default) ; _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_INVALIDATE + $RDW_ERASE + $RDW_UPDATENOW) ; works with both versions of AutoIt ; _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_INVALIDATE + $RDW_ERASE + $RDW_ERASENOW) ; works with both versions of AutoIt _GDIPlus_GraphicsClear($hGraphic, 0xFFABCDEF) ; Nine's way (works with both versions of AutoIt) $aWPos = WinGetPos($hWnd) _GDIPlus_GraphicsDrawRect($hGraphic, $aWPos[0], $aWPos[1], $aWPos[2], $aWPos[3], $hPen) ; ToolTip("Ctrl ID = " & _WinAPI_GetDlgCtrlID($hWnd)) ; shouldn't be used for top-level windows $hWnd_Old = $hWnd EndIf Sleep(10) WEnd EndFunc ;==>_Main Func _Quit() ; Clean up resources _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ShutDown() GUIDelete($hGUI) Exit EndFunc ;==>_Quit1 point -
This is not what you use subsequently. You use (x/(x + y))*((x - 1)/(x + y - 1)) As @pixelsearchadvised, compute separately numerator and denominator, and only then perform the final division. Note that this is essentially what you show in your examples in the picture joined. Since you only expect a result exactly = 1/2, you should make your life easier by computing the inverse fraction ((x + y)/x)*((x + y - 1)/(x - 1)) in the form ((x + y)*(x + y - 1))/(x*(x - 1)) and comparing to 2. Your computation remains then in โค unless the result != 2 For $x = 1 To 1000 For $y = 1 To 1000 If (($x + $y)*($x + $y - 1))/($x*($x - 1)) = 2 Then ConsoleWrite("(" & $x & ", " & $y & ") verifies the condition" & @LF) EndIf Next Next (3, 1) verifies the condition (15, 6) verifies the condition (85, 35) verifies the condition (493, 204) verifies the condition Note also you can spare the division: For $x = 1 To 1000 For $y = 1 To 1000 If (($x + $y)*($x + $y - 1)) = 2*($x*($x - 1)) Then ConsoleWrite("(" & $x & ", " & $y & ") verifies the condition" & @LF) EndIf Next Next1 point
-
WebDriver UDF - Help & Support (IV)
DoVinhTrung reacted to Danp2 for a topic
@DoVinhTrungYou could run the browser in "headless" mode, where the browser isn't shown at all. There's an FAQ in the wiki that covers that. I believe it has also been discussed elsewhere in this forum. P.S. It's best if you can paste without formatting when you use a language translator. That should avoid the white background and the oversized text.1 point -
read and write xlsx files without Excel
dmob reacted to AspirinJunkie for a topic
A good suggestion - it goes on my to-do list. First and foremost, I'm not 100% sure about the compatibility with as many xlsx subformats as possible. The internal structure can be very different, so I can't guarantee that the UDF can handle all of them. At least it has been able to handle all the files I have fed it so far.1 point -
Function hints in SciTe for user functions (like intellisense)
SkysLastChance reacted to Jos for a topic
The version I am working on will. It will dynamiccally add funcs from the current script when you save it. No firm eta yet. At this moment you can only statically add your own funcs as described in the helpfile that comes with the current full version of scite4autoit3.1 point -
Drawing a rectangle to select an area
pixelsearch reacted to Melba23 for a topic
marko001, Here is my contribution - it uses a context menu to display and capture the coordinates once the rectangle is dragged to the correct place: #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPISysWin.au3> Global $hCapture_GUI _Main() Func _Main() ; Create GUI Local $hMain_GUI = GUICreate("Select Rectangle", 240, 50) Local $hRect_Button = GUICtrlCreateButton("Mark Area", 10, 10, 80, 30) Local $hCancel_Button = GUICtrlCreateButton("Cancel", 150, 10, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $hCancel_Button Exit Case $hRect_Button GUISetState(@SW_HIDE, $hMain_GUI) Local $aCoords = Mark_Rect() ; Show selected coords MsgBox($MB_SYSTEMMODAL, "Coords", $aCoords[0] & "x" & $aCoords[1] & @CRLF & $aCoords[0] + $aCoords[2] & "x" & $aCoords[1] + $aCoords[3]) GUISetState(@SW_SHOW, $hMain_GUI) EndSwitch WEnd EndFunc ;==>_Main ; ------------- Func Mark_Rect() ; Create capture GUI $hCapture_GUI = GUICreate("Y", 300, 200, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetBkColor(0xABCDEF) ; Create label for dragging Local $cLabel = GUICtrlCreateLabel("", 0, 0, 300, 200, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, 0xFF0000) ; Create context menu Local $cContextMenu = GUICtrlCreateContextMenu($cLabel) $cContext_Capture = GUICtrlCreateMenuItem("Capture", $cContextMenu) $cContext_Cancel = GUICtrlCreateMenuItem("Cancel", $cContextMenu) ; Hide GUI _WinAPI_SetLayeredWindowAttributes($hCapture_GUI, 0xABCDEF, 250) GUISetState() ; Set transparency level WinSetTrans($hCapture_GUI, "", 100) While 1 Switch GUIGetMsg() Case $cContext_Capture ; Get GUI position and delete $aPos = WinGetPos($hCapture_GUI) GUIDelete($hCapture_GUI) ; Peturn position Return $aPos Case $cContext_Cancel Exit EndSwitch WEnd EndFunc ;==>Mark_Rect M231 point -
This seems to work. Had to modify _TreePath slightly. #include <GuiTreeView.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> Global $txt, $item EBTAM() Func EBTAM() Global $treeview, $mapB, $ass, $app, $shp GUICreate("EB TAM", 600, 400) $treeview = GUICtrlCreateTreeView(20, 15, 560, 325, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $ass = GUICtrlCreateTreeViewItem("Test Assigned", $treeview) $app = GUICtrlCreateTreeViewItem("Testing Approved", $treeview) $shp = GUICtrlCreateTreeViewItem("Shipped", $treeview) $120 = GUICtrlCreateTreeViewItem("12.0", $ass) GUICtrlCreateTreeViewItem("US", $120) GUICtrlCreateTreeViewItem("CA", $120) GUICtrlCreateTreeViewItem("UK", $120) $mapB = GUICtrlCreateButton("&Map", 20, 350, 120, 40) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $mapB MsgBox(0, "node selected", "Node: " & _TreePath($treeview, $item)) EndSwitch WEnd EndFunc Func _TreePath($treeview, $item) ;Determine full path of selected item in TreeView $item = _GUICtrlTreeView_GetSelection($treeview) $txt = _GUICtrlTreeView_GetText($treeview, $item) Do $parent = _GUICtrlTreeView_GetParentHandle($treeview, $item) $txt = _GUICtrlTreeView_GetText($treeview, $parent) & "" & $txt $item = $parent Until $parent = 0 Return StringTrimLeft($txt,StringInstr($txt,"")) EndFunc ;==>;_TreePath1 point