Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/20/2019 in all areas

  1. Trong

    ImageSearchUDF

    Version v3.3.3

    11,569 downloads

    ImageSearch UDF - AutoIt Wrapper for ImageSearchDLL Overview ImageSearchDLL_UDF.au3 is a high-level AutoIt wrapper for ImageSearchDLL, providing easy-to-use functions for image searching, mouse automation, and multi-monitor support. It handles all the complexity of DLL calls and provides a clean, reliable API with built-in error handling and fallback mechanisms. Author: Dao Van Trong - TRONG.PRO UDF Version: v3.3 Compatible with: ImageSearchDLL v3.3+ AutoIt Version: 3.3.16.1+ License: MIT License ☕ Support My Work Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal Your support helps me continue developing and maintaining this library for the community! 🙏 Key Features Search Functions Screen Search: Find images on screen with multi-monitor support Image-in-Image Search: Find images within other images HBITMAP Search: Direct bitmap handle searching Wait & Click: Wait for image and auto-click when found Cache Control: Enable/disable persistent caching per search Mouse Automation (v3.3 Enhanced) Multi-Monitor Support: 100% reliable on all monitor configurations Negative Coordinates: Full support via WinAPI SetCursorPos Click Simulation: WinAPI mouse_event for all button types Smooth Movement: Optional speed parameter for cursor animation Window Clicks: Click relative to window positions Monitor Management Auto-Detection: Enumerate all connected monitors Virtual Desktop: Coordinate conversion between monitor and virtual space Specific Monitor Search: 2-3x faster when searching single monitor Monitor Info: Get position, size, and primary status Installation Include the UDF in your AutoIt script: #include "ImageSearchDLL_UDF.au3" Place DLL in same directory as script: ImageSearchDLL_x64.dll for x64 AutoIt ImageSearchDLL_x86.dll for x86 AutoIt Not required, as the DLL is already embedded in the UDF! Initialize (automatic on first use): _ImageSearch_Startup() ; Optional - auto-called if needed Quick Start Examples Example 1: Simple Image Search #include "ImageSearchDLL_UDF.au3" ; Search for image on screen Local $aResult = _ImageSearch("button.png") If $aResult[0][0] > 0 Then ConsoleWrite("Found at: X=" & $aResult[1][0] & ", Y=" & $aResult[1][1] & @CRLF) ; Click the found image _ImageSearch_MouseClick("left", $aResult[1][0], $aResult[1][1]) Else ConsoleWrite("Image not found" & @CRLF) EndIf Example 2: Multi-Monitor Search #include "ImageSearchDLL_UDF.au3" ; Search on all monitors (virtual desktop) Local $aResult = _ImageSearch("icon.png", 0, 0, 0, 0, -1) ; OR search on specific monitor (faster!) Local $aResult = _ImageSearch("icon.png", 0, 0, 0, 0, 2) ; Monitor 2 If $aResult[0][0] > 0 Then ConsoleWrite("Found " & $aResult[0][0] & " match(es)" & @CRLF) For $i = 1 To $aResult[0][0] ConsoleWrite("Match " & $i & ": X=" & $aResult[$i][0] & ", Y=" & $aResult[$i][1] & @CRLF) Next EndIf Example 3: Wait and Click #include "ImageSearchDLL_UDF.au3" ; Wait up to 5 seconds for image, then click it Local $iResult = _ImageSearch_WaitClick(5000, "submit.png", "left", 1) If $iResult Then ConsoleWrite("Image found and clicked!" & @CRLF) Else ConsoleWrite("Timeout - image not found" & @CRLF) EndIf Example 4: Find All Occurrences #include "ImageSearchDLL_UDF.au3" ; Find all matches (up to 10) Local $aResult = _ImageSearch("item.png", 0, 0, 0, 0, -1, 10, 10) If $aResult[0][0] > 0 Then For $i = 1 To $aResult[0][0] ConsoleWrite("Match " & $i & ": ") ConsoleWrite("X=" & $aResult[$i][0] & ", Y=" & $aResult[$i][1]) ConsoleWrite(", W=" & $aResult[$i][2] & ", H=" & $aResult[$i][3] & @CRLF) Next EndIf Example 5: Image-in-Image Search #include "ImageSearchDLL_UDF.au3" ; Search for button.png within screenshot.png Local $aResult = _ImageSearch_InImage("screenshot.png", "button.png", 15, 5) If $aResult[0][0] > 0 Then ConsoleWrite("Found " & $aResult[0][0] & " match(es) in image" & @CRLF) EndIf Example 6: Region Search with Tolerance #include "ImageSearchDLL_UDF.au3" ; Search in specific region with high tolerance Local $aResult = _ImageSearch("target.png", 100, 100, 800, 600, -1, 20) If $aResult[0][0] > 0 Then ConsoleWrite("Found at: " & $aResult[1][0] & ", " & $aResult[1][1] & @CRLF) EndIf Example 7: Cache-Enabled Search #include "ImageSearchDLL_UDF.au3" ; Enable cache for 30-50% performance boost on repeated searches Local $aResult = _ImageSearch("icon.png", 0, 0, 0, 0, -1, 10, 1, 1, 1.0, 1.0, 0.1, 0, 1) ; ↑ ; iUseCache=1 If $aResult[0][0] > 0 Then ConsoleWrite("Found (cached search): " & $aResult[1][0] & ", " & $aResult[1][1] & @CRLF) EndIf Example 8: Monitor Management #include "ImageSearchDLL_UDF.au3" ; Get monitor information _ImageSearch_Monitor_GetList() ConsoleWrite("Total monitors: " & $g_aMonitorList[0][0] & @CRLF) For $i = 1 To $g_aMonitorList[0][0] ConsoleWrite("Monitor " & $i & ": " & _ $g_aMonitorList[$i][5] & "x" & $g_aMonitorList[$i][6] & _ ($g_aMonitorList[$i][7] ? " (Primary)" : "") & @CRLF) Next ; Convert coordinates between monitor and virtual desktop Local $aVirtual = _ImageSearch_Monitor_ToVirtual(2, 100, 200) ConsoleWrite("Monitor 2 (100,200) = Virtual (" & $aVirtual[0] & "," & $aVirtual[1] & ")" & @CRLF) Core Functions Reference Search Functions _ImageSearch() _ImageSearch($sImagePath, [$iLeft=0], [$iTop=0], [$iRight=0], [$iBottom=0], [$iScreen=-1], [$iTolerance=10], [$iResults=1], [$iCenterPOS=1], [$fMinScale=1.0], [$fMaxScale=1.0], [$fScaleStep=0.1], [$iReturnDebug=0], [$iUseCache=0]) Parameters: $sImagePath - Image file path (or multiple: "img1.png|img2.png") $iLeft, $iTop, $iRight, $iBottom - Search region (0 = full screen) $iScreen - Monitor: -1=all, 0=primary, 1=first, 2=second, etc. $iTolerance - Color tolerance 0-255 $iResults - Max results to return (1-64) $iCenterPOS - 1=return center, 0=return top-left $fMinScale, $fMaxScale, $fScaleStep - Scaling parameters $iReturnDebug - 1=enable debug output $iUseCache - 1=enable cache, 0=disable Returns: Array[0][0] = match count Array[1..n][0] = X coordinate Array[1..n][1] = Y coordinate Array[1..n][2] = Width Array[1..n][3] = Height _ImageSearch_InImage() _ImageSearch_InImage($sSourceImage, $sTargetImage, [$iTolerance=10], [$iResults=1], [$iCenterPOS=1], [$fMinScale=1.0], [$fMaxScale=1.0], [$fScaleStep=0.1], [$iReturnDebug=0], [$iUseCache=0]) Search for target image(s) within a source image file. _ImageSearch_Wait() _ImageSearch_Wait($iTimeout, $sImagePath, [$iLeft=0], [$iTop=0], [$iRight=0], [$iBottom=0], [$iScreen=-1], [$iTolerance=10], [$iResults=1], [$iCenterPOS=1], [$fMinScale=1.0], [$fMaxScale=1.0], [$fScaleStep=0.1], [$iReturnDebug=0], [$iUseCache=0]) Wait for image to appear (with timeout in milliseconds). _ImageSearch_WaitClick() _ImageSearch_WaitClick($iTimeout, $sImagePath, [$sButton="left"], [$iClicks=1], [$iLeft=0], [$iTop=0], [$iRight=0], [$iBottom=0], [$iScreen=-1], [$iTolerance=10], [$iResults=1], [$iCenterPOS=1], [$fMinScale=1.0], [$fMaxScale=1.0], [$fScaleStep=0.1], [$iReturnDebug=0], [$iUseCache=0]) Wait for image and automatically click it when found. Mouse Functions (v3.3 Enhanced) _ImageSearch_MouseMove() _ImageSearch_MouseMove($iX, $iY, [$iSpeed=0], [$iScreen=-1]) Move mouse cursor to coordinates. Supports negative coordinates for multi-monitor. Uses WinAPI SetCursorPos for 100% reliability $iSpeed - 0=instant, >0=smooth movement with steps _ImageSearch_MouseClick() _ImageSearch_MouseClick([$sButton="left"], [$iX=-1], [$iY=-1], [$iClicks=1], [$iSpeed=0], [$iScreen=-1]) Click mouse at coordinates. Supports negative coordinates for multi-monitor. Uses WinAPI mouse_event for reliable clicking $sButton - "left", "right", "middle" $iX, $iY - Virtual desktop coordinates (-1 = current position) _ImageSearch_MouseClickWin() _ImageSearch_MouseClickWin($sTitle, $sText, $iX, $iY, [$sButton="left"], [$iClicks=1], [$iSpeed=0]) Click at window-relative coordinates. Monitor Functions _ImageSearch_Monitor_GetList() _ImageSearch_Monitor_GetList() Enumerate all monitors and populate $g_aMonitorList array. Global Array Structure: $g_aMonitorList[0][0] = Total monitor count $g_aMonitorList[i][0] = Handle $g_aMonitorList[i][1] = Left $g_aMonitorList[i][2] = Top $g_aMonitorList[i][3] = Right $g_aMonitorList[i][4] = Bottom $g_aMonitorList[i][5] = Width $g_aMonitorList[i][6] = Height $g_aMonitorList[i][7] = IsPrimary (1/0) $g_aMonitorList[i][8] = Device name _ImageSearch_Monitor_ToVirtual() _ImageSearch_Monitor_ToVirtual($iMonitor, $iX, $iY) Convert monitor-relative coordinates to virtual desktop coordinates. _ImageSearch_Monitor_FromVirtual() _ImageSearch_Monitor_FromVirtual($iMonitor, $iX, $iY) Convert virtual desktop coordinates to monitor-relative coordinates. Utility Functions _ImageSearch_CaptureScreen() _ImageSearch_CaptureScreen([$iLeft=0], [$iTop=0], [$iRight=0], [$iBottom=0], [$iScreen=-1]) Capture screen region as HBITMAP handle. _ImageSearch_hBitmapLoad() _ImageSearch_hBitmapLoad($sImageFile, [$iAlpha=0], [$iRed=0], [$iGreen=0], [$iBlue=0]) Load image file as HBITMAP with optional background color. _ImageSearch_GetVersion() _ImageSearch_GetVersion() Get DLL version string. _ImageSearch_GetSysInfo() _ImageSearch_GetSysInfo() Get system info (CPU, screen, cache stats). _ImageSearch_ClearCache() _ImageSearch_ClearCache() Clear all DLL caches (location and bitmap). Performance Tips Cache System Enable caching for repeated searches: $iUseCache=1 30-50% faster on subsequent searches Persistent across script runs Auto-validated (removes stale entries) Multi-Monitor Optimization Use specific monitor ($iScreen=1 or 2) for 2-3x faster search Use virtual desktop ($iScreen=-1) only when needed Coordinates are always in virtual desktop space (may be negative) Search Optimization Smaller region = faster search Higher tolerance = faster but less accurate Fewer results ($iResults=1) = faster Disable debug in production ($iReturnDebug=0) Version 3.3 Improvements Fixed Issues ✅ Multi-Monitor Mouse Movement - Now 100% reliable using WinAPI ✅ Negative Coordinates - Full support for monitors positioned left/above primary ✅ Mouse Click Reliability - WinAPI mouse_event never fails ✅ Coordinate Conversion - Proper handling of virtual desktop space Enhanced Features Debug logging shows actual mouse position after move Better error handling with meaningful error codes All mouse functions bypass DLL for maximum reliability Smooth cursor movement with customizable speed Breaking Changes Mouse functions no longer rely on DLL implementation Always use WinAPI for mouse operations (more reliable) Troubleshooting "DLL not found" Error Ensure DLL is in same directory as script Use correct architecture (x64 vs x86) Check with FileExists($g_sImgSearchDLL_Path) Mouse Not Moving on Second Monitor ✅ Fixed in v3.3! Now uses WinAPI SetCursorPos Coordinates are virtual desktop (may be negative) Update to UDF v3.3 or later Image Not Found Check image file exists Increase tolerance ($iTolerance=20) Enable debug ($iReturnDebug=1) to see search info Try different region/monitor settings Slow Search Performance Enable cache ($iUseCache=1) Use specific monitor instead of all monitors Reduce search region Lower max results Example: Complete Script #include "ImageSearchDLL_UDF.au3" ; Initialize _ImageSearch_Startup() ; Show system info ConsoleWrite("UDF: " & $IMGS_UDF_VERSION & @CRLF) ConsoleWrite("DLL: " & _ImageSearch_GetVersion() & @CRLF) ConsoleWrite(_ImageSearch_GetSysInfo() & @CRLF) ; Search for image with cache enabled Local $aResult = _ImageSearch("target.png", 0, 0, 0, 0, -1, 10, 5, 1, 1.0, 1.0, 0.1, 1, 1) If $aResult[0][0] > 0 Then ConsoleWrite("Found " & $aResult[0][0] & " match(es):" & @CRLF) For $i = 1 To $aResult[0][0] ConsoleWrite(" Match " & $i & ": ") ConsoleWrite("X=" & $aResult[$i][0] & ", Y=" & $aResult[$i][1]) ConsoleWrite(", W=" & $aResult[$i][2] & ", H=" & $aResult[$i][3] & @CRLF) ; Move mouse and click _ImageSearch_MouseMove($aResult[$i][0], $aResult[$i][1], 10) Sleep(500) _ImageSearch_MouseClick("left", $aResult[$i][0], $aResult[$i][1]) Sleep(1000) Next Else ConsoleWrite("No matches found" & @CRLF) EndIf ; Cleanup _ImageSearch_Shutdown() License & Contact Author: Dao Van Trong Website: TRONG.PRO Email: trong@email.com License: MIT License AutoIt Forum: Post in AutoIt General Help See Also README.md - DLL API reference and C++ examples ImageSearchDLL_TestSuite.au3 - Interactive GUI test application Thank you for using ImageSearch UDF! 🚀
    1 point
  2. Hi, I created a FMOD UDF (x86 / x64 compatible) whereas the DLL calls are done from memory directly! Credits to trancexx for the Subrogation functions! Supported formats: - .MOD (protracker/fasttracker modules) - .S3M (screamtracker 3 modules) - .XM (fasttracker 2 modules) - .IT (impulse tracker modules) - .MID (MIDI files) - .RMI (MIDI files) - .SGT (DirectMusic segment files) - .FSB (FMOD Sample Bank files) - .MP3 - .OGG - .WAV - .MP2 - .RAW Current added function list (sum = 70): FMUSICMEM_FreeSong FMUSICMEM_GetBPM FMUSICMEM_GetGlobalVolume FMUSICMEM_GetMasterVolume FMUSICMEM_GetName FMUSICMEM_GetNumChannels FMUSICMEM_GetNumInstruments FMUSICMEM_GetNumOrders FMUSICMEM_GetNumPatterns FMUSICMEM_GetNumSamples FMUSICMEM_GetOrder FMUSICMEM_GetPaused FMUSICMEM_GetRow FMUSICMEM_GetSpeed FMUSICMEM_GetTime FMUSICMEM_GetType FMUSICMEM_IsFinished FMUSICMEM_LoadSong FMUSICMEM_LoadSongEx FMUSICMEM_OptimizeChannels FMUSICMEM_PlaySong FMUSICMEM_SetMasterVolume FMUSICMEM_SetOrder FMUSICMEM_SetPaused FMUSICMEM_StopAllSongs FMUSICMEM_StopSong FSOUNDMEM_Close FSOUNDMEM_DSP_Create FSOUNDMEM_DSP_Free FSOUNDMEM_DSP_GetActive FSOUNDMEM_DSP_GetFFTUnit FSOUNDMEM_DSP_GetSpectrum FSOUNDMEM_DSP_SetActive FSOUNDMEM_DSP_SetPriority FSOUNDMEM_GetAmplitude FSOUNDMEM_GetChannelsPlaying FSOUNDMEM_GetCPUUsage FSOUNDMEM_GetCurrentLevels FSOUNDMEM_GetError FSOUNDMEM_GetFrequency FSOUNDMEM_GetGetSurround FSOUNDMEM_GetMaxChannels FSOUNDMEM_GetPan FSOUNDMEM_GetPaused FSOUNDMEM_GetVolume FSOUNDMEM_Init FSOUNDMEM_SetPaused FSOUNDMEM_SetSpeakerMode FSOUNDMEM_SetSurround FSOUNDMEM_SetVolume FSOUNDMEM_SetVolumeAbsolute FSOUNDMEM_Stream_Close FSOUNDMEM_Stream_FindTagField FSOUNDMEM_Stream_GetLength FSOUNDMEM_Stream_GetLengthMs FSOUNDMEM_Stream_GetNumTagFields FSOUNDMEM_Stream_GetOpenState FSOUNDMEM_Stream_GetPosition FSOUNDMEM_Stream_GetTagField FSOUNDMEM_Stream_GetTime FSOUNDMEM_Stream_Net_GetStatus FSOUNDMEM_Stream_Net_SetMetadataCallback FSOUNDMEM_Stream_Net_SetProxy FSOUNDMEM_Stream_Open FSOUNDMEM_Stream_Play FSOUNDMEM_Stream_PlayEx FSOUNDMEM_Stream_SetLoopCount FSOUNDMEM_Stream_SetPosition FSOUNDMEM_Stream_SetTime FSOUNDMEM_Stream_Stop In the zip archive you can find 6 examples. Download: FModMem UDF build 2019-11-24.zip If you have created additional examples, feel free to post it here.
    1 point
  3. I like the approach. It looks simple, but I don't think it is matching only the MAC list, but combinations of MAC bytes.
    1 point
  4. Yes, I'm just googling for something like "stop if first expression is false"
    1 point
  5. The expected result has an intrisic recursive nature, so the natural code structure shall be (head-first) recursive. I'll try to write something.
    1 point
  6. I have released version 1.4.0.0 for you to play with. 1.3.0.0 is still available for download.
    1 point
  7. Understood, but there is a thin line between monitoring for efficiency and invading employees privacy, so I guess/hope this is made known to them and won't be running hidden. Jos
    1 point
  8. Here my try: #include <array.au3> Global $sMAC = '12-34-56-34-14-91' & @CR & _ '12-34-56-80-04-54' & @CR & _ '12-34-56-80-93-11' & @CR & _ '12-34-56-EA-76-0F' & @CR & _ '12-34-56-EA-76-9F' & @CR & _ '12-34-56-EA-78-11' Global $aMACs = StringRegExp($sMAC, "\b[[:xdigit:]-]+\b", 3) Global $aMACs_splitted[UBound($aMACs)][6], $x, $xx, $y For $y = 0 To UBound($aMACs) - 1 $aTmp = StringSplit($aMACs[$y], "-", 3) For $x = 0 To UBound($aTmp) - 1 $aMACs_splitted[$y][$x] = $aTmp[$x] Next Next Global $sRegEx For $x = 0 To UBound($aMACs_splitted, 2) - 1 Dim $aTmp[UBound($aMACs_splitted)] For $y = 0 To UBound($aMACs_splitted) - 1 $aTmp[$y] = $aMACs_splitted[$y][$x] Next $aTmp = _ArrayUnique($aTmp) If $aTmp[0] = 1 Then $sRegEx &= $aTmp[1] Else $sRegEx &= "(" For $xx = 1 To $aTmp[0] $sRegEx &= $aTmp[$xx] & "|" Next $sRegEx = StringTrimRight($sRegEx, 1) & ")" EndIf $sRegEx &= "-" Next $sRegEx = StringTrimRight($sRegEx, 1) ConsoleWrite("RegEx pattern: " & $sRegEx & @CRLF)
    1 point
  9. It depends on how you look at it. One can, eg. change the red texts in this way: Actual scroll behavior -> Respecting horizontal user scroll as good as possible Better horizontal scroll -> Overruling user scroll by code more than neccessary My idea is, as far as I remember, to perform horizontal scrolling in code only if absolutely necessary when there is no space for the control to edit the cell. The 50 pixels is my minimum width for a ComboBox. The idea of making a column along the left or right edge fully visible when editing could be a good idea when the columns are not too wide. But it may not be the best solution if eg. there are columns that are 1000 pixels wide. In a specific situation, finding the solution that suits you is not that difficult. This is also why the code here is just examples. It's much more difficult to make a generally applicable UDF. There are a huge variety of situations to take into account.
    1 point
  10. Purely pseudo stream of thought, but i think this path may eventually get there #include<array.au3> $str = '12-34-56-34-14-91' & @CR & _ '12-34-56-80-04-54' & @CR & _ '12-34-56-80-93-11' & @CR & _ '12-34-56-EA-76-0F' & @CR & _ '12-34-56-EA-76-9F' & @CR & _ '12-34-56-EA-78-11' local $aSplit[0][6] , $sOut _ArrayAdd($aSplit , $str , 0 , "-" , @CR) For $i = 0 to 5 $sOut &= "(" & _ArrayToString(_ArrayUnique($aSplit , $i , 0 , 0 , 0) , "|") & ")-" Next msgbox(0, '' , stringtrimright($sOut , 1))
    1 point
  11. #include <Clipboard.au3> #include <Array.au3> HotKeySet("{ESC}", "_Exit") Local $aFormats[3] = [2, $CF_UNICODETEXT, $CF_TEXT] _ArrayDisplay($aFormats) While True If _ClipBoard_GetPriorityFormat($aFormats) = -1 Then ContinueLoop ;;; Other stuff WEnd Func _Exit() Exit EndFunc ;==>_Exit EDIT : @Danp2 was a bit faster
    1 point
  12. Your array has the wrong structure (first element should be format count)
    1 point
  13. That is part of the output lexer where it is checking for all kinds of error/warnings of the different known compilers, check out LexErrorList.cxx for all possibilities. Jos
    1 point
  14. One last comment: The wiki is a good source: https://www.autoitscript.com/wiki/Excel_Range#Entire_Row_.2F_Entire_Column
    1 point
  15. FrancescoDiMuro

    ArrayDisplay

    @Bishop12 WinList() returns a 2-dimension array that lets you access the elements in this way: $arrArray[$intRow][$intColumn] To have access to the first element of the array which contains a title/handle of a window, you have to start from index 1, sine the 0th index (for both row and column) is reserved to handle the number of windows found. So, if you want to use WinActivate() for a specific window, use an InputBox to let the user choose which window wants to activate, and then use the WinActivate() function with the proper syntax explained just above
    1 point
  16. save as CSV and read the line you wanna get
    1 point
  17. Sometimes using a first step just before the main regex can make the thingy sooo easy... Local $s = "#include <Inet.au3>" & @CRLF & _ "#ToDo: This is a really long explanation about something _" & @CRLF & _ "# that is very in-depth and needs to take up a lot of _" & @CRLF & _ "# space in a ToDo comment" & @CRLF & _ 'Global $variables = "Bad"' & @CRLF & _ "#ToDo: This is another long explanation about something _" & @CRLF & _ "# that is very in-depth and needs to take up a lot of space in a ToDo comment" & @CRLF & _ "#include <IE.au3>" $r1 = StringRegExpReplace($s, '\h*_\h*\R#\h*', " ") Msgbox(0,"", $r1)
    1 point
  18. Reading Stdout it seems like the path backslash needs to be escaped: $s_ media_location = StringReplace($s_ media_location,"\","/\") Simple debugger: AdlibRegister("_ReadStdout",250) Func _ReadStdout() ConsoleWrite(StdoutRead($i_mplayer_pid) & @crlf) EndFunc
    1 point
  19. Never could figure out a clean way to do this, so used the following hack: #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> Global $listview Example() Func Example() Local $button, $item1, $item2, $item3, $msg GUICreate("LISTVIEW", 220, 250, 100, 200, -1, $WS_EX_ACCEPTFILES) $listview = GUICtrlCreateListView("NO1 |NO2|NO3 ", 10, 10, 200, 150, $LVS_SINGLESEL, $LVS_EX_FULLROWSELECT) $button = GUICtrlCreateButton("BUTTON", 75, 170, 70, 20) $item1 = GUICtrlCreateListViewItem ("A1|A2|A3", $listview) $item2 = GUICtrlCreateListViewItem ("B1|B2|B3", $listview) $item3 = GUICtrlCreateListViewItem ("C1|C2|C3", $listview) $item4 = GUICtrlCreateListViewItem ("D1|D2|D3", $listview) $item5 = GUICtrlCreateListViewItem ("E1|E2|E3", $listview) GUICtrlCreateInput("", 20, 200, 150) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") Do $msg = GUIGetMsg() Select Case $msg = $button MsgBox(0, "", GUICtrlRead(GUICtrlRead($listview)), 2) Case $msg = $listview MsgBox(0, "", "" & GUICtrlGetState($listview), 2) EndSelect Until $msg = $GUI_EVENT_CLOSE EndFunc ;==>Example Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo ; Local $tBuffer $hWndListView = $listview If Not IsHWnd($listview) Then $hWndListView = GUICtrlGetHandle($listview) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $iIDFrom Case $listview Switch $iCode Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button For $i = 0 To _GUICtrlListView_GetItemCount($listview) _GUICtrlListView_SetItemDropHilited($listview, $i, False) Next $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) _GUICtrlListView_SetItemDropHilited($listview, DllStructGetData($tInfo, "Index")) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
    1 point
  20. EddieBoy, Then implement the For-loop in assembler. The zip-file below contains a complete set of resources and templates to use flat assembler code in AutoIt scripts. However, you must download FASM.DLL from the flat assembler forum yourself. FASM.DLL is dated 2017-10-20. Contents in zip-file: fasm\ - Top folder fasm\ - Resources FASM.DLL - Save FASM.DLL here *.au3 - 3 AutoIt include files MsgBox\ - Templates based on MessageBoxW function x64\MsgBox-x64.asm - 64 bit assembler source code x64\MsgBox-x64.au3 - Compiles and runs the assembler code x64\MsgBox-x64.bin - Contains the binary code (generated by MsgBox-x64.au3) x64\MsgBox-x64.txt - Binary code as text string (generated by MsgBox-x64.au3) x64\MsgBox-x64.log - Information about compilation (generated by MsgBox-x64.au3) x86\ - 32 bit templates MsgBox-1.au3 - Loads and executes fasm code from binary string MsgBox-2.au3 - Loads and executes fasm code from binary file This is the x64 and x86 source files. MsgBox-x64.asm: ; flat assembler code ; Documentation ; MessageBoxW( hWnd, pText, pCaption, iType ) ; Parameters: ; rcx : hWnd ; rdx : pText ; r8 : pCaption ; r9 : iType ; [rsp + 40] : pMessageBoxW ; Init directive use64 ; 64 bit code ; Function code mov rax, qword [rsp + 40] ; pMessageBoxW -> rax sub rsp, 40 ; Stack space and alignment call rax ; Call MessageBoxW add rsp, 40 ; Restore stack pointer ; Exit code ret ; Return MsgBox-x86.asm: ; flat assembler code ; Documentation ; MessageBoxW( hWnd, pText, pCaption, iType ) ; Parameters: ; [ebp + 08] : hWnd ; [ebp + 12] : pText ; [ebp + 16] : pCaption ; [ebp + 20] : iType ; [ebp + 24] : pMessageBoxW ; Init directive use32 ; 32 bit code ; Entry code push ebp ; Store base pointer on stack mov ebp, esp ; Use stack pointer as base pointer ; Function code push dword [ebp + 20] ; 4. parameter: iType push dword [ebp + 16] ; 3. parameter: pCaption push dword [ebp + 12] ; 2. parameter: pText push dword [ebp + 08] ; 1. parameter: hWnd call dword [ebp + 24] ; Call MessageBoxW ; Exit code pop ebp ; Restore base pointer from stack ret 20 ; Return and cleanup stack You can try to run the AutoIt scripts in MsgBox folder. Make a copy of the entire MsgBox folder and rename it for your own project. Delete bin-, txt- and log-files. Rename asm- and au3-files for your project. Start coding flat assembler. fasm.7z fasm-NoBins.7z (see post 12 and 13 below)
    1 point
  21. water

    _excel_rangeread

    Do you still get the error when you try: $aResult=_Excel_RangeRead($oWorkbook, Default, Default, Default, True)
    1 point
  22. But if the site is down and the URL is valid the code above will return False. I though a regular expression would have been suggested by PhoenixXL, but honestly I prefer _WinAPI_UrlIs() in WinAPIShPath.au3.
    1 point
  23. Example $sURL = "http://test/21-04-2014" InetGetSize($sURL) If @error Then ConsoleWrite("Invalid URL" & @CRLF) Else ConsoleWrite("Valid URL" & @CRLF) EndIf Regards Phoenix XL
    1 point
  24. Kevitto, Just what RegExes are designed for: $sString = '<br /><span style="font-size: 14pt; font-weight: normal; font-style: italic;">(téléchargement manuel ou guide de référence)</span> ' $sStripped = StringRegExpReplace($sString, "(?U)(<.*>)", "") ConsoleWrite($sStripped & @CRLF) Decode: (?U) - Not greedy - look for smallest match (<.*>) - Look for anything between <> "" - Replace any found strings with an empty string All clear? M23
    1 point
×
×
  • Create New...