Leaderboard
Popular Content
Showing content with the highest reputation on 09/03/2020 in all areas
-
AutoIt Snippets
TheDcoder reacted to seadoggie01 for a topic
I use StringRegExp a lot, but it doesn't return a 2D array of matches when I capture lines of data (like a from csv). I (finally) created _Array_Resize which converts 1D arrays into 2D arrays based on the number of columns ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Array_Resize ; Description ...: Turns a 1D array into a 2D array based on $iColumns ; Syntax ........: _Array_Resize(Byref $aArray1d, $iColumns[, $iStart = 0]) ; Parameters ....: $aArray1d - [in/out] an Array. ; $iColumns - the number of columns to create. ; $iStart - [optional] the number of elements to skip. Default is 0. ; Return values .: Success - a 2D array ; Failure - False and sets @error ; |1 - the 1D array is not divisible by $iColumns evenly, resulting in an un-even array ; Author ........: Seadoggie01 ; Modified ......: September 3, 2020 ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Array_Resize2(ByRef $aArray1d, $iColumns, $iStart = Default) If IsKeyword($iStart) Then $iStart = 0 Local $iElements = UBound($aArray1d) - $iStart ; If the conversion would leave blank cells If Mod($iElements, $iColumns) <> 0 Then Return SetError(1, 0, False) Local $aArray2d[$iElements/$iColumns][$iColumns] Local $iRow = 0, $iCol = 0 For $i=$iStart To UBound($aArray1d) - 1 $aArray2d[$iRow][$iCol] = $aArray1d[$i] $iCol += 1 ; If this is the end of a column If $iCol = $iColumns Then ; Increase the row counter and reset $iCol $iRow += 1 $iCol = 0 EndIf Next Return $aArray2d EndFunc1 point -
1 point
-
WebDriver UDF - Help & Support (II)
this-is-me reacted to Danp2 for a topic
@this-is-me Take a look at _WD_UpdateDriver, which already implements the requested feature. 😎1 point -
Excel Rounding Issue
seadoggie01 reacted to robertocm for a topic
not directly related, but i remember some issues rounding with VBA functions: Round() and Application.Round use different rounding algorithms, as explained here: http://www.vbaexpress.com/forum/showthread.php?6889-Solved-Is-It-quot-Round-quot-or-quot-Application-Round-quot https://stackoverflow.com/questions/265926/round-function-in-excel-worksheet-function-vs-vba1 point -
IE - Accessing a table in HTML
CaptainBeardsEyesBeard reacted to Danp2 for a topic
I would use _IETableWriteToArray and then locate the desired value within the array.1 point -
The embedded browser emulates IE7 by default, so that's probably why the website isn't shown. Check out this thread for a possible solution --1 point
-
https://www.autoitscript.com/wiki/WebDriver https://www.autoitscript.com/forum/topic/191990-webdriver-udf-w3c-compliant-version-08282020/ https://www.autoitscript.com/forum/topic/197080-using-ui-automation-code-in-autoit/1 point
-
GUI Zoom, img move whitin a GUI [Solved]
pixelsearch reacted to UEZ for a topic
I cleaned up my GDI+ code and here is the result which seems to work properly. ;Coded by UEZ build 2020-09-03 beta #include <GUIConstantsEx.au3> #include <Misc.au3> #include <Screencapture.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() ;~ Global Const $hBmp = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Testbitmap.bmp") Global $hHBitmap = _ScreenCapture_Capture("", 0, 0, 319, 255, 0) Global Const $hBmp = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) _WinAPI_DeleteObject($hHBitmap) Global Const $bg_c = "808080" Global Const $iW = 800, $iH = 600, $iW2 = $iW / 2, $iH2 = $iH / 2, $zs = 0.025 Global $bW = _GDIPlus_ImageGetWidth($hBmp), $bH = _GDIPlus_ImageGetHeight($hBmp), $bW2 = $bW / 2, $bH2 = $bH / 2 Global Const $hGUI = GUICreate("GDI+ Zoom and Move Image within GUI", $iW, $iH) GUISetState() Global $aMPos1, $aMPos2, $iMPx = $iW2 - $bW2, $iMPy = $iH2 - $bH2, $iMPx_p = 0, $iMPy_p = 0, $z = 1.0, $zp = 1.0 Global Const $dll = DllOpen("user32.dll") Global Const $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global Const $hBuffer_Bmp = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic) Global Const $hContext = _GDIPlus_ImageGetGraphicsContext($hBuffer_Bmp) _GDIPlus_GraphicsSetPixelOffsetMode($hContext, 4) _GDIPlus_GraphicsSetInterpolationMode($hContext, 5) Draw2Graphic($iMPx, $iMPy, 1, 1) GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL") Do $aMPos1 = MouseGetPos() While _IsPressed("01", $dll) And WinActive($hGUI) $aMPos2 = MouseGetPos() $iMPx = $iMPx_p + $aMPos2[0] - $aMPos1[0] $iMPy = $iMPy_p + $aMPos2[1] - $aMPos1[1] Draw2Graphic($iMPx, $iMPy, $z, $zp) Sleep(10) WEnd $iMPx_p = $iMPx $iMPy_p = $iMPy Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BitmapDispose($hBuffer_Bmp) _GDIPlus_BitmapDispose($hBmp) _GDIPlus_Shutdown() GUIDelete() DllClose($dll) Exit Func Draw2Graphic($x, $y, $fZoom, $fZoom_prev) _GDIPlus_GraphicsClear($hContext, "0xFF" & $bg_c) $x = Min(Max(0, $x), $iW - $bW * $zp - 1) $y = Min(Max(0, $y), $iH - $bH * $zp - 1) Local Const $iW_New = $bW * $fZoom, $iH_New = $bH * $fZoom Local Const $iW_Prev = $bW * $fZoom_prev, $iH_Prev = $bH * $fZoom_prev Local Const $dx = ($iW_New - $iW_Prev) / 2, $dy = ($iW_New - $iW_Prev) / 2 $iMPx -= $dx $iMPy -= $dy _GDIPlus_GraphicsDrawImageRect($hContext, $hBmp, $x - $dx, $y - $dy, $iW_New, $iH_New) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBuffer_Bmp, 0, 0, $iW, $iH) EndFunc ;==>Draw2Graphic Func Max($a, $b) Return ($a > $b) ? $a : $b EndFunc ;==>Max Func Min($a, $b) Return ($a < $b) ? $a : $b EndFunc ;==>Min Func WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam) Local $iDir = _WinAPI_HiWord($wParam) Switch $iDir Case $iDir < 0 If $z - $zs < 8 * $zs Then Return 0 $zp = $z $z -= $zs Draw2Graphic($iMPx, $iMPy, $z, $zp) Return 0 Case Else If ($z + $zs) * $bW > $iW Or ($z + $zs) * $bH > $iH Then Return 0 $zp = $z $z += $zs Draw2Graphic($iMPx, $iMPy, $z, $zp) Return 0 EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_MOUSEWHEEL Use mouse wheel to zoom image and press lmb to move image around without leaving the borders.1 point -
https://winmerge.org/ is better...1 point
-
_WinAPI_GetBkColor - How to use it the right way?
argumentum reacted to Bilgus for a topic
If you can find it in print anywhere I'd recommend a read of: Windows Graphics Programming Win32 GDI and DirectDraw Feng Yuan Publisher: Prentice Hall PTR ISBN: 0-13-086985-6, 1234 pages1 point -
Help with WinClose/WinKill
Earthshine reacted to TheXman for a topic
What OS are you running this on? If it is Win10, one possible reason that particular method of identifying the window might fail, is that the title in Notepad will include an asterisk (*) when the file is modified. This doesn't happen on Win7. One way to be able to have it work regardless of the OS, is to use RegExpTitle to look for a partial match or use "Opt('WinTitleMatchMode', -2)", which will look for a case-insensitive substring match. Look at the help file to see how each is implemented. If you opened notepad in your script, then the most reliable way of identifying the window is to use its handle.1 point -
Some changes has been made. I suggest to use Total Commander file compare mode (Files - Compare By Content) to see the difference between two files._FF V0.6.0.5b-1.au31 point
-
@mLipok Here's a simple way to do it -- $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//select[@name='penalties_length']") $sText = _WD_ElementAction($sSession, $sElement, 'property', 'innerText') $aOptions = StringSplit ( $sText, @LF, $STR_NOCOUNT) _ArrayDisplay($aOptions) If you would rather process each element individually, then this gets them into an array for further processing -- $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//select[@name='penalties_length']//option", Default, True) _ArrayDisplay($aElements)1 point
-
Eg for IE11 installed (no UDF version): #include <IE.au3> #include <Process.au3> Local $regValue = "0x2AF8" ; IE11 edge mode: 11001 (0x2AF9) ; IE11: 11000 (0x2AF8) ; IE10: 10001 (0x2711) ; IE10: 10000 (0x02710) ; IE 9: 9999 (0x270F) ; IE 9: 9000 (0x2328) ; IE 8: 8888 (0x22B8) ; IE 8: 8000 (0x1F40) ; IE 7: 7000 (0x1B58) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", _ProcessGetName(@AutoItPID), "REG_DWORD", $regValue) RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", _ProcessGetName(@AutoItPID), "REG_DWORD", $regValue) ;~ RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", @ScriptName, "REG_DWORD", $regValue) ;~ RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION",@ScriptName, "REG_DWORD", $regValue) Global $mainwin = GUICreate("IE test", 968, 688) Global $OBJECT = ObjCreate("Shell.Explorer.2") Global $OBJECT_CTRL = GUICtrlCreateObj($OBJECT, 0, 0, 968, 688) GUISetState() _IENavigate($OBJECT, "http://www.whatsmyuseragent.com/") ;~ _IENavigate($object, "http://www.pinterest.com/") While 1 Sleep(10) If GUIGetMsg() = -3 Then ExitLoop WEnd1 point
-
Here is another UDF! With YTAPI you can easily use the YouTube api to get all the info that you need for a specific YouTube video. This UDF will not retrive to you the video download link!, Remember that download video from YouTube is illegal If you will find any bug, have suggestion or you want other function please just let me know! All supported function: ;_YTApi_GetVideoID ;_YTApi_GetThumbnail ;_YTApi_GetTitle ;_YTApi_GetDescription ;_YTApi_GetAuthor ;_YTApi_GetDuration ;_YTApi_GetCategory ;_YTApi_GetStats ;_YTApi_GetRating ;_YTApi_GetRatingAverange ;_YTApi_GetUploadedDate ;_YTApi_GetUpdatedDate ;_YTApi_GetAllowedCountry ;_YTApi_IsCountryAllowed Here is a simple Example of usage: #include "YTAPI.au3" $Video_ID = "dSLOR2cRouU" $Video_Thumbnail = _YTApi_GetThumbnail($Video_ID) If Not @error Then MsgBox(0, "Thumbnail", "You can see the video thumbnail at this address:" & @CRLF & $Video_Thumbnail) EndIf $Video_Author = _YTApi_GetAuthor($Video_ID) If @error Then MsgBox(0, "Author", "The video author is: " & $Video_Author) EndIf $Video_Duration = _YTApi_GetDuration($Video_ID) If Not @error Then MsgBox(0, "Duration", "The video duration is: " & $Video_Duration & " seconds.") EndIf $Video_Title = _YTApi_GetTitle($Video_ID) If Not @error Then MsgBox(0, "Title", "The video title is: " & $Video_Title) EndIf $Video_Description = _YTApi_GetDescription($Video_ID) If Not @error Then MsgBox(0, "Description", "The video is: " & $Video_Description) EndIf $Video_Category = _YTApi_GetCategory($Video_ID) If Not @error Then MsgBox(0, "Category", "The video category is: " & $Video_Category) EndIf $Video_Stats = _YTApi_GetStats($Video_ID) If Not @error Then MsgBox(0, "Video Stats", "Favorite Video Count: " & $Video_Stats[0] & @CRLF & "View Count: " & $Video_Stats[1]) EndIf $Video_Rating = _YTApi_GetRating($Video_ID) If Not @error Then MsgBox(0, "Video Rating", "Dislikes: " & $Video_Rating[0] & @CRLF & "Likes: " & $Video_Rating[1]) EndIf $Video_Date = _YTApi_GetUploadedDate($Video_ID) ;Time is expressed in UTC (0)/GMT If Not @error Then MsgBox(0, "Video Upload Date", "This video was uploaded on: " & $Video_Date[0] & " at " & $Video_Date[1]) EndIf $Video_Update = _YTApi_GetUpdatedDate($Video_ID) ;Time exspressed in UTC (0)/GMT If Not @error Then MsgBox(0, "Video Update Date", "This video was updated on: " & $Video_Update[0] & " at " & $Video_Update[1]) EndIf $Video_Allowed_Country = _YTApi_GetAllowedCountry($Video_ID) If Not @error Then $allowed_txt = "" $counter = 0 For $i = 0 To UBound($Video_Allowed_Country) - 1 $allowed_txt &= $Video_Allowed_Country[$i] & " , " $counter += 1 If $counter = 10 Then $allowed_txt &= @CRLF $counter = 0 EndIf Next MsgBox(0, "Allowed Country Code", $allowed_txt) EndIf $Video_IsCountryAllowed = _YTApi_IsCountryAllowed($Video_ID, "US") If Not @error Then MsgBox(0, "Is this country code allowed?", "Country Code: 'US' is allowed!") EndIfHi! YTAPI v.1.0.0.rar1 point
-
Form Builder beta
mLipok reacted to BuckMaster for a topic
Update v1.0.6 Major script overhaul, I literally started over from scratch only adding parts of code from the old script that were solid. I don’t have a help file made as of now so I am going to explain all of the functionality in this post - Form Builder is no longer bi-directional, you now toggle between script mode and GUI mode using a button in the top right or F4 - The script no longer recompiles on every change but instead inserts changes into the script - Form Builder no longer cares about Event mode or GuiGetMsg mode - No more .gui files, you now edit .au3 scripts directly - Script edit is now a SciLexer control, includes syntax highlighting, folding, call tips, keywords, and inline error annotations. - Script output console is now at the bottom in script mode - Main GUI menu redone, most functions from SciTe have been added along with their hotkeys - All restrictions to editing the script have been removed - GDI+ and Graphic editors removed - Cleanup of script, stability greatly increased - Hotkeys no longer use _IsPressed they now use GUIAccelerator keys (with exception to a few) - Multiple scripts can be open - Form Builder buffers the open scripts and adds an asterisk * to scripts that have been modified - Rich Edit, GUIScrollbars, Dummy, and Updown are disabled for now until I can add them - GUI Menu controls cannot be created as of now but will be rendered in the editor - Undo and Redo actions in script mode and GUI mode added, the GUI undo and redo buffer is cleared switching between modes - The Undo and Redo buffers do not have a limit but are cleared when switching between modes or scripts - Undo and Redo actions do not work for controls that have no control handle - The Treeview now works as a Go to function for controls and functions in script mode - Form Builder now tries to preserve as much of the original content as possible, it will save whitespace in-between parameters and comments on controls - Treeview context menu reworked, much more responsive - Unicode support added File -> Encoding -> UTF-8 - Language support added, I added a couple of language files and used Google translate just so I could size my GUI's for different languages, I do not support what those language files say - Selecting a GUI in the Treeview in GUI mode will allow you to change the GUI's Handle, Position, Background Color, State, Cursor, Font, Font Size and Font Attributes - Auto Declare is no longer hiding in the settings, it is now on the top right and is a toggle between Off, Global and Local - Help File Lookup added (Ctrl + H), allows you to search selected text in the help file, Any variable will be searched and the first result will be displayed, any string will be searched as a keyword in the index - Added current script line, column, and selection length in the bottom left - Standard undeclared style constants are checked before script execution and the script will prompt if an undefined style constant is found - You can now toggle script whitespace, EOL characters, line numbers, margins and output in the View menu - View -> Toggle All Folds works as it does in SciTe, only base level folds are changed and the first fold found determines whether to expand or contract - Form Builder Settings redone - Bugs with submitting data and control selection have been fixed - Fixed problems with frequently called repetitive functions causing issues with large scripts - Fixed bugs with B, I, U and S font attribute buttons getting stuck and called when enter was pressed Update v1.0.7 - Help File Look-up hotkey changed to Ctrl+B - Replace hotkey changed to Ctrl+H - Changes to $SCN_MODIFIED so only text events are notified - Bookmarks added, Ctrl+M to add or delete a Bookmark from the current line - Edit -> Bookmarks -> Set Bookmark changes the currently selected Bookmark - Edit -> Clear Current Bookmarks deletes only the currently selected Bookmark - Allows you to change foreground and background colors of Bookmarks - Added F2 hotkey for Next Bookmark - Added Shift+F2 hotkey for Previous Bookmark - Fixed a bug that made it so script annotation did not show up for some people - Script errors and warnings now add a Bookmark on each line - Ctrl+E hotkey added to clear all Bookmarks and Annotations - Minor GUI tweaks - Fixed a bug with the GUI Style undo action - Undo and Redo actions for GUI windows will now update the window properties if the GUI is selected - F4 Hotkey no longer switches modes, switching modes is now F10 - F4 is to toggle next error or warning message, works like it does in SciTe, bookmarks the line and highlights the error in the console - Shift+F4 Hotkey added to toggle previous error or warning message - Shift+F5 Hotkey added to clear script output - Ctrl+F5 Hotkey added as SyntaxCheck Prod - Form Builder now performs a SyntaxCheck before entering GUI Mode and prompts on Error or Warning - Language Select Menu Added Settings -> Lanugage - Icons added to main menu - Languages added to all new menu items and msgbox's - Language Files updated for new data - Language Support added for Arabic, Chinese, Dutch, French, German, Hebrew, Japanese, Swedish, Thai, and Vietnamese [ Google Translate ] - Fixed bug with updating a language that made it look like ANSI and UTF-8 were both selected - Added redo button next to undo button - Font attribute buttons Bold, Italic, Underline and Strike-Out changed to labels Update v1.0.8 - Somehow a main function got deleted causing the script to crash on some changes - Fixed some issues with updating Languages Hotkeys Ctrl + N - New Blank Script Ctrl + G - New GUI Script Ctrl + O - Open Script Ctrl + Shift + S - Save As Ctrl + S - Save Esc - Close Open Script Alt + F4 - Exit Ctrl + Z - Undo Ctrl + Y - Redo Ctrl + X - Cut Ctrl + C - Copy Ctrl + V - Paste Ctrl + A - Select All Ctrl + W - Clear inline script annotation Ctrl + E - Clear inline script annotation and bookmarks Ctrl + F - Find Ctrl + F3 - Find Next Shift + F3 - Find Previous (doesn’t work yet) Ctrl + B - Help File Lookup F5 - Go Alt + F5 - Beta Run F7 - Build Ctrl + F7 - Compile F11 - Full screen F8 - Toggle Show/Hide Script Output Ctrl + I - Open Include Ctrl + H - Replace F1 - AutoIt Help File Ctrl + D - Duplicate Control Delete - Delete Control Ctrl + Shift + 8 - Toggle Show/Hide Script Whitespace Ctrl + Shift + 9 - Toggle Show/Hide Script EOL characters Ctrl - GUI Mode multicontrol selection F10 - Switch Modes F4 - Next Message Shift+F4 - Previous Message Shift+F5 - Clear Output Ctrl+M - Add Bookmark F2 - Next Bookmark Shift+F2 - Previous Bookmark Basic GUI Mode How To Create a Control - click a control on the left - click in the GUI you wish to add the control Left Click: Click and drag to auto resize the control Right Click: Creates the control at a standard size Select a Control - click inside the control or select it in the treeview Change a controls Data - First select the control - modify the controls data on the right, press enter to submit changes state, cursor, font and resizing update when you change the data - when modifying the data parameter the script recognizes if there is a variable in the data and will add quotes accordingly ex. data parameter = $data, End result in script: GUICtrlCreateButton($data, 50, 50, 100, 20) ex. data parameter = data, End result in script: GUICtrlCreateButton("data", 50, 50, 100, 20) ex. data parameter = "data"&$data, End result in script: GUICtrlCreateButton("data"&$data, 50, 50, 100, 20) Applying an Image to a control - select a control - control styles must be applied to some controls before adding an image - click the ... button next to the Image input in the Control Properties area in the bottom right - select the image you want to display, allows jpg, bmp, gif, ico and dll files - selecting a dll will open another prompt to choose which resource to display Control Grouping - multiple controls must be selected - press the group controls button - control grouping allows you to resize and move multiple controls at the same time, as of now groups are deleted when leaving GUI mode I only have a couple odds and ends to finish up before everything should be complete, I need to add Undo and Redo actions for copying and duplicating controls and a couple other minor things, eventually I want to try to add all of the UDF controls as well. If people are willing to translate the language file I would be very grateful, the ones I have right now are from Google translate, I only used them for testing and have no idea what they say. I want to thank Kip, Prog@ndy, Isi360 and all of the other contributors on this forum, without you guys i don't think i could have written this script. Please post any comments, problems or suggestions, BuckMaster * I only used one "magic number" on my main close case statement, only for faster locating, and i don't care. Form Builder Source.zip Form Builder.zip1 point