Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/31/2019 in Posts

  1. #include <StringConstants.au3> Global $strString = "http://www.mywebsite.com/folder1/folder2/index.html" Global $arrResult1[2], $arrResult2[2] $t1 = timerinit() For $i = 1 to 100 $arrResult1 = StringRegExp($strString, 'http://([^/]+)(.*)', $STR_REGEXPARRAYGLOBALMATCH) Next $d1 = Timerdiff($t1) Sleep(100) $t2 = timerinit() For $k = 1 to 100 $strString = StringReplace($strString, "http://", "", 1, $STR_CASESENSE) $i = StringInStr($strString, '/', $STR_CASESENSE) ; first occurrence If $i > 0 Then $arrResult2[0] = StringLeft($strString, $i-1) $arrResult2[1] = StringMid($strString, $i) Else $arrResult2[0] = $strString $arrResult2[1] = "" EndIf Next $d2 = Timerdiff($t2) Msgbox(0,"", "regex way = " & $d1 & @crlf & "string way = " & $d2)
    3 points
  2. I've never used it before, I would use for initialize something. (DllOpen, Delete a log file, clean temp for something,etc) But I will never use it because It's the first time I see it 😅 Anyway if you want to be able to use some of your global variables you could do something like this (I don't like the way/I will not use like that way. Its just a POC). #AutoIt3Wrapper_AU3Check_Parameters=-q -d -w 1 -w 2 -w- 4 -w 6 -w- 7 #OnAutoItStartRegister "_Initialize" #forcedef $g_Variable1, $g_Variable2 ConsoleWrite($g_Variable1 & " " & $g_Variable2 & @CRLF) Func _Initialize() ConsoleWrite("_Initialize" & @CRLF) Assign("g_Variable1", "Hello", 2) Assign("g_Variable2", "World", 2) EndFunc ;==>_Initialize Saludos
    2 points
  3. zoel, Open the Help file and actually look at the listed functions to see if any of them might seem likely to be useful. M23
    1 point
  4. #include <APIShPathConstants.au3> #include <WinAPIShPath.au3> Local $sUrl = "http://www.mywebsite.com/folder1/folder2/index.html" Local $sHost = _WinAPI_UrlGetPart($sUrl, $URL_PART_HOSTNAME) MsgBox(0, "Host part " & ChrW(9786), $sHost & @CRLF & _ StringReplace(StringMid($sUrl, StringInStr($sUrl, $sHost)), $sHost, "", 1))
    1 point
  5. BrewManNH

    Gui Popup

    Of course not, that's not where you set the delay, you need to use _GUIToolTip_SetDelayTime to do that. Look at the examples in the help file. Using the GUIToolTip UDF isn't as simple as a one liner tooltip entry, it takes researching what it does and how to get it to do what you want it to. A lot like programming in general.
    1 point
  6. Jos

    Gui Popup

    I don't need to see your previously posted script without any GuiToolTip function! post something small where you have played with the GuiToolTip functions that isn't working as you want. Jos
    1 point
  7. Jos

    Gui Popup

    I do not see any code you have tried and not working... show us so we can point you in the right direction! Jos
    1 point
  8. zoel, Perhaps these 2 lines might have something to do with it: Local $idInput = GUICtrlCreateEdit("", 138, 24, 921, 465) Local $Edit1 = GUICtrlCreateEdit("", 168, 48, 921, 441) If you create 2 edits, you get 2 edits. M23
    1 point
  9. Concerning the regex/string ways my comment obviously implied : in this particular case, IMHO regex is the best (handy/reliable) way. In many other different cases the string way may be : better ? frankly I don't know. faster ? certainly
    1 point
  10. Thanks IMHO your regex solution in post #2 is - any personal preference aside - by far the best one
    1 point
  11. @mikell You are A-D-O-R-A-B-L-E
    1 point
  12. Danp2

    Help clicking a button in IE

    You should be able to retrieve the button element using _IETagNameGetCollection. Then you could try using _IEAction to click it. Looks like the site uses the React Javascript library, which can lead to the issues you're encountering. Search the forum to some possible solutions.
    1 point
  13. @mustilem23 If you show some effort (and what you tried), everyone would be happy to help you
    1 point
  14. MattyD

    Big Analogue Clock

    Hey folks, This is actually the beginnings of something else - but I was pretty happy with how this part turned out. So hey, here is a clock. it is drag-able Escape (after clicking on clock) : Exit Wheel: Grow & Shrink Click Wheel: Reset Size Edit: somehow missed an include directive... #AutoIt3Wrapper_Au3Check_Parameters = -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #NoTrayIcon #include <GDIPlus.au3> #include <GUIConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) Global $hGUI, $iWinH, $iWinW, $iChSize, _ $iStartSz, $iMargin, $iCanvasSz, $iWinXStartPos Global Const $PI = 4 * ATan(1) Global Const $MAGIC_PINK = 0xFF00FF, $MAGIC_PINK_ARGB = 0xFFFF00FF $iWinH = @DesktopHeight $iWinW = $iWinH $iCanvasSz = $iWinH $iMargin = 4 $iStartSz = Int($iWinH / 4) - (2 * $iMargin) $iWinXStartPos = 0 ;Right Side: ide@DesktopWidth - ($iStartSz + (2 * $iMargin)) $hGUI = GUICreate("Clock", $iWinW, $iWinH, $iWinXStartPos, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetBkColor($MAGIC_PINK) _WinAPI_SetLayeredWindowAttributes($hGUI, $MAGIC_PINK, 0xF0) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL") GUIRegisterMsg($WM_NCMBUTTONDOWN, "WM_NCMBUTTONDOWN") Clock() Func Clock() Local $hGraphic, $hClockBitmap, $hClockGraphic Local $iSize, $iDigSize, $iOrigin Local $iNumDist, $iDigXOffset, $iDigYOffset Local $ixOffset, $iyOffset Local $hFrameBrush, $hNoseBrush, $hHighlightBrush, $hFaceBrush Local $hBlackPen, $hSecPen, $hMinPen, $hHourPen Local $iSec, $iMin, $iHour Local $ixSecOffset, $iySecOffset, $ixMinOffset, $iyMinOffset, _ $ixHourOffset, $iyHourOffset $iDigSize = $iSize / 20 $iChSize = $iStartSz _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hClockBitmap = _GDIPlus_BitmapCreateFromGraphics($iCanvasSz, $iCanvasSz, $hGraphic) $hClockGraphic = _GDIPlus_ImageGetGraphicsContext($hClockBitmap) _GDIPlus_GraphicsSetSmoothingMode($hClockGraphic, 4) $hFrameBrush = _GDIPlus_BrushCreateSolid(0xFF80BBCC) $hNoseBrush = _GDIPlus_BrushCreateSolid(0xEE778888) $hHighlightBrush = _GDIPlus_BrushCreateSolid(0x44FF00FF) $hFaceBrush = _GDIPlus_BrushCreateSolid(0xFFEEF0FF) $hSecPen = _GDIPlus_PenCreate(0xBB882255, 1) $hMinPen = _GDIPlus_PenCreate(0xBBFF8833, 4) $hHourPen = _GDIPlus_PenCreate(0xEE4488AA, 5) $hBlackPen = _GDIPlus_PenCreate(0xFF000000, 4) Do If $iSize <> $iChSize Or @SEC <> $iSec Then $iSize = $iChSize $iDigSize = $iSize / 20 $iOrigin = Int($iSize / 2) + $iMargin $iNumDist = $iSize / 2 - ($iSize / 8) $iDigXOffset = .55 * $iDigSize $iDigYOffset = -(.7 * $iDigSize) _GDIPlus_GraphicsClear($hClockGraphic, $MAGIC_PINK_ARGB) _GDIPlus_GraphicsFillEllipse($hClockGraphic, $iMargin, $iMargin, $iSize, $iSize, $hFrameBrush) _GDIPlus_GraphicsFillEllipse($hClockGraphic, $iMargin + 8, $iMargin + 8, $iSize - 8, $iSize - 8, $hHighlightBrush) _GDIPlus_GraphicsFillEllipse($hClockGraphic, $iMargin + 8, $iMargin + 8, $iSize - 16, $iSize - 16, $hFaceBrush) _GDIPlus_GraphicsDrawEllipse($hClockGraphic, $iMargin, $iMargin, $iSize, $iSize, $hBlackPen) For $i = 1 To 12 $ixOffset = Int($iNumDist * Sin($i * ($PI / 6))) $iyOffset = Int($iNumDist * Cos($i * ($PI / 6))) $ixOffset -= (StringLen($i) * $iDigXOffset) $iyOffset -= $iDigYOffset _GDIPlus_GraphicsDrawString($hClockGraphic, $i, ($iOrigin + $ixOffset), ($iOrigin - $iyOffset), "Symbol", $iDigSize) Next $iSec = @SEC $iMin = 60 * @MIN + $iSec $iHour = (3600 * @HOUR) + $iMin $ixSecOffset = Int((0.83 * $iNumDist) * Sin($iSec * ($PI / 30))) $iySecOffset = Int((0.83 * $iNumDist) * Cos($iSec * ($PI / 30))) $ixMinOffset = Int((0.85 * $iNumDist) * Sin($iMin * ($PI / 1800))) $iyMinOffset = Int((0.85 * $iNumDist) * Cos($iMin * ($PI / 1800))) $ixHourOffset = Int((0.65 * $iNumDist) * Sin($iHour * ($PI / 21600))) $iyHourOffset = Int((0.65 * $iNumDist) * Cos($iHour * ($PI / 21600))) _GDIPlus_GraphicsDrawLine($hClockGraphic, $iOrigin, $iOrigin, $iOrigin + $ixHourOffset, $iOrigin - $iyHourOffset, $hHourPen) _GDIPlus_GraphicsDrawLine($hClockGraphic, $iOrigin, $iOrigin, $iOrigin + $ixMinOffset, $iOrigin - $iyMinOffset, $hMinPen) _GDIPlus_GraphicsDrawLine($hClockGraphic, $iOrigin, $iOrigin, $iOrigin + $ixSecOffset, $iOrigin - $iySecOffset, $hSecPen) _GDIPlus_GraphicsFillEllipse($hClockGraphic, $iOrigin - 3, $iOrigin - 3, 6, 6, $hNoseBrush) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hClockBitmap, 0, 0, $iCanvasSz, $iCanvasSz) EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_BrushDispose($hFrameBrush) _GDIPlus_BrushDispose($hNoseBrush) _GDIPlus_BrushDispose($hHighlightBrush) _GDIPlus_BrushDispose($hFaceBrush) _GDIPlus_PenDispose($hSecPen) _GDIPlus_PenDispose($hMinPen) _GDIPlus_PenDispose($hHourPen) _GDIPlus_PenDispose($hBlackPen) _GDIPlus_BitmapDispose($hClockBitmap) _GDIPlus_GraphicsDispose($hClockGraphic) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Clock Func WM_NCMBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam $iChSize = $iStartSz EndFunc ;==>WM_NCMBUTTONDOWN Func WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local $iWheelDist, $iRate $iRate = 0.25 $iWheelDist = BitShift($wParam, 16) $iChSize -= Int($iRate * $iWheelDist) If $iChSize < 120 Then $iChSize = 120 If $iChSize > $iCanvasSz - (2 * $iMargin) Then $iChSize = $iCanvasSz - (2 * $iMargin) EndFunc ;==>WM_MOUSEWHEEL Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Return $HTCAPTION EndFunc ;==>WM_NCHITTEST
    1 point
  15. Yashied

    WinAPIEx UDF

    LAST VERSION - 3.8 03-Jul-12 This library contains the WinAPI functions are not included for unknown reasons to the native AutoIt WinAPI library. I use this UDF in nearly all of my programs, and decided to share it with the AutoIt community. I agree that over time some of these functions will be part of the native AutoIt library, but still... The library includes some undocumented, but useful functions (eg _WinAPI_GetFontResourceInfo()). The library also contains all the necessary constants to work with the appropriate functions. Most functions from this UDF intended for experienced users, but beginners will find the same lot of useful information for yourself. I will be to periodically add new functions to the library. The archive contains WinAPIEx library, and as usual an excellent examples from me. Some examples I took from this forum and to simplify them for better understanding. For those who use SciTE (full version) I have prepared the au3.userudfs.properties and au3.user.calltips.api files to highlight functions from this UDF in your scripts. Just copy this files to ...SciTEProperties and ...SciTEAPI, respectively. I hope this UDF will be useful for many as for me. I look forward to any feedback and suggestions. Maybe somebody wants to add new WinAPI functions? Credits Available functions Files to download WinAPIEx UDF v3.8 for AutoIt 3.3.6.1 Previous downloads: 27953 WinAPIEx UDF v3.8 for AutoIt 3.3.8.x Previous downloads: 14850
    1 point
  16. Thx for your replys but I ended out using the WinAPIEx.au3 _WinAPI_EnumProcessWindows(PID) Post I found it in:
    1 point
  17. #Include <Array.au3> #Include <WinAPIEx.au3> Opt('MustDeclareVars', 1) Global $Data = _WinAPI_EnumProcessWindows(ProcessExists('SciTE.exe')) If IsArray($Data) Then _ArrayDisplay($Data, '_WinAPI_EnumProcessWindows') EndIfWinAPIEx.au3
    1 point
  18. My solution has advantage of speed as it will be the fastest one as I think. RegExp is slow so if this URL split would be called many times inside some cycle then use my method ...
    0 points
×
×
  • Create New...