Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/25/2021 in all areas

  1. As we now have a CHM file for the AD UDF the next steps could be: A single key should open ALL help files If the cursor is on a word related to AutoIt and this help key is pressed the AutoIt help file should be opened If the cursor is on a function name from the Active Directory UDF and this help key is pressed the AD help file should be opened and so on ... It should be easy to add further help files This should become true around Xmas
    1 point
  2. Hi @Dexter1993. First of all, you seem to use AutoItSharedData. It is dependent on this library, but it seems a little off-topic in this thread maybe? But anyhow, here is an example for you: Script 1: #include <AutoItObject_Internal.au3> #include <AutoItObject_Internal_ROT.au3> Global $oShare = IDispatch() ; AutoIt3 does not currently support "inline"/anonymous array creation, so we need to assign it to a variable before use. Global $aArray = [[1,2,3,4],[5,6,7,8]] $oShare.array = $aArray _AOI_ROT_register($oShare, "mouseData") While 1 Sleep(10) WEnd Script 2: #include <Array.au3> #include <AutoItObject_Internal.au3> #include <AutoItObject_Internal_ROT.au3> Global $oShare = ObjGet("mouseData") Global $aArray = $oShare.array _ArrayDisplay($aArray) ; To access array inline from object, the property must be wrapped in parentheses MsgBox(0, "", ($oShare.array)[0][0]) While 1 Sleep(10) WEnd
    1 point
  3. Try this : #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Global Const $AlphaKey = 0xFFFFFF $hGUI = GUICreate("GUI", 294, 69, 192, 124) $idProgressBar = GUICtrlCreateProgress(8, 24, 278, 17) $hGUI_c = GUICreate("", 50, 17, (8+278-50)/2, 24, $WS_POPUP,$WS_EX_LAYERED+$WS_EX_TRANSPARENT+$WS_EX_MDICHILD, $hGUI) GUISetBkColor($AlphaKey, $hGUI_c) $idLabel = GUICtrlCreateLabel("0", 0, 0, 50, 17, $SS_CENTER) GUICtrlSetFont(-1, 10) _WinAPI_SetLayeredWindowAttributes($hGUI_c, $AlphaKey) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOWNA, $hGUI_c) For $i = 0 To 50 GUICtrlSetData($idProgressBar, $i*2) GUICtrlSetData($idLabel, $i*2 & " %") Sleep(100) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
    1 point
  4. Sven

    Sleep down to 100 Nano seconds

    Thanks. "timeBeginPeriod" is exactly what I needed. It also shows that AutoIt's sleep() function is indeed hardcoded to go as low as 10ms. Here's a new code example: $hDll_ntdll = DllOpen("ntdll.dll") $hDll_winmm = DllOpen("winmm.dll") $rounds = 500 $resolution = 0 $result1 = _test(); tests for and shows the standard timer resolution MsgBox(0, "test 1", "Example for standard timer resolution" & @CRLF & @CRLF & "total: " & $result1 & @CRLF & "average: " & $result1 / $rounds) $result2 = _test(1); sets timer resolution to 1ms and performs test MsgBox(0, "test 1", "Example for 1ms timer resolution" & @CRLF & @CRLF & "total: " & $result2 & @CRLF & "average: " & $result2 / $rounds) $result1 = _test(); to show that the timer resolution was successfully reset MsgBox(0, "test 1", "Example for standard timer resolution" & @CRLF & @CRLF & "total: " & $result1 & @CRLF & "average: " & $result1 / $rounds) Func _Test($highPrecision = 0) Sleep(1000) $begin = TimerInit() For $i = 1 To $rounds _HPSleep(1, 1, $highPrecision) Next $dif = TimerDiff($begin) Return ($dif) EndFunc ;==>_Test Func _HPSleep($iSleep, $fMs = 1, $highPrecision = 0) ; default is milliseconds, otherwise microseconds (1 ms = 1000 µs) If $fMs Then $iSleep *= 1000 ; convert to ms if $highPrecision > 0 Then DllCall($hDll_winmm, "int", "timeBeginPeriod", "int", $highPrecision) DllCall($hDll_ntdll, "dword", "NtDelayExecution", "int", 0, "int64*", -10 * $iSleep) if $highPrecision > 0 Then DllCall($hDll_winmm, "int", "timeEndPeriod", "int", $highPrecision) EndFunc ;==>_HPSleep A word of caution, directly from Microsoft, http://msdn.microsoft.com/en-us/library/windows/desktop/dd757624(v=vs.85).aspx
    1 point
×
×
  • Create New...