Leaderboard
Popular Content
Showing content with the highest reputation on 07/23/2017 in all areas
-
For such a simple work, a little regex does the trick $txt = FileRead("1.txt") Local $res, $a = StringRegExp($txt, 'WordText":"([^"]+)', 3) For $i = 0 to UBound($a)-1 $res &= $a[$i] & @crlf Next Msgbox(0,"", $res)2 points
-
HighMem - Maximise your RAM access on x64
argumentum reacted to RTFC for a topic
Please answer me these questions three, ere the other side you see: Are you running a 64-bit machine with a 64-bit Windows operating system? Can your AutoIt scripts cope with having directive #AutoIt3Wrapper_UseX64=Y, and thus @AutoItX64=True? Are you sick and tired of seeing this error message? If you (like me) answered "YES" to all three questions, then the _HighMem library may ease your pain (the name commemorates a useful utility from the days when CPUs were still steam-powered). Forget about pathetic boot switches /3GB and /userva; in a full-fledged 64-bit environment, _HighMem can pre-allocate all available physical/virtual RAM you've got (or any smaller size you need), and manage individual allocations therein with four simple functions: _HighMem_StartUp( $nSize, $sUnit="GB" ) ; parse size of total region to pre-allocate, e.g. (10,"GB") _HighMem_Allocate( $nSize, $sUnit="B" ) ; returns $pOffset (new allocation's base address) _HighMem_Release( $pOffset ) ; existing allocations are identified by their offset (base address) _HighMem_CleanUp() ; close handles, release all pre-allocated memory Of course, existing AutoIt limitations remain in force (e.g., DllstructCreate() is still limited to 2 GB per call), but the maximum of 2-4 GB of virtual memory per Windows process can (under the right circumstances, in the proper environment) be circumvented. However, this is the first beta release, so glitches are likely, and performance may vary. In fact, it may not work at all for you (if you're running 32-bit, for example). And since this involves your own hardware, it's unlikely I would be able to reproduce your issues in my own work environment. Nevertheless, if you find obvious bugs or mistakes in the code, please do post. And if it works for you, that's also good to hear. My own motivation for developing it was to supercharge my matrix computing environment (Eigen4AutoIt), so it can handle matrices of any size that fit in machine RAM. The attached zip contains the library itself (HighMem.au3) and two test examples. HighMem_Test1 performs a dry run stress test of the allocation management system; it does not actually do any memory I/O. By contrast, HighMem_Test2 pre-allocates a 6 GB space, stores 3 x 2GB structs there, performs some basic I/O, and releases the allocations one by one. Obviously, for this to work you'll need at least that much free RAM to begin with (check with Task Manager -> Performance -> Memory if you're unsure). My own test environment has 16 GB of physical RAM, and runs W10Pro/64. EDIT: minor edits added to improve user experience (many more status messages if $_HighMem_Verbose=True) HighMem.v0.85.7z EDIT: from beta version 0.9, HighMem supports shared memory, including mutex negotiation. HighMemv0.9.2.7z1 point -
Rotate animation
Parsix reacted to haijie1223 for a topic
#NoTrayIcon #RequireAdmin #My QQ No: 29535065 #QQ group: 477266297 #include <GDIPlus.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Global $iSleepTime = 80 Global $hGUI = GUICreate("GDI+旋转动画", 400, 280) Global $Pic_Animation = GUICtrlCreatePic('', 5, 5, 256, 256) Global $Btn_Type1 = GUICtrlCreateButton('旋转方式一', 275, 35, 100, 30) Global $Btn_Type2 = GUICtrlCreateButton('旋转方式二', 275, 85, 100, 30) Global $Btn_Type3 = GUICtrlCreateButton('旋转方式三', 275, 135, 100, 30) Global $Slider_Time = GUICtrlCreateSlider(275, 185, 100, 45) GUICtrlSetLimit($Slider_Time, 500, 50) GUISetState() GUISetIcon('shell32.dll',322,$hGUI) GUISetOnEvent(-3, '_GuiEvent') GUICtrlSetOnEvent($Btn_Type1, '_GuiEvent') GUICtrlSetOnEvent($Btn_Type2, '_GuiEvent') GUICtrlSetOnEvent($Btn_Type3, '_GuiEvent') GUICtrlSetOnEvent($Slider_Time, '_GuiEvent') _AnimationInit(ControlGetHandle($hGUI, '', $Pic_Animation), 1) _GDIPlus_Startup() ; While 1 Sleep($iSleepTime) _NextFlash() WEnd Func _GuiEvent() Switch @GUI_CtrlId Case -3 _DeleteCache() Exit Case $Btn_Type1 _ResetAniType(1, 2) Case $Btn_Type2 _ResetAniType(2, 0) Case $Btn_Type3 _ResetAniType(3, 0) Case $Slider_Time $iSleepTime=GUICtrlRead($Slider_Time) EndSwitch EndFunc ;==>_GuiEvent Func _AnimationInit($hHwd, $SpaceSec) Global $m_hWnd = $hHwd Global $m_nWidth, $m_nHeight Global $m_AnimationIndex = 0, $m_AnimationType = 0, $m_AnimationCount = 12 Global $m_ItemSize, $m_MarginAngle Global $m_hCacheDC, $m_hCacheBitmap, $m_hCacheOldBitmap Global $m_Rect = DllStructCreate($tagRECT) Global $m_ColorBack = _WinAPI_GetSysColor($COLOR_BTNFACE) Global $m_ColorBasic[2] = [0x808080, 0xC0C0C0] Global $m_ColorFore1 = [0x1FF4FB, 0x07F98C, 0x91A804, 0xCC9302, 0xAF5801, 0x9C426B, 0x9744A7, 0x9841E4, 0x241BEE, 0x2472F5, 0x2190F4, 0x12C2FF] Global $m_ColorFore2 = [0x34F5FF, 0x3CFDA3, 0xA5B833, 0xD8A733, 0xB67636, 0xAD6988, 0xAD68B9, 0xAC66E9, 0x514AEF, 0x4E8DF5, 0x4BA5FA, 0x3ECEFE] Global $m_AnimationArray[$m_AnimationCount] Local $i For $i = 0 To $m_AnimationCount - 1 $m_AnimationArray[$i] = _AnimationItem() DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorBasic[0], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorBasic[1], 255)) Next _Resize() _ResetAniType($m_AnimationType, $SpaceSec) EndFunc ;==>_AnimationInit Func _RGB2ARGB($RGBColor, $Alpha) Return BitOR(Binary('0x' & Hex($RGBColor, 6)), BitShift($Alpha, -24)) EndFunc ;==>_RGB2ARGB Func _Resize() _DeleteCache() Local $rc = _WinAPI_GetClientRect($m_hWnd) $m_nWidth = DllStructGetData($rc, 3) - DllStructGetData($rc, 1) $m_nHeight = DllStructGetData($rc, 4) - DllStructGetData($rc, 2) If $m_nWidth > $m_nHeight Then DllStructSetData($m_Rect, 3, ($m_nHeight - 10)) Else DllStructSetData($m_Rect, 3, ($m_nWidth - 10)) EndIf ;~ DllStructSetData($m_Rect, 3, ($m_nWidth > $m_nHeight) ? ($m_nHeight - 10) : ($m_nWidth - 10)) DllStructSetData($m_Rect, 4, DllStructGetData($m_Rect, 3)) DllStructSetData($m_Rect, 1, ($m_nWidth - DllStructGetData($m_Rect, 3)) / 2) DllStructSetData($m_Rect, 2, ($m_nHeight - DllStructGetData($m_Rect, 4)) / 2) $m_ItemSize = 20 EndFunc ;==>_Resize Func _ResetAniType($AniType, $SpaceSec = 0) Local $i $m_AnimationIndex = 0 Switch $AniType Case 0 $m_AnimationType = 0 Case 1 $m_AnimationType = 1 Case 2 $m_AnimationType = 2 For $i = 0 To $m_AnimationCount - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorFore1[$i], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorFore2[$i], 255)) Next Case 3 $m_AnimationType = 3 For $i = 0 To $m_AnimationCount - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorFore1[$i], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorFore2[$i], 255)) Next Case Else _ResetAniType(0) Return EndSwitch $m_MarginAngle = $SpaceSec If $m_MarginAngle > 10 Then $m_MarginAngle = 10 If $m_MarginAngle < 0 Then $m_MarginAngle = 0 EndFunc ;==>_ResetAniType Func _NextFlash() Local $i Switch $m_AnimationType Case 0 For $i = 0 To $m_AnimationIndex - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorFore1[$i], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorFore2[$i], 255)) Next $m_AnimationIndex += 1 If ($m_AnimationIndex > $m_AnimationCount) Then $m_AnimationType = 1 $m_AnimationIndex = 0 EndIf Case 1 For $i = 0 To $m_AnimationIndex - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorBasic[0], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorBasic[1], 255)) Next $m_AnimationIndex += 1 If ($m_AnimationIndex > $m_AnimationCount) Then $m_AnimationType = 0 $m_AnimationIndex = 0 EndIf Case 2 local $item=$m_AnimationArray[11] For $i = 0 To $m_AnimationCount - 2 $m_AnimationArray[$m_AnimationCount - $i - 1] = $m_AnimationArray[$m_AnimationCount - $i - 2] Next $m_AnimationArray[0] = $item Case 3 $m_AnimationIndex = $m_AnimationIndex + 1 If ($m_AnimationIndex > $m_AnimationCount) Then $m_AnimationIndex = 0 EndSwitch _Draw() EndFunc ;==>_NextFlash Func _Draw() Local $hDC = _WinAPI_GetDC($m_hWnd) If $m_hCacheDC = 0 Then $m_hCacheDC = _WinAPI_CreateCompatibleDC($hDC) $m_hCacheBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $m_nWidth, $m_nHeight) $m_hCacheOldBitmap = _WinAPI_SelectObject($m_hCacheDC, $m_hCacheBitmap) EndIf _FillSolidRect($m_hCacheDC, _CRect(0, 0, $m_nWidth, $m_nHeight), $m_ColorBack) _DrawPie($m_hCacheDC) _WinAPI_BitBlt($hDC, 0, 0, $m_nWidth, $m_nHeight, $m_hCacheDC, 0, 0, 0x00CC0020) _WinAPI_ReleaseDC($m_hWnd, $hDC) EndFunc ;==>_Draw Func _CRect($Left, $Top, $Right, $Bottom) Local $Rect = DllStructCreate($tagRECT) DllStructSetData($Rect, 1, $Left) DllStructSetData($Rect, 2, $Top) DllStructSetData($Rect, 3, $Right) DllStructSetData($Rect, 4, $Bottom) Return $Rect EndFunc ;==>_CRect Func _FillSolidRect($hDC, $lpRect, $clr) _WinAPI_SetBkColor($hDC, $clr) _ExtTextOut($hDC, 0, 0, 2, $lpRect, Chr(0), 0, 0) EndFunc ;==>_FillSolidRect Func _DrawPie($hDC) Local $i Local $nStartAngle Local $nSweepAngle Local $pGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC) _GDIPlus_GraphicsSetSmoothingMode($pGraphics, 4) Local $pBrush = _GDIPlus_BrushCreateSolid(_RGB2ARGB(0, 255)) Local $rcOut = DllStructCreate($tagRECT) DllStructSetData($rcOut, 1, DllStructGetData($m_Rect, 1)) DllStructSetData($rcOut, 2, DllStructGetData($m_Rect, 2)) DllStructSetData($rcOut, 3, DllStructGetData($m_Rect, 3)) DllStructSetData($rcOut, 4, DllStructGetData($m_Rect, 4)) Local $rcIn = DllStructCreate($tagRECT) DllStructSetData($rcIn, 1, DllStructGetData($rcOut, 1)) DllStructSetData($rcIn, 2, DllStructGetData($rcOut, 2)) DllStructSetData($rcIn, 3, DllStructGetData($rcOut, 3)) DllStructSetData($rcIn, 4, DllStructGetData($rcOut, 4)) _InflateRectF($rcIn, -1 * $m_ItemSize) $nSweepAngle = 360 / $m_AnimationCount $nStartAngle = -90 For $i = 0 To $m_AnimationCount - 1 _GDIPlus_BrushSetSolidColor($pBrush, DllStructGetData($m_AnimationArray[$i], 1)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcOut, 1), DllStructGetData($rcOut, 2), DllStructGetData($rcOut, 3), DllStructGetData($rcOut, 4), _ $nStartAngle, $nSweepAngle - $m_MarginAngle, $pBrush) $nStartAngle += $nSweepAngle Next $nSweepAngle = 360 / $m_AnimationCount $nStartAngle = -90 For $i = 0 To $m_AnimationCount - 1 _GDIPlus_BrushSetSolidColor($pBrush, DllStructGetData($m_AnimationArray[$i], 2)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcIn, 1), DllStructGetData($rcIn, 2), DllStructGetData($rcIn, 3), DllStructGetData($rcIn, 4), _ $nStartAngle, $nSweepAngle - $m_MarginAngle, $pBrush) $nStartAngle += $nSweepAngle Next If ($m_AnimationType = 3) Then If $m_AnimationIndex > 0 Then $nStartAngle = -90 $nStartAngle = $nStartAngle + $m_AnimationIndex * $nSweepAngle _GDIPlus_BrushSetSolidColor($pBrush, _RGB2ARGB(0xFFFFFF, 150)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcOut, 1), DllStructGetData($rcOut, 2), DllStructGetData($rcOut, 3), DllStructGetData($rcOut, 4), _ $nStartAngle, $nSweepAngle - $m_MarginAngle, $pBrush) EndIf EndIf _InflateRectF($rcIn, -1 * $m_ItemSize) _GDIPlus_BrushSetSolidColor($pBrush, _RGB2ARGB($m_ColorBack, 255)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcIn, 1), DllStructGetData($rcIn, 2), DllStructGetData($rcIn, 3), DllStructGetData($rcIn, 4), 0, 360, $pBrush) _GDIPlus_BrushDispose($pBrush) _GDIPlus_GraphicsDispose($pGraphics) EndFunc ;==>_DrawPie Func _InflateRectF($rc, $dx, $dy = 0) If $dy = 0 Then $dy = $dx DllStructSetData($rc, 1, DllStructGetData($rc, 1) - $dx) DllStructSetData($rc, 2, DllStructGetData($rc, 2) - $dy) DllStructSetData($rc, 3, DllStructGetData($rc, 3) + $dx * 2) DllStructSetData($rc, 4, DllStructGetData($rc, 4) + $dy * 2) EndFunc ;==>_InflateRectF Func _DeleteCache() If $m_hCacheDC <> 0 Then _WinAPI_SelectObject($m_hCacheDC, $m_hCacheOldBitmap) _WinAPI_DeleteObject($m_hCacheBitmap) _WinAPI_DeleteDC($m_hCacheDC) _GDIPlus_Shutdown() $m_hCacheDC = 0 $m_hCacheBitmap = 0 $m_hCacheOldBitmap = 0 EndIf EndFunc ;==>_DeleteCache Func _ExtTextOut($hDC, $x, $y, $wOptions, $lpRect, $lpString, $nCount, $lpDx) If Not IsPtr($lpRect) Then $lpRect=DllStructGetPtr($lpRect) Local $Ret = DllCall('GDI32.dll', 'BOOL', 'ExtTextOutW', 'HANDLE', $hDC, 'INT', $x, 'INT', $y, 'UINT', $wOptions, 'PTR', $lpRect, 'WSTR', $lpString, 'UINT', $nCount, 'INT', $lpDx) If @error Then Return SetError(@error, 0, 0) Return $Ret[0] EndFunc ;==>_ExtTextOut Func _AnimationItem() Return DllStructCreate('INT;INT;') EndFunc ;==>_AnimationItem1 point -
In that case you can use $PROCESS_RUN instead of $PROCESS_RUNWAIT. Refer to the Example.au3 script for more details1 point
-
Welcome to AutoIt and the forum! Did you read the Terms of Use of the Gutenberg web site? They do not allow automated tools: "This website is intended for human users only. Any perceived use of automated tools to access this website will result in a temporary or permanent block of your IP address." According to our forum rules we do not support scripts violating the EULAs: "Automation of software/sites contrary to their EULA."1 point
-
I have a look at Process UDF, the code seems complicated. Try this simple one: Local $iCommand = "ping google.com" _RunCmd($iCommand) _RunCmd_GetStdOut($iCommand) Func _RunCmd($sCommand) ConsoleWrite("+ Execute: " & $sCommand & @CRLF) Local $sOutput = '', $iPID = Run('"' & @ComSpec & '" /c ' & '"' & $sCommand & '"', '', @SW_HIDE, 0x6) If Not $iPID Then Return SetError(1, 0, '') Do $sOutput &= StdoutRead($iPID) Until @error Do $sOutput &= StderrRead($iPID) Until @error ConsoleWrite("" & $sOutput & @CRLF) ConsoleWrite("- -------------------------------------------------------------" & @CRLF) Return $sOutput EndFunc ;==>_RunCmd Func _RunCmd_GetStdOut($sCommand, $sDir = '', $iType = 0x6, $bShow = False, $iDelay = 50) ConsoleWrite("+ Execute: " & $sCommand & @CRLF) Local $sTMP = '', $sOutput = '' Local $iPID = Run('"' & @ComSpec & '" /c ' & '"' & $sCommand & '"', $sDir, $bShow ? @SW_SHOW : @SW_HIDE, $iType) If Not $iPID Then Return SetError(1, 0, '') While 1 $sTMP = StdoutRead($iPID, False, False) If @error Then ExitLoop 1 If $sTMP <> "" Then $sTMP = StringReplace($sTMP, @CR & @CR, '') $sOutput &= $sTMP ConsoleWrite($sTMP) Sleep($iDelay) EndIf WEnd While 1 $sTMP = StderrRead($iPID, 0, 0) If @error Then ExitLoop If $sTMP <> "" Then $sTMP = StringReplace($sTMP, @CR & @CR, '') $sOutput &= $sTMP ConsoleWrite($sTMP) Sleep($iDelay) EndIf WEnd ConsoleWrite("- -------------------------------------------------------------" & @CRLF) Return $sOutput EndFunc ;==>_RunCmd_GetStdOut1 point
-
ArrayInArray
Qwerty212 reacted to InunoTaishou for a topic
Cleaning up some old folders and found this little snippit. Think I was using this back when I was trying to create 2d maps for a game I was making in GDI+ (that never got finished). Pretty straight forward, searches an array for an array. #include <Array.Au3> Search() Func Search() Local $aArrayToFind[][] = [["V", "V", "V", "V", "V"], ["V", "V", "V", "V", "V"], ["V", "V", "V", "V", "B"], ["V", "V", "V", "V", "B"], ["V", "V", "V", "V", "B"]] Local $aArrayToSearch[][] = [["R", "R", "R", "R", "R", "R", "R", "R", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "X", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "R", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "X", "V", "V", "V", "V", "X", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "R", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "X", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "R", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "X", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "R", "X", "X", "X", "X", "X", "X", "X", "X", "X", "X", "X", "V", "V", "V", "V", "V", "T", "T", "T", "T", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "R", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "R", "V", "X", "T", "T", "T", "T", "T", "T", "T", "T", "X", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "R", "V", "X", "T", "T", "T", "T", "T", "T", "T", "T", "X", "X", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "B", "B", "B", "B", "B", "B", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "R", "V", "X", "T", "T", "T", "T", "T", "T", "T", "T", "X", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "B", "B", "B", "B", "B", "B", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "R", "V", "X", "T", "T", "T", "T", "T", "T", "T", "T", "X", "X", "V", "V", "V", "X", "B", "B", "B", "B", "B", "V", "V", "V", "V", "B", "B", "B", "B", "B", "B", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "R", "V", "X", "T", "T", "T", "T", "T", "T", "T", "T", "X", "V", "V", "V", "V", "V", "B", "B", "B", "B", "B", "V", "V", "V", "X", "V", "V", "B", "D", "B", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "R", "V", "X", "T", "T", "T", "T", "T", "T", "T", "T", "X", "X", "V", "V", "V", "X", "B", "D", "B", "B", "B", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "R", "V", "X", "T", "T", "T", "T", "T", "T", "T", "T", "X", "V", "V", "V", "V", "V", "V", "V", "V", "X", "X", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "R", "V", "X", "T", "T", "T", "T", "T", "T", "T", "T", "X", "X", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "R", "V", "X", "T", "T", "T", "T", "T", "T", "T", "T", "X", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "V", "V", "V", "X", "T", "T", "T", "T", "T", "T", "T", "T", "X", "X", "V", "V", "V", "V", "V", "V", "V", "V", "V", "X", "X", "X", "X", "X", "X", "X", "X", "X", "X", "X", "X", "X", "T", "T", "T", "T", "T", "T"], _ ["V", "V", "V", "V", "V", "V", "V", "V", "V", "X", "X", "X", "X", "X", "X", "X", "X", "X", "X", "V", "X", "V", "V", "X", "B", "B", "B", "B", "B", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "B", "B", "B", "B", "B", "V", "V", "V", "V", "V", "M", "M", "M", "M", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "X", "B", "D", "B", "B", "B", "V", "V", "V", "V", "V", "M", "M", "M", "M", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "M", "M", "D", "M", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "T", "T", "T", "T", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "C", "C", "C", "C", "C", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "T", "T", "T", "T", "V", "T", "T", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "C", "C", "C", "C", "C", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "V", "V", "V", "V", "V", "T", "T", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "C", "C", "C", "C", "C", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "V", "V", "V", "V", "W", "W", "W", "W", "W", "W", "V", "V", "V", "V", "V", "V", "V", "C", "C", "D", "C", "C", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "V", "V", "V", "V", "W", "W", "W", "W", "W", "W", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "V", "V", "V", "V", "W", "W", "W", "W", "W", "W", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "V", "V", "V", "V", "W", "W", "W", "W", "W", "W", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "L", "L", "L", "L", "W", "W", "W", "W", "W", "W", "L", "L", "L", "V", "V", "V", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "X", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "R", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "T", "T", "T", "T", "T", "T", "T", "T", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "T", "T", "T", "T", "T", "T", "T", "T", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T"], _ ["R", "R", "R", "R", "R", "R", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "V", "V", "V", "V", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T"]] Local $aArrayInArray = ArrayInArray($aArrayToSearch, $aArrayToFind) If (@Error) Then MsgBox("", "Error", "Error doing search: " & @Error) Else If ($aArrayInArray[0] = 1) Then ToolTip("Start Coords = " & $aArrayInArray[1] & ", " & $aArrayInArray[2] & @LF & _ "End Coords = " & $aArrayInArray[1] + UBound($aArrayToFind, $UBOUND_ROWS) - 1 & ", " & $aArrayInArray[2] + UBound($aArrayToFind, $UBOUND_COLUMNS) - 1 & @LF & _ "(Approx) Center coords = " & $aArrayInArray[1] + Int(UBound($aArrayToFind, $UBOUND_ROWS) / 2) & ", " & $aArrayInArray[2] + Int(UBound($aArrayToFind, $UBOUND_COLUMNS) / 2), 0, 0) $aArrayToSearch[$aArrayInArray[1]][$aArrayInArray[2]] = "Start" $aArrayToSearch[$aArrayInArray[1] + UBound($aArrayToFind, $UBOUND_ROWS) - 1][$aArrayInArray[2] + UBound($aArrayToFind, $UBOUND_COLUMNS) - 1] = "End" $aArrayToSearch[$aArrayInArray[1] + Int(UBound($aArrayToFind, $UBOUND_ROWS) / 2)][$aArrayInArray[2] + Int(UBound($aArrayToFind, $UBOUND_COLUMNS) / 2)] = "(Approx) Center" _ArrayDisplay($aArrayToSearch, "ArrayInArray") ElseIf ($aArrayInArray[0] > 1) Then MsgBox("", "Multiple Matches", "Multiple Matches Found For Search") Else MsgBox("", "No Matches", "No Matches Found For Search") EndIf EndIf EndFunc ;==>Start Func ArrayInArray($aArrayToSearch, $aArrayToFind) Local $aReturn[3] = [0, -1, -1] If (Not IsArray($aArrayToSearch)) Then Return SetError(1, 0, $aReturn) If (Not IsArray($aArrayToFind)) Then Return SetError(2, 0, $aReturn) Local $iRowsToSearch = UBound($aArrayToSearch, $UBOUND_ROWS) Local $iColumnsToSearch = UBound($aArrayToSearch, $UBOUND_COLUMNS) Local $iRowsToFind = UBound($aArrayToFind, $UBOUND_ROWS) Local $iColumnsToFind = UBound($aArrayToFind, $UBOUND_COLUMNS) If ($iRowsToFind > $iRowsToSearch) Then Return SetError(3, 0, $aReturn) If ($iColumnsToFind > $iColumnsToSearch) Then Return SetError(4, 0, $aReturn) For $iRow = 0 To $iRowsToSearch - $iRowsToFind For $iColumn = 0 To $iColumnsToSearch - $iColumnsToFind Local $bValid = False For $i = 0 To $iRowsToFind - 1 For $p = 0 To $iColumnsToFind - 1 If ($aArrayToFind[$i][$p] = "" Or $aArrayToFind[$i][$p] = $aArrayToSearch[$iRow + $i][$iColumn + $p]) Then $bValid = True Else $bValid = False ExitLoop 2 EndIf Next Next If ($bValid) Then ; Number of valid results found $aReturn[0] += 1 ; row of the last valid result found $aReturn[1] = $iRow ; column of the last valid result found $aReturn[2] = $iColumn EndIf Next Next Return $aReturn EndFunc ;==>ArrayInArray ArrayInArray Returns an array: [0] = number of results found, [1] = row of the last valid result found, [2] = column of the last valid result found1 point -
Here is my new little function called _DLLGetFunctionNames. It extracts the dll function names from dll files. It's not perfect, but it works good. I hope you like it. Greetings from Austria! #Include <Array.au3> $DLLFile = FileOpenDialog("Choose DLL file", @SystemDir, "DLL files (*.dll)", 3) if @error Then Exit $aNames = _DLLGetFunctionNames($DLLFile) If @error Then Exit ConsoleWrite($DLLFile & ": Fault " & @error & @CR) ;~ $sNames = _DLLGetFunctionNames($DLLFile, 1) ;~ ConsoleWrite($sNames & @CRLF) _ArrayDisplay($aNames, StringTrimLeft($DLLFile, StringInStr($DLLFile, "\", 0, -1))) Func _DLLGetFunctionNames($sFileName, $ParamResult = 0) ;funkey Aug, 12th, 2010 ;$ParamOutput: 0 --> Result is array ; 1 --> Result is string Local $hFile = FileOpen($sFileName, 0) If $hFile = -1 Then Return SetError(1) ; file error Local $sFile = FileRead($hFile) FileClose($hFile) Local $iStartPos, $iEndPos, $sFunctionNames, $aFunctionNames Local $DLLName = StringTrimLeft($sFileName, StringInStr($sFileName, "\", 0, -1)) For $i = 1 To 99 $iStartPos = StringInStr($sFile, $DLLName & Chr(0), 0, -$i) If $iStartPos = 0 Then Return SetError(2) ;search error $sFunctionNames = StringTrimLeft($sFile, $iStartPos - 2) $sFunctionNames = StringTrimLeft($sFunctionNames, StringInStr($sFunctionNames, "dll") + 3) $iEndPos = StringInStr($sFunctionNames, Chr(0) & Chr(0)) $sFunctionNames = StringLeft($sFunctionNames, $iEndPos - 1) If StringInStr($sFunctionNames, Chr(0) & Chr(0x90)) Then $sFunctionNames = StringLeft($sFunctionNames, StringInStr($sFunctionNames, Chr(0) & Chr(0x90)) - 1) $aFunctionNames = StringSplit($sFunctionNames, Chr(0), 2) If UBound($aFunctionNames) > 0 And StringStripWS($aFunctionNames[0], 8) <> "" Then ExitLoop Next Switch $ParamResult Case 0 Return $aFunctionNames Case 1 Return StringReplace($sFunctionNames, Chr(0), @CRLF) EndSwitch EndFunc1 point