Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/02/2024 in all areas

  1. This should be faster: ;Coded by UEZ build 2024-03-02 #include <Array.au3> #include <WinAPIFiles.au3> #include <WinAPIHObj.au3> Global $sFile = "Captured.bmp" ConsoleWrite("File size = " & FileGetSize($sFile) & @CRLF) Global $t = TimerInit() Global $a1D = _WinAPI_File2Hex1DArray($sFile) ConsoleWrite(TimerDiff($t) & " ms" & @CRLF) ;~ _ArrayDisplay($a1D) Func _WinAPI_File2Hex1DArray($sFile) Local $iSize = FileGetSize($sFile) If @error Or Not $iSize Then Return SetError(1, 0, 0) Local $tBuffer = DllStructCreate("byte data[" & $iSize & "]"), $nBytes Local $hFile = _WinAPI_CreateFile($sFile, 2, 2) _WinAPI_ReadFile($hFile, $tBuffer, $iSize, $nBytes) _WinAPI_CloseHandle($hFile) Local $aResult = StringRegExp(Binary($tBuffer.data), ".{2}", 3, 3) $tBuffer = Null Return $aResult EndFunc
    2 points
  2. Version 6.1.6.0

    4,829 downloads

    zPlayer is a standalone, intuitive, and fully functional media player. Built to suit my purpose, it is customizable to your taste. zPlayer is powered by winmm.dll, an integral part of Windows. Features No 3rd Party Dependencies: Utilizes only Windows components and standard AutoIt UDFs. Universal Playback: Supports all digital media formats, provided proper codecs are installed. Independent Video Window: Separate video window with a minimal GUI for music. Versatile Loading Options: Load files, folders, or an audio CD for playback. Marquee Style Display: Long file names are displayed in smooth, infinite marquee style. Smart Playlists: Automatically generated playlists and easy-to-make custom playlists. Hidden Playlist: Playlist is hidden by default but available on demand in shuffled or sorted formats. Context Menus: Options include Play This File, File Properties, Search Internet, Go to This Folder, Move Playlist Item, and Remove from Playlist. Interactive Interface: Double-click any item to play it, search strings in the playlist, and use hotkeys for most functions. Playback Controls: Forward, backward, pause, and change folder. Repeat Functions: A-B repeat, current file repeat, and multiple-file repeat. Volume Control: Increase, decrease, or mute sound volume, synchronized with Windows volume mixer. Unmutes audio device on startup. Playback Environment Save: Save playback environment on session termination and resume in the next session. Resume Playback: Option to resume playback from where it was left off, with audio fade-in. Efficient Performance: Very low CPU and memory usage. Technical Information The script runs or compiles in x64 mode. To change this setting, comment out #AutoIt3Wrapper_UseX64=Y. The attached zPlayer.exe was compiled in x64 mode and is not flagged by Windows Defender as malicious. Compiling to x86 may result in false positive flags by Windows Defender. Feedback If you find an error, please download the latest version, as it may already be corrected. Otherwise, I would appreciate it if you could kindly let me know. zPlayer-NoUI.au3 The download section includes zPlayer-NoUI.au3. This is an abbreviated version of zPlayer, which is a music player controlled by hotkeys only, without a GUI. Note: zPlayer was tested to work in Windows 10 and 11. It should work in Windows 7, too. I would like to know if there is any compatibility problem.
    1 point
  3. Nothing major, but even small improvements can be put up for discussion: The function _WinAPI_OemToChar() is currently defined as follows: Func _WinAPI_OemToChar($sStr) Local $aCall, $sRetStr = "", $nLen = StringLen($sStr) + 1, $iStart = 1 While $iStart < $nLen $aCall = DllCall('user32.dll', 'bool', 'OemToCharA', 'str', StringMid($sStr, $iStart, 65536), 'str', '') If @error Or Not $aCall[0] Then Return SetError(@error + 10, @extended, '') $sRetStr &= $aCall[2] $iStart += 65536 WEnd Return $sRetStr EndFunc Now - why the loop? Shouldn't one call be enough? The problem is that the output buffer in the 2nd function parameter of OemToCharA was defined as an empty string of the type "str". Here AutoIt implicitly creates a buffer of the size 65536 - regardless of whether the target string is only 1 character long or 1 million. In the first case, you have only wasted memory. In the second case, however, we have a buffer overflow and AutoIt would therefore crash if we wanted to convert a string with 65536 characters. The problem was therefore tackled in the current implementation by splitting the string into chunks of 65536 characters, converting them individually and then reassembling them. My suggestion is as follows: The output buffer can also be defined directly with the correct size. This way we don't waste memory with small strings and with large strings only one DllCall is necessary. In addition to saving memory, this is actually also a few percent faster: #include <WinAPIConv.au3> #include <String.au3> Global Const $aN = [1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7] Global Const $iRUNS = 100 Global $iT, $iT1, $iT2 Global $sMeasureFormat = "%15.3f ms", $dFormLen = StringLen(StringFormat($sMeasureFormat, 0)) Global $sHeader = StringFormat("\n% 11s\t% " & $dFormLen & "s\t% " & $dFormLen & "s% 13s\n", "String size", "_WinAPI_OemToChar", "_WinAPI_OemToChar2", "Speedup") ConsoleWrite($sHeader & _StringRepeat("-", 64)) For $iN In $aN ; put some preparation stuff here Global $sString = _StringRepeat("ß", $iN) ConsoleWrite(StringFormat("\n% 11d", StringLen($sString))) ; the original _WinAPI_OemToChar() $iT = TimerInit() For $i = 1 To $iRUNS _WinAPI_OemToChar($sString) Next $iT1 = TimerDiff($iT) ConsoleWrite(StringFormat("\t" & $sMeasureFormat, $iT1 / $iRUNS)) ; the modified _WinAPI_OemToChar $iT = TimerInit() For $i = 1 To $iRUNS _WinAPI_OemToChar2($sString) Next $iT2 = TimerDiff($iT) ConsoleWrite(StringFormat("\t" & $sMeasureFormat, $iT2 / $iRUNS)) ConsoleWrite(StringFormat("\t%10.1f %%", (1 - $iT2 / $iT1) * 100)) Next ConsoleWrite(@CRLF & @CRLF) Func _WinAPI_OemToChar2($sStr) ; input string Local $tIn = DllStructCreate("CHAR [" & StringLen($sStr) + 1 & "]") DllStructSetData($tIn, 1, $sStr) ; output buffer Local $tOut = DllStructCreate("CHAR [" & StringLen($sStr) + 1 & "]") Local $aCall = DllCall("user32.dll", 'BOOL', 'OemToCharA', 'PTR', DllStructGetPtr($tIn), 'PTR', DllStructGetPtr($tOut)) If @error Or Not $aCall[0] Then Return SetError(@error + 10, @extended, '') Return DllStructGetData($tOut, 1) EndFunc ;==>_WinAPI_OemToChar2 This as a small suggestion for discussion or if no arguments against it are found adoption in later AutoIt versions.
    1 point
  4. @UEZ, very nice, that's like 10+% faster than the other versions.
    1 point
  5. Here another way which seems to be litte faster then my previous version above: ;Coded by UEZ build 2024-03-02 #include <Array.au3> #include <WinAPIFiles.au3> #include <WinAPIHObj.au3> Const $CRYPT_STRING_HEX = 4, $CRYPT_STRING_NOCRLF = 0x40000000 Global $sFile = "LCD_Test.png" ConsoleWrite("File size = " & FileGetSize($sFile) & @CRLF) Global $t = TimerInit() Global $a1D = _WinAPI_File2Hex1DArray2($sFile) ConsoleWrite(TimerDiff($t) & " ms" & @CRLF) ;_ArrayDisplay($a1D) Func _WinAPI_File2Hex1DArray2($sFile) Local $iSize = FileGetSize($sFile) If @error Or Not $iSize Then Return SetError(1, 0, 0) Local $tBuffer = DllStructCreate("byte data[" & $iSize & "]"), $nBytes Local $hFile = _WinAPI_CreateFile($sFile, 2, 2) _WinAPI_ReadFile($hFile, $tBuffer, $iSize, $nBytes) _WinAPI_CloseHandle($hFile) Local $tOut = DllStructCreate("char hex[" & DllCall("Crypt32.dll", "bool", "CryptBinaryToStringA", "struct*", $tBuffer, "dword", DllStructGetSize($tBuffer), "dword", $CRYPT_STRING_HEX + $CRYPT_STRING_NOCRLF, "struct*", Null, "dword*", Null)[5] & "]") DllCall("Crypt32.dll", "bool", "CryptBinaryToStringA", "struct*", $tBuffer, "dword", DllStructGetSize($tBuffer), "dword", $CRYPT_STRING_HEX + $CRYPT_STRING_NOCRLF, "struct*", $tOut, "dword*", DllStructGetSize($tOut)) Local $aResult = StringSplit(BinaryToString($tOut.hex), " ", $STR_NOCOUNT) $tBuffer = Null Return $aResult EndFunc
    1 point
  6. It is not so much a limitation as a choice with trade-offs. Strings in C interfaces are pointers to fixed-size char arrays. If a function that you want to call with DllCall expects a corresponding string as a parameter, you must pass it a corresponding string buffer. However, this also means that every time you pass a string, you have to create a buffer of the appropriate size, fill it with the string and then pass it to the pointer to the DllCall function. To make this a little easier, there is a shortcut in the DllCall function: "str" and "wstr". These data types do most of the work. In the variant where a string is passed to the function, this would be simple: DllCall could simply create a buffer of the corresponding size of the string and it's done. However, this is no longer feasible with the variant where the output buffer is also to be designed so simply. Because: When the function is called, it is not yet clear how large the buffer must be so that the data to be written fits into it. For this reason, a fixed size had to be specified and 65536 characters were chosen as a trade-off. This works for many cases and simplifies the handling with DllCall immensely. But there are also cases like this one, where you have to create the buffer yourself. I can't really blame the AutoIt devs for this - that's ok. Yes, that's what I would have done next. To keep the tracker clean, I wanted to discuss the whole thing here first. It's not really unlikely that I'm overlooking some aspect of this and that there were specific reasons why it was designed this way. But since you have responded to this and have not yet added such an aspect, there is a chance that I am not so wrong with my thoughts on this. Apart from that, it's nothing really big or serious. I just happened to stumble across it again today. But even small improvements should not be ignored.
    1 point
  7. Noticed that if you move the main window outside the desktop and then move it back to current desktop, it's not always painted in time so you might want to force a redraw when the main window is moved. Func WM_MOVE($hWnd, $iMsg, $wParam, $lParam) _WinAPI_RedrawWindow($hSizebox) EndFunc
    1 point
  8. heheh, I can run "Vegas mode" all night. Very nice demo.
    1 point
  9. One more control today because we can, the 14-segment display . For this one, the ascii code of a character will determine what lights up. So GuiCtrlSetData($hLCD, Chr("A")) will cause an "A" to show. Because ascii codes lower than 0x20 are mainy non-printing I've thrown a few other symbols in that space. Vlaues 0x01 to 0x08 for example may be used as a makeshift progress wheel. I've left CR and LF alone though, so these codes just clear the display. You'll find in the zip there are a couple of extra demo files that that demonstrate all possible states of the 7-segment and 14-segment displays.
    1 point
  10. Figured it meanwhile why. Read my edit above.
    1 point
  11. That's just basic math but you must be aware that $hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, $iW - 20, $iH - 20, 80, 80, $hGui) won't really make your scrollbar 80 pixels height. Edit: Your WM_SIZE tricked me. Func CreateDots($iWidth, $iHeight, $iBackgroundColor, $iDotsColor) Local $iDotSize = Int($iHeight / 10) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap) Local $hBrush = _GDIPlus_BrushCreateSolid($iDotsColor) _GDIPlus_GraphicsClear($hGraphics, $iBackgroundColor) _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 2), $iHeight - ($iDotSize * 6), $iDotSize, $iDotSize, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 2), $iHeight - ($iDotSize * 4), $iDotSize, $iDotSize, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 2), $iHeight - ($iDotSize * 2), $iDotSize, $iDotSize, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 4), $iHeight - ($iDotSize * 4), $iDotSize, $iDotSize, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 4), $iHeight - ($iDotSize * 2), $iDotSize, $iDotSize, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 6), $iHeight - ($iDotSize * 2), $iDotSize, $iDotSize, $hBrush) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) Return $hBitmap EndFunc
    1 point
  12. Like this? #include <GUIConstants.au3> #include <WinAPI.au3> ; for _WinAPI_CreateWindowEx() #include <GDIPlus.au3> Opt("MustDeclareVars", 1) ; example from "https://www.autoitscript.com/forum/topic/178961-resize-control/?do=findComment&comment=1336645" Global Const $SBS_SIZEBOX = 0x08 Global Const $SBS_SIZEGRIP = 0x10 Global $hGui, $hSizebox, $hProc, $hOldProc, $hDots Example() Func Example() Local $iW = 250, $iH = 50 $hGui = GUICreate("Resize corner", $iW, $iH, -1, -1, $WS_OVERLAPPEDWINDOW) GUISetBkColor(0x383838) Local $idResizeLabel = GUICtrlCreateLabel("", $iW - 20, $iH - 20, 22, 22) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlSetCursor(-1, 12) $hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, $iW - 20, $iH - 20, 20, 20, $hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP _GDIPlus_Startup() $hProc = DllCallbackRegister('ScrollbarProc', 'lresult', 'hwnd;uint;wparam;lparam') $hOldProc = _WinAPI_SetWindowLong($hSizebox, $GWL_WNDPROC, DllCallbackGetPtr($hProc)) $hDots = CreateDots(20, 20, 0xFF383838, 0xFFBFBFBF) GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUISetState() Local $iResize = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYUP If $iResize Then $iResize = 0 ; restore the default mouse behaviour GUISetCursor(2, 0, $hGui) GUICtrlSetState($idResizeLabel, $GUI_SHOW) EndIf Case $idResizeLabel $iResize = 1 GUICtrlSetState($idResizeLabel, $GUI_HIDE) GUISetCursor(12, 1, $hGui) MouseDown("MAIN") ; ..now that the Ctrl is hidden, nothing is held down, so we fake it ;) EndSwitch WEnd GUIDelete($hGui) _GDIPlus_BitmapDispose($hDots) _WinAPI_SetWindowLong($hSizebox, $GWL_WNDPROC, $hOldProc) DllCallbackFree($hProc) _GDIPlus_Shutdown() Exit EndFunc ;==>Example Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) Local $aSize = WinGetClientSize($hGui) WinMove($hSizebox, "", $aSize[0] - 20, $aSize[1] - 20) EndFunc ;==>WM_SIZE Func ScrollbarProc($hWnd, $iMsg, $wParam, $lParam) If $hWnd = $hSizebox And $iMsg = $WM_PAINT Then Local $tPAINTSTRUCT Local $hDC = _WinAPI_BeginPaint($hWnd, $tPAINTSTRUCT) Local $iWidth = DllStructGetData($tPAINTSTRUCT, 'rPaint', 3) - DllStructGetData($tPAINTSTRUCT, 'rPaint', 1) Local $iHeight = DllStructGetData($tPAINTSTRUCT, 'rPaint', 4) - DllStructGetData($tPAINTSTRUCT, 'rPaint', 2) Local $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hDots, 0, 0, $iWidth, $iHeight) _GDIPlus_GraphicsDispose($hGraphics) _WinAPI_EndPaint($hWnd, $tPAINTSTRUCT) Return 0 EndIf Return _WinAPI_CallWindowProc($hOldProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc Func CreateDots($iWidth, $iHeight, $iBackgroundColor, $iDotsColor) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap) Local $hBrush = _GDIPlus_BrushCreateSolid($iDotsColor) _GDIPlus_GraphicsClear($hGraphics, $iBackgroundColor) _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - 4, $iHeight - 12, 2, 2, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - 4, $iHeight - 8, 2, 2, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - 4, $iHeight - 4, 2, 2, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - 8, $iHeight - 8, 2, 2, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - 8, $iHeight - 4, 2, 2, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - 12, $iHeight - 4, 2, 2, $hBrush) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) Return $hBitmap EndFunc By the way, this definition for $tagPAINTSTRUCT must be changed from Global Const $tagPAINTSTRUCT = 'hwnd hDC;int fErase;dword rPaint[4];int fRestore;int fIncUpdate;byte rgbReserved[32]' to Global Const $tagPAINTSTRUCT = 'hwnd hDC;int fErase;long Left;long Top;long Right;long Bottom;int fRestore;int fIncUpdate;byte rgbReserved[32]'
    1 point
  13. You can do this but depending on your needs it would be more nice to register your own class and set the hbrBackground memeber of WNDCLASSEX structure. #include <GUIConstants.au3> #include <WinAPI.au3> ; for _WinAPI_CreateWindowEx() Opt("MustDeclareVars", 1) ; example from "https://www.autoitscript.com/forum/topic/178961-resize-control/?do=findComment&comment=1336645" Global Const $SBS_SIZEBOX = 0x08 Global Const $SBS_SIZEGRIP = 0x10 Global $hGui, $hSizebox, $hProc, $hOldProc, $hBrush Example() Func Example() Local $iW = 250, $iH = 50 $hGui = GUICreate("Resize corner", $iW, $iH, -1, -1, $WS_OVERLAPPEDWINDOW) GUISetBkColor(0x00FF) Local $idResizeLabel = GUICtrlCreateLabel("", $iW - 20, $iH - 20, 22, 22) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlSetCursor(-1, 12) $hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, $iW - 20, $iH - 20, 20, 20, $hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP $hBrush = _WinAPI_CreateSolidBrush(0x000080) $hProc = DllCallbackRegister('ScrollbarProc', 'lresult', 'hwnd;uint;wparam;lparam') $hOldProc = _WinAPI_SetWindowLong($hSizebox, $GWL_WNDPROC, DllCallbackGetPtr($hProc)) GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUISetState() Local $iResize = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYUP If $iResize Then $iResize = 0 ; restore the default mouse behaviour GUISetCursor(2, 0, $hGui) GUICtrlSetState($idResizeLabel, $GUI_SHOW) EndIf Case $idResizeLabel $iResize = 1 GUICtrlSetState($idResizeLabel, $GUI_HIDE) GUISetCursor(12, 1, $hGui) MouseDown("MAIN") ; ..now that the Ctrl is hidden, nothing is held down, so we fake it ;) EndSwitch WEnd GUIDelete($hGui) _WinAPI_DeleteObject($hBrush) _WinAPI_SetWindowLong($hSizebox, $GWL_WNDPROC, $hOldProc) DllCallbackFree($hProc) Exit EndFunc ;==>Example Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) Local $aSize = WinGetClientSize($hGui) WinMove($hSizebox, "", $aSize[0] - 20, $aSize[1] - 20) EndFunc ;==>WM_SIZE Func ScrollbarProc($hWnd, $iMsg, $wParam, $lParam) If $hWnd = $hSizebox Then Switch $iMsg Case $WM_ERASEBKGND Local $tRect = _WinAPI_GetClientRect($hWnd) _WinAPI_FillRect($wParam, $tRect, $hBrush) Return True Case $WM_PAINT Local $tPAINTSTRUCT Local $hDC = _WinAPI_BeginPaint($hWnd, $tPAINTSTRUCT) Local $tRect = _WinAPI_CreateRect($tPAINTSTRUCT.Left, $tPAINTSTRUCT.Top, $tPAINTSTRUCT.Right, $tPAINTSTRUCT.Bottom) _WinAPI_FillRect($hDC, $tRect, $hBrush) _WinAPI_EndPaint($hWnd, $tPAINTSTRUCT) Return 0 EndSwitch EndIf Return _WinAPI_CallWindowProc($hOldProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc
    1 point
  14. >GUI based automation while running from SYSTEM That's a no >running from SYSTEM without a user logged in Another no. Part of the first answer above. What you did is very well done and the limitations you've found can not be overcame by using ... anything. You either load the hive of each user and re-invent intuits installers ( a big "don't go there" ) or schedule something, so that at login your automation does the install ( while the users finishes the coffee because that's what they are doing anyway ) when an update is needed. I'd ask intuit if they have a corporate/enterprise update system. My 2 cents, I don't use intuit
    1 point
  15. it was resolved #include <GUIConstants.au3> Global $hGUI = GUICreate("GUI") Global $id_1 = _CreateInput("INPUT1", 20, 20, 150, 30, "0xB6FF00", 10) Global $id_2 = _CreateInput("INPUT2", 20, 60, 150, 30, "0xB6FF00") Global $id_3 = _CreateInput("INPUT3", 20, 100, 150, 35, "0xFFD800", 10) Global $id_4 = _CreateInput("INPUT4", 20, 145, 150, 35, "0xFFD800") Global $id_5 = _CreateInput("INPUT5", 20, 190, 150, 40, "0xFFB400", 10) Global $id_6 = _CreateInput("INPUT6", 20, 240, 150, 40, "0xFFB400") Global $id_7 = _CreateInputWL("Test Label:", "INPUT7", 220, 20, 150, 30, "0xB6FF00", 10) Global $id_8 = _CreateInputWL("Test Label:", "INPUT8", 220, 60, 150, 30, "0xB6FF00") Global $id_9 = _CreateInputWL("Test Label:", "INPUT9", 220, 100, 150, 30, "0xB6FF00", 10) Global $id_10 = _CreateInputWL("Test Label:", "INPUT10", 220, 145, 150, 30, "0xB6FF00") Global $id_11 = _CreateInputWL("Test Label:", "INPUT11", 220, 190, 150, 40, "0xFFB400", 10) Global $id_12 = _CreateInputWL("Test Label:", "INPUT12", 220, 240, 150, 40, "0xFFB400") GUISetState() Sleep(3000) GUICtrlSetData($id_1, "[test] gyps") GUICtrlSetData($id_7, "[test] gyps") While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ;-------------------------------------------------------------------------------------------------------------------------------- Func _CreateInput($Text, $Left, $Top, $Width, $Height, $Color, $Corner = $Height / 2) GUICtrlCreateGraphic($Left, $Top, $Width, $Height) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color, $Color) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $Corner, 0) GUICtrlSetGraphic(-1, $GUI_GR_BEZIER, $Corner, $Height, 0, 0, 0, $Height) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $Width - $Corner, 0) GUICtrlSetGraphic(-1, $GUI_GR_BEZIER, $Width - $Corner, $Height, $Width, 0, $Width, $Height) GUICtrlSetGraphic(-1, $GUI_GR_RECT, $Corner, 0, $Width - ($Corner * 2), $Height) GUICtrlSetState(-1, $GUI_DISABLE) $idInput1 = GUICtrlCreateInput($Text, $Left + $Corner, $Top + ($Height * 0.2), $Width - ($Corner * 2), $Height * 0.6, -1, $WS_EX_TOOLWINDOW) GUICtrlSetFont(-1, Int($Height * 0.4), 400) GUICtrlSetBkColor(-1, $Color) Return $idInput1 EndFunc ;==>_CreateInput ;-------------------------------------------------------------------------------------------------------------------------------- Func _CreateInputWL($Label, $Text, $Left, $Top, $Width, $Height, $Color, $Corner = $Height / 2) GUICtrlCreateGraphic($Left, $Top, $Width, $Height) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color, $Color) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $Corner, 0) GUICtrlSetGraphic(-1, $GUI_GR_BEZIER, $Corner, $Height, 0, 0, 0, $Height) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $Width - $Corner, 0) GUICtrlSetGraphic(-1, $GUI_GR_BEZIER, $Width - $Corner, $Height, $Width, 0, $Width, $Height) GUICtrlSetGraphic(-1, $GUI_GR_RECT, $Corner, 0, $Width - ($Corner * 2), $Height) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel($Label, $Left + $Corner, $Top, $Width - ($Corner * 2), $Height * 0.4) GUICtrlSetBkColor(-1, $Color) GUICtrlSetFont(-1, Int($Height * 0.25)) $idInput1 = GUICtrlCreateInput($Text, $Left + $Corner, $Top + ($Height * 0.35), $Width - ($Corner * 2), $Height * 0.60, -1, $WS_EX_TOOLWINDOW) GUICtrlSetFont(-1, Int($Height * 0.35)) GUICtrlSetBkColor(-1, $Color) Return $idInput1 EndFunc ;==>_CreateInputWL ;--------------------------------------------------------------------------------------------------------------------------------
    1 point
  16. Version v1.4.0

    917 downloads

    Purpose (from Microsoft's website) The HTTP Server API enables applications to communicate over HTTP without using Microsoft Internet Information Server (IIS). Applications can register to receive HTTP requests for particular URLs, receive HTTP requests, and send HTTP responses. The HTTP Server API includes SSL support so that applications can exchange data over secure HTTP connections without IIS. Description There have been several times in the past that I wanted to either retrieve information from one of my PCs or execute commands on one of my PCs, whether it was from across the world or sitting on my couch. Since AutoIt is one of my favorite tools for automating just about anything on my PC, I looked for ways to make to make it happen. Setting up a full blown IIS server seemed like overkill so I looked for lighter weight solutions. I thought about creating my own AutoIt UDP or TCP server but that just wasn't robust enough, Then I found Microsoft's HTTP Server API and it looked very promising. After doing a little research into the APIs, I found that it was flexible & robust enough to handle just about any of the tasks that I required now and in the future. So a while back I decided to wrap the API functionality that I needed into an AutoIt UDF file to allow me to easily create the functionality I needed at the time. It has come in very handy over the years. Of course it wasn't all wrapped up with a nice little bow like it is now. That only happened when I decided to share it with anyone else who could use it or learn from it. The example file that I included is a very granular example of the steps required to get a lightweight HTTP Server up and listening for GET requests. The UDF is a wrapper for the Microsoft APIs. That means to do anything over and above what I show in the example, one would probably have to have at least a general knowledge of APIs or the ability to figure out which APIs/functions to use, what structures and data is needed to be passed to them, and in what order. However, the UDF gives a very solid foundation on which to build upon. Of course, if anyone has questions about the UDF or how to implement any particular functionality, I would probably help to the extent that I could or point you in the right direction so that you can figure out how to implement your own solution. The APIs included in the UDF are the ones that I needed in the past to do what I needed to do. If any additional APIs need to be added to the UDF file, please make those suggestions in the related forum topic. Being that this is basically an AutoIt wrapper for the Microsoft API functions, there's no need to create AutoIt-specific documentation. All of the UDF functions, structures, constants, and enumerations are named after their Microsoft API counterparts. Therefore, you can refer to Microsoft's extensive documentation of their HTTP Server API. As stated earlier, if there is one or more APIs that you find yourself needing for your particular solution, please suggest it in the related Example Scripts forum topic. Related Links Microsoft HTTP Server API - Start Page Microsoft HTTP Server API - API v2 Reference Microsoft HTTP Server API - Programming Model
    1 point
  17. guinness

    ResourcesEx UDF.

    So if you haven't noticed Zedna's Resources UDF has been a very popular UDF over the last 7 years and was last updated in 2011, but now is the time to bring the UDF up to date with the current AutoIt language syntax (v3.3.14.2). So with the blessing of Zedna may I present to you ResourcesEx. It's built using the UDF standards I have tried to enforce around here, with improved documentation and an overall UDF structure. I please ask that you try and break the UDF, criticise, educate, whatever, just play around with the functions and example. I do ask that you just don't say "you've missed the point" and leave at that. Provide an alternative or constructive reason as to why I have "missed the point". Thanks. IMPORTANT: You must be using SciTE4AutoIt3, as this comes included with AutoItWrapper Changes between Zedna's UDF and guinness' UDF. _ResourceGet() => _Resource_Get() _ResourceGetAsString() => _Resource_GetAsString() with an additional param of whether to return ANSI. _ResourceGetAsStringW() => _Resource_GetAsString() _ResourceGetAsBytes() => _Resource_GetAsBytes() _ResourceGetAsImage() => _Resource_GetAsImage() _ResourceGetAsBitmap() => _Resource_GetAsBitmap() _ResourceSaveToFile() => _Resource_SaveToFile() _ResourceSetImageToCtrl() => _Resource_SetToCtrlID() _SetBitmapToCtrl() => _Resource_SetBitmapToCtrlID() As to JFX's question of what makes this different... Known problems/limitations: (Taken for Zedna's Resources UDF) _ResourceGet() returns resource size (in bytes) in @extended macro but not for resource type RT_BITMAP [FIXED] _ResourceSetImageToCtrl() works with "static/button" type of controls (picture,label,icon,button,checkbox,radiobutton,groupbox) [NO_ISSUE] _ResourcePlaySound() plays only WAV files (not MP3 files) [FIXED] _ResourceGetAsBytes() doesn't work for RT_BITMAP type because _ResourceGet() returns hBitmap instead of memory pointer in this case there could be used _ResourceGetAsImage() as workaround _ResourceGet() has potential memory leak releasing of resources UnlockResource, FreeResource (opposite of LoadResource, LockResource) is not done because it must be done after using of resources at the end and not inside UDF [FIXED] _GDIPlus_Startup() is called once at start of whole include --> no _GDIPlus_Shutdown() is called [FIXED] Download the ZIP and play around with the Example/UDF. ResourcesEx.zip Jos: 15-9-2022 Updated version replaced $__WINVER with _WinAPI_GetVersion() Jos: 27-4-2023 updated script as they required extra #include: ResourcesEx.zip Changelog: 2015/09/26 Changed: Comments throughout the UDF, removing trailing dot Fixed: Various cosmetic changes 2015/01/12 Fixed: Example directive using double equals sign Fixed: Delete functions not being cast as a bool value. (Thanks Synix) Fixed: @error and @extended not be passed back in nested functions e.g. _Resource_GetAsRaw() 2014/07/19 Added: _Resource_SetBitmapToCtrlID() formely known as _Resource_SetImageToCtrlID() Added: Note about using #AutoIt3Wrapper_Res_Icon_Add to the example. (Thanks Zedna) Added: Passing a blank string to _Resource_SetToCtrlID() through the $sResNameOrID parameter, will delete the image and previous handle Changed: _Resource_SetImageToCtrlID() now accepts a hBitmap not a HBITMAP object Fixed: _Resource_GetAsBitmap() now works the same way as _ResourceGetAsBitmap() did, by converting a jpg, png etc... to HBITMAP Fixed: Memory management of some functions 2014/07/18 Fixed: Destroying a cursor Fixed: Regression from loading the current of external module. (Thanks UEZ) 2014/07/17 Added: Additonal checks to destroy cursors and icons Added: Checking if the dll or exe filepath has a valid extension Added: Example of using an icon and image on a button control Fixed: Icons and cursors (finally) being re-sized to a control Fixed: Using GUIGetStyle() on a non-AutoIt handle would cause issue with controls Fixed: Variable naming of $sDLL to $sDllOrExePath for improved clarity Removed: Workaround for setting icons to AutoIt controls 2014/07/17 Added: Commented workaround in the example for re-sizing an icon control Added: ResourcesEx_PE.au3 created by PreExpand for all you constant variable haters out there!!! Fixed: Changelog comments and source code comments Fixed: Re-sizing icons when the control was different to the icon's size. (Thanks czardas for the MSDN link and Jon.) Fixed: Re-sizing cursors and icons in general 2014/07/15 Added: Comments about using SOUND for wav files and RT_RCDATA for mp3 files. (Thanks Melba23) Added: Option to relevant functions to re-size the image based on the control's dimensions. (Requested by kinch: http://www.autoitscript.com/forum/topic/51103-resources-udf/?p=1147525) Added: Using _Resource_LoadFont() example. (Thanks UEZ) Changed: Certain example resources to now use those found in %AUTOITDIR%\Examples\Helpfile\Extras Changed: Constants and enums readability. (Thank mLipok) Changed: Internal functions for destroying resources Changed: Removed changes made from the previous version for loading resources multiple times. The design needs to be re-thought Changed: Setting styles of controls using native AutoIt functions Fixed: Destroying control resource images would fail to show if reinstated again Fixed: Documentation comments Fixed: Missing certain users who helped with creating this UDF Fixed: Outdated SciTE files 2014/07/14: Added: _Resource_GetAsCursor(), for the loading of animated cursors and standard cursors which can then be used with _WinAPI_SetCursor() Added: _Resource_GetAsIcon(), for loading icon resource types Added: _Resource_LoadFont(), which retrieves a font resource and adds to the current memory of the associated module Added: _Resource_SetCursorToCtrlID() and _Resource_SetIconToCtrlID() Added: Additional resource types to destroy on exit, including $RT_FONT, $RT_ICON and $RT_MENU Added: Playing Mp3s to _Resource_LoadSound(). (Thanks to UEZ and Melba23 with changes made by me.) Changed: _Resource_GetAsBitmap() returns a HTBITMAP handle without converting from hBitmap to HBITMAP Changed: _Resource_PlaySound() to _Resource_LoadSound() Changed: _Resource_SetBitmapToCtrlID() to _Resource_SetImageToCtrlID() Changed: _SendMessage() to GUICtrlSendMsg() Changed: Example files Changed: Setting $iError in the internal get function Changed: Signature of _Resource_Destroy() Changed: Updated example to reflect major changes to the ResourcesEx UDF Changed: Various UDF tweaks that I didn't document because I simply couldn't keep track of all the playing around I did in the last week Fixed: _Resource_GetAsImage() not returning an error when a bitmap couldn't be found in the resource table Fixed: Retrieving length of a string Fixed: Using the current module instead of zero in _Resource_LoadSound() Fixed: Various comment changes. (Thanks mLipok) Fixed: Loading resources multiple times. This is fixed thanks to using the internal storage array 2014/07/07: Added: _Resource_Destroy() and _Resource_DestroyAll() to destroy a particular resource name or all resources Added: Checking if the resource name of id value is empty Added: Descriptions, though could do with a little tweaking Changed: _Resource_Get() to _Resource_GetAsRaw() Changed: Internal workings of __Resource_Storage() Changed: Re-size the storage array when destroyed or on shutdown Fixed: _Resource_GetAsString() with default encoding of ANSI Fixed: Calltips API referencing Resources.au3 and not ResourcesEx.au3 Removed: _Resource_Shudown() due to the addition of _Resource_Destroy() and _Resource_DestroyAll() 2014/07/06: Added: _Resource_Shudown() to free up those resources which aren't loaded using _WinAPI_LockResource(). UnlockResource is obsolete Added: Support for using $RT_STRING Changed: _Resource_GetAsString() now works correctly for most encodings. (Thanks Jos) Changed: _Resource_GetAsString() will now load as a string if the resource type requested is $RT_STRING 2014/07/04: Added: #Regions. (Thanks mLipok) Added: #Tidy_Parameters=/sort_funcs /reel (Thanks mLipok) Added: All optional params now accept the default keyword Added: Link to this thread. (Thanks mLipok) Added: Main header. (Thanks mLipok) Changed: $f.... >> $b..... (Thanks mLipok) 2014/07/03: Initial release
    1 point
×
×
  • Create New...