Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation since 04/27/2023 in all areas

  1. Melba23

    New MVPs

    I am sure all members will wish to join me in welcoming our new MVPs: argumentum and gianni. It has been a while since the last promotions, but it goes to show that helping out around here does get noticed! M23
    22 points
  2. LAteNightSpecial did show "its" true nature and got indefinitely banned for that. Also done some posts cleanup to avoid any more discussion/questions.
    10 points
  3. Jon

    Random DoS Attacks

    Hi, some random DoS attacks ongoing at the mo. Server is auto banning, but maybe some outages. Thanks, Jos, for letting me know,
    10 points
  4. hi all This one is nowhere near finished - I'd probably call it a proof of concept for now - "GDIControls.au3" needs to be included, then there's a couple of control types that you should be able to create. _GUICtrlGDI_CreateHFader($hGUI, $iX, $iY, $iWidth, $iHeight [, $Colour [, $iStyle [, $iExStyle ]]]) _GUICtrlGDI_CreateVFader($hGUI, $iX, $iY, $iWidth, $iHeight [, $Colour [, $iStyle [, $iExStyle ]]]) _GUICtrlGDI_CreateKnob($hGUI, $iX, $iY, $iWidth, $iHeight [, $Colour [, $iStyle [, $iExStyle ]]]) _GUICtrlGDI_CreateLRKnob($hGUI, $iX, $iY, $iWidth, $iHeight [, $Colour [, $iStyle [, $iExStyle ]]]) _GUICtrlGDI_CreateVMeter($hWnd, $iX, $iY, $iWidth, $iHeight [, $iStyle [, $iExStyle]]) _GUICtrlGDI_CreateHMeter($hWnd, $iX, $iY, $iWidth, $iHeight [, $iStyle [, $iExStyle]]) _GUICtrlGDI_Create7SegDisplay($hGUI, $iX, $iY, $iWidth, $iHeight [, $Colour [, $iStyle [, $iExStyle ]]]) _GUICtrlGDI_Create14SegDisplay($hGUI, $iX, $iY, $iWidth, $iHeight [, $Colour [, $iStyle [, $iExStyle ]]]) The above functions return a controlID which can be read with GuiCtrlRead() via the usual methods. The controls can also be manipulated with GuiCtrlSetData() Valid values can be from 0 through to 127. That's about the long and short of it! ---------- Theres a bit going on with the mechanics of it here, and I'm sure theres probably a better way of going about things... But for anyone who' s interested this is what's going on: I take the requested dimentions of the control, If there's already bitmaps available for the requested type/dimentions/colour we use those. Otherwise, we dynamically generate a set of 128 bitmaps for the control. The next step is to create a "static" control, which is basically the same as a label. With the right style we can push images to these however. At this stage those optional $iStyle and $iExStyle flags come into play. There are some forced style values to make things work, but hey, if you want to add $WS_BORDER or something I'm not gonna stop ya! Static controls are pretty dumb, but they do know when they're clicked on ($STN_CLICKED). This is enough to let me know that a control needs updating. Next we need to track the mouse. We need to know when and where the mouse in released. I can't really utillise the $GUI_EVENT_* method for this. I'd either have to force OnEvent() mode, or we'd have to ask the user to call some function in the Main GuiGetMsg() Loop. So then I thought of handling $WM_MOUSEMOVE. This works great until you move over a control in the client area! It seems the message gets gobbled up. So now I'm using a low-level mouse hook. With this I can find where we are relative to the control and update it accordingly. The next peice of the puzzle is to let the user know that something has been done. I can easily provide a "getter" function that retrieves the control's values. I'd rather not have a bespoke function for this though. So I thought its better to associate dummy controls, which I use as a delivery mechanism. Lastly we need have a method of updating the control from outsige the GUI. For ease of use we probably want to leverage GuiCtrlSetData(). Setting the dummy control this way puts us in the same predicament as earlier however - we can't really use GuiGetMsg() to monitor it. but we can periodically check the value of the dummy control with an adlib function. If the value of the dummy is not where the GDI control was set with the GUI, we know we need to update it! GDICtrls_1-9.zip
    8 points
  5. I ported half of the Cairo functions to Autoit. You can read more about the functions here: https://www.cairographics.org/documentation/ The probability is high that errors have crept in and I have only tested a fraction of the functions. Anyone who wants to can contribute examples. All needed files (DLLs, UDF and examples) can be download from my OneDrive: Cairo for Autoit If you find a mistake, I am sure you will, then please report it.
    8 points
  6. Andreik

    Slideshow UDF

    This is a basic UDF to create nice slideshows. There are a lot of customizable options so it might be useful in some projects. Here is an example: #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 4 -w 5 -w 6 -w 7 #Au3Stripper_Parameters=/sf /sv /mo /rm /rsln #include "Slideshow.au3" Global $avImage[4] = [ _ 'https://lh5.googleusercontent.com/p/AF1QipM3jIOsqrISfcKwgYLYF8-9DyAzQiUyWmB35nBj=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipMPb5fGtzZz2ZJFd20CV2trNzmxNOYLv4abJSfi=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipPLOXRwTpKbFxNNLTmiLrIJlG_H3h4VU6HShLwf=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipPNiwx1lGPxcHJzKTMRl5Cyr1SOjS05yHbif8BE=w540-h312-n-k-no' _ ] Global $asCaptions[4] = ['Pico do Fogo', 'Praia da Chave', 'Buracona - Blue Eye Cave', 'Deserto de Viana'] Global $mOptions[] $mOptions['ImageType'] = 'URL' $mOptions['Captions'] = $asCaptions $mOptions['ShowCaptions'] = True Global $sTitle = 'Cape Verde' Global $sText = 'Cape Verde or Cabo Verde, officially the Republic of Cabo Verde, is an archipelago and island country of West Africa in the central Atlantic Ocean, ' & _ 'consisting of ten volcanic islands with a combined land area of about 4,033 square kilometres (1,557 sq mi). These islands lie between 600 and 850 kilometres ' & _ '(320 and 460 nautical miles) west of Cap-Vert, the westernmost point of continental Africa. The Cape Verde islands form part of the Macaronesia ecoregion, ' & _ 'along with the Azores, the Canary Islands, Madeira, and the Savage Isles.' Global $sExtraText = "Cape Verde's official language is Portuguese. The recognized national language is Cape Verdean Creole, which is spoken by the vast " & _ "majority of the population. As of the 2021 census the most populated islands were Santiago, where the capital Praia is located (269,370), São Vicente (74,016), " & _ "Santo Antão (36,632), Fogo (33,519) and Sal (33,347). The largest cities are Praia (137,868), Mindelo (69,013), Espargos (24,500) and Assomada (21,297)." Global $sCopyright = 'Sources for pictures and data are from google.com and wikipedia.com' Global $hGUI, $cTitle, $cText, $cExtra, $cCopyright, $mSlideshow _GDIPlus_Startup() $hGUI = GUICreate('Slideshow', 870, 450) $cTitle = GUICtrlCreateLabel($sTitle, 10, 10, 300, 60) $cText = GUICtrlCreateLabel($sText, 10, 90, 300, 240) $cExtra = GUICtrlCreateLabel($sExtraText, 10, 330, 850, 80) $cCopyright = GUICtrlCreateLabel($sCopyright, 10, 420, 850, 20) $mSlideshow = _GUICtrlSlideshow_Create($hGUI, 320, 10, 540, 312, $avImage, $mOptions) GUICtrlSetFont($cTitle, 35, 600, 0, 'Segoe UI') GUICtrlSetFont($cText, 11, 500, 0, 'Segoe UI') GUICtrlSetFont($cExtra, 11, 500, 0, 'Segoe UI') GUICtrlSetFont($cCopyright, 11, 500, 2, 'Segoe UI') GUICtrlSetColor($cTitle, 0x000060) GUICtrlSetColor($cCopyright, 0x800000) GUISetState(@SW_SHOW, $hGUI) While True If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_PREV_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_PREV) If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_NEXT_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_NEXT) Switch GUIGetMsg() Case -3 ExitLoop EndSwitch WEnd _GUICtrlSlideshow_Delete($mSlideshow) _GDIPlus_Shutdown() There might be some hidden bugs. If you encounter any just let me know. Tip: use SlideshowEx.au3 if you don't want to preload the images Slideshow.au3SlideshowEx.au3
    8 points
  7. He also provide Bans.
    8 points
  8. Andreik

    ePUB Reader

    This is a portable application that can open ePUB books (EPUB 2 and EPUB 3) and it's made just with native AutoIt UDFs. It's a personal project since I have many ebooks but I post the code here just in case someone else need a portable and lightweight reader or simply to learn how to read ePUB files. Features: Load ePUB book Navigation through content (backward / forward / stop / refresh) with a visual indicator of chapters in the form of an interactive slider. Resizeable and (partially) customizable UI Custom CSS (partially) Jump to chapter Note: This is an early (experimental) release that might have undiscovered bugs and please note that some features are just partially implemented. I tested the application with a dozen of ePUB books but I am sure that some bugs might come to light soon, so if you found any just let me know and I will try to fix the application. I don't have enough space to upload the source and binary here but you can see the entire project on GitHub or download from AutoIt.
    7 points
  9. Hi @TheSaint Here a fast hack how to rotate the image by drawing a line on the edge of the CD cover to give you more flexibility. ;Coded by UEZ 2024-03-16 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global $sFile = "cover.jpg" ;FileOpenDialog("Select an image", "", "Images (*.jpg;*.png;*.gif;*.bmp)") If @error Then Exit Const $fPI = ACos(-1) _GDIPlus_Startup() Global $hImage = _GDIPlus_ImageLoadFromFile($sFile), $hImage_rotated Global $aDim = _GDIPlus_ImageGetDimension($hImage) Global Const $hGUI = GUICreate("Image Rotate", $aDim[0], $aDim[1]) Global Const $hDC = _WinAPI_GetDC($hGUI) Global Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $aDim[0], $aDim[1]) Global Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Global Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Global Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) Global Const $hPen = _GDIPlus_PenCreate(0xFFFFFFFF) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, 4) _GDIPlus_GraphicsDrawImageRect($hCanvas, $hImage, 0, 0, $aDim[0], $aDim[1]) GUISetCursor(3, 0, $hGUI) GUISetState() Global $aCI, $c = 0, $x1, $y1, $x2, $y2 Do _GDIPlus_GraphicsDrawImageRect($hCanvas, $hImage, 0, 0, $aDim[0], $aDim[1]) $aCI = GUIGetCursorInfo($hGUI) If $aCI[2] Then While GUIGetCursorInfo($hGUI)[2] Sleep(1) WEnd $c += 1 Switch $c Case 1 $x1 = $aCI[0] $y1 = $aCI[1] Case 2 $x2 = $aCI[0] $y2 = $aCI[1] EndSwitch EndIf Switch $c Case 1 _GDIPlus_GraphicsDrawLine($hCanvas, $x1, $y1, $aCI[0], $aCI[1], $hPen) Case 2 _GDIPlus_GraphicsDrawLine($hCanvas, $x1, $y1, $x2, $y2, $hPen) EndSwitch _WinAPI_BitBlt($hDC, 0, 0, $aDim[0], $aDim[1], $hDC_backbuffer, 0, 0, $SRCCOPY) If $aCI[3] Then ExitLoop Sleep(10) Until False _GDIPlus_GraphicsDrawImageRect($hCanvas, $hImage, 0, 0, $aDim[0], $aDim[1]) _GDIPlus_ImageRotate($hImage, 360 - CalculateAngle($x1, $y1, $x2, $y2)) $hImage_rotated = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) ;save result _GDIPlus_GraphicsClear($hCanvas) Do _GDIPlus_GraphicsDrawImageRect($hCanvas, $hImage_rotated, 0, 0, $aDim[0], $aDim[1]) _WinAPI_BitBlt($hDC, 0, 0, $aDim[0], $aDim[1], $hDC_backbuffer, 0, 0, $SRCCOPY) Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_ReleaseDC($hGUI, $hDC) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _GDIPlus_PenDispose($hPen) _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($hImage_rotated) _GDIPlus_Shutdown() Func CalculateAngle($x1, $y1, $x2, $y2) Return ATan(($y2 - $y1) / ($x2 - $x1)) * (180 / $fPi) + ($x1 > $x2 ? 180 : ($y1 > $y2 ? 360 : 0)) EndFunc Func _GDIPlus_ImageRotate($hImage, $fDegree) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $fDegree = ' & $fDegree & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Local $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $aDim[0] / 2, $aDim[1] / 2) _GDIPlus_MatrixRotate($hMatrix, $fDegree) _GDIPlus_MatrixTranslate($hMatrix, -$aDim[0] / 2, -$aDim[1] / 2) _GDIPlus_GraphicsSetTransform($hCanvas, $hMatrix) _GDIPlus_MatrixDispose($hMatrix) EndFunc After you have started the script and the image is displayed click (lmb) on the left upper corner of the CD cover move the move the mouse to the right upper corner of the CD cover and press click the lmb again press the right mouse button The image should be rotated according to the angle of x1, y1 and x2, y2. You may add a crop function to get only a desired area of the image. šŸ˜‰
    7 points
  10. Hello everyone, today I would like to show you how far I have come with the implementation of DarkMode for AutoIT GUIs. Source: https://github.com/ysc3839/win32-darkmode About Win32 Darkmode: Since about 2020 there is a "hidden" / "undocumented" API for Win32 DarkMode. There is also already a program that has implemented this quite well. (Notepad++) Difficulties Unfortunately, the Windows devs are either too lazy or have been stupid with the implementation. So we have to apply all kinds of fixes (as we are already used to) to get the GUIs to actually run completely. Also there are some difficulties as all existing code that could be used is written in c++. I understand that, but only rudimentarily. So if there is someone here who can / would like to help me translate / implement some existing solutions. There are for example: The 'FixDarkScrollBar()' function which I would like to implement, but where I just can't get any further. Also with ChatGPT the code is difficult to 'override' and it doesn't work at all. GPT tells me that the implementation in AutoIT is quite impossible. And the full IatHook.h (https://github.com/ysc3839/win32-darkmode/blob/master/win32-darkmode/IatHook.h) Edit: Sloved witth v0.0.3 Todos / Challenges: * Redrawing of the Menu to Black * Getting the other controls into the right Theme for DarkMode * Setting Text Theme Colder of e.g. Checkboxes, ListViewHeader or Group Text * Getting Darkmode for Date Let me know what you think and where you might have suggestions for improvement or ideas. (Especially if you can help translate c++ into autoit :3) Kind Regards NoNameCode GUIDarkMode_V0.03 - OpenNcThemeData Hook.zip Changelog V.03 * Added HookOpenNcThemeData.dll => Coded by NoNameCode in C++ if someone want the Source pls DM * Added HookOpenNcThemeData_Debug.dll => Same as HookOpenNcThemeData.dll but Creates a OpenNcThemeData.txt with the opened Classes and if the Class got Replaced by Hook * Changed Darkmode_GUISample.au3 > More Data for GUICtrlCreateList and GUICtrlCreateEdit + #include <String.au3> > Added Routine to get AutoIt Install Path by Reg; or if not by @AutoItExe for PIC (logo4.gif) or AVI (SampleAVI.avi) * Changed GUIDarkMode.au3 > Added DllOpen for HookOpenNcThemeData.dll and Added OnAutoItExitRegister for DllClose function > Changed _GUICtrlSetDarkTheme -> Cleand Up Switch by CTRL Class bec. moste of them are not needed anymore through ScrollbarFix via HookOpenNcThemeData.dll Old Stuff:
    7 points
  11. Introduction In AutoIt, we often have to deal with data structured like tables. Depending on the source, we sometimes have to write a lot of code to convert the data into a form that we can continue working with. Subsequently, working with this data is not necessarily any easier, as instead of accessing the descriptive names of the data attributes, we have to deal with numerical indices where it is very easy to lose track. Both problems are addressed by the UDF. In the basic approach, the UDF works with a table object (just an AutoIt map) in which the data is separated from the header. This enables cleaner processing of the data. It offers functions to read in data from various sources (CSV, array, string with fixed-width-columns, strings with their own column separators). Within this call, the data is separated from the header or header data is added to it in the first place. The data is then processed according to its format (with csv quotes and escapes removed, with fixed-width spaces removed...). In addition, the user can define how exactly the data should be processed for each column individually. He is completely free to do this. In this way, the data is already given the final format in which it is to be further processed when it is read in. The data can then be handled on a column-based or attribute-based basis. In other words, instead of using indices, the attribute names of the data can simply be used - this makes the code clearer. Example (much more examples provided >>here<<) We want to evaluate the open ports on a computer with AutoIt. The command line command for this is netstat -t and gives us the following output (Depending on the system, the output may look slightly different for you): Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 116 192.168.64.110:ssh 192.168.29.200:65069 ESTABLISHED tcp 0 0 192.168.64.110:ssh 192.168.29.200:65068 ESTABLISHED To continue processing the data in a meaningful way, we may need to carry out the following steps in AutoIt: Delete the first useless lines Extract the header row (it is treated differently from the data) Create an array with the correct dimension to hold the data Separate the data either by spaces or by fixed column widths Removal of unnecessary spaces from the data Converting the Recv-Q and Send-Q column to a numeric data type (for sorting etc.) Separation of address data into IP address and port This can mean a lot of (error-prone) code effort. With this UDF, however, you can solve the whole thing in a single call as follows: $sString = 'Active Internet connections (w/o servers)' & @CRLF & _ '' & @CRLF & _ 'Proto Recv-Q Send-Q Local Address Foreign Address State' & @CRLF & _ 'tcp 0 116 192.168.64.110:ssh 192.168.29.200:65069 ESTABLISHED' & @CRLF & _ 'tcp 0 0 192.168.64.110:ssh 192.168.29.200:65068 ESTABLISHED' ; Transfer data to table type by using the size of every column: Global $mData = _td_fromFixWidth($sString, _ "left 6; Number 7; Number 7; StringSplit($x, ':', 2) 24;StringSplit($x, ':', 2) 24;", _ ; column definitions "1-2", _ ; skip row 1 to 2 True) ; display data _td_display($mData) and we get the result: If you now use functions such as _td_toObjects(), you can process the individual data with expressions such as $aData.Proto or $aData.State. This should be much clearer than having to deal with array indices. Functions >>sourcecode and download on github<<
    7 points
  12. Hello guys. I just did another OCR wrapper for this nice library. What's AU3-RapidOCR? RapidOCR UDF is a simple wrapper for RapidOCR library. Features. Get Text From Image File. Easy to use. Usage: #include "RapidOCR.au3" _Example() Func _Example() MsgBox(0, "", _RapidOCR_ImageToText(@ScriptDir & "\images\Image1.png")) EndFunc Check RapidOCR UDF on GitHub. Saludos
    6 points
  13. As discussed here: I created a DLL (x86 and x64) to do a file compare like the FC.exe does (only binary comparison!) but filling up the memory which can be read out by Autoit. UDF _WinAPI_FileCompare.au3: ;Version v0.70 build 2024-03-23 beta #include-once ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WinAPI_FileCompareBinaryString ; Description ...: Reads two files into the memory and compares them byte by byte. Result is saved in the memory. ; Syntax ........: _WinAPI_FileCompareBinaryString($sFile1, $sFile2, Byref $tMemArray) ; Parameters ....: $sFile1 - first file to read. ; $sFile2 - second file to read. ; $tMemArray - a ptr dll struct which holds a ptr entry which is filled by the DLL. ; Return values .: Number of unequal bytes found in both files otherwise negative value on error. ; Author ........: UEZ ; Modified ......: ; Remarks .......: The memory pointer $tMemArray must be released using _MemGlobalFree() which holds the pointer to the result. ; The result contains hex string values (offset, file1, file2) from the differences between the two files. ; Large memory consumption for files > 80 MB as everything is kept in memory! ; Related .......: ; Link ..........: https://www.autoitscript.com/forum/index.php?showtopic=211619 ; Example .......: No ; =============================================================================================================================== Func _WinAPI_FileCompareBinaryString($sFile1, $sFile2, ByRef $tMemArray) If Not FileExists($sFile1) Then Return SetError(-10, 0, 0) If Not FileExists($sFile2) Then Return SetError(-20, 0, 0) If Not FileGetSize($sFile1) Then Return SetError(-30, 0, 0) If Not FileGetSize($sFile2) Then Return SetError(-40, 0, 0) If Not IsDllStruct($tMemArray) Then Return SetError(-50, 0, 0) Local $aReturn = DllCall(@AutoItX64 ? "_WinAPI_FileCompare_x64.dll" : "_WinAPI_FileCompare.dll", "int64", "_WinAPI_FileCompareBinaryString", "str", $sFile1, "str", $sFile2, "struct*", $tMemArray) If @error Then Return SetError(-60, 0, 0) If $aReturn[0] < 0 Then SetError($aReturn[0], 0, 0) Return $aReturn[0] EndFunc ;==>_WinAPI_FileCompareBinaryString ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WinAPI_FileCompareBinary ; Description ...: Reads two files into the memory and compares them byte by byte. Result is saved in the memory. ; Syntax ........: _WinAPI_FileCompareBinary($sFile1, $sFile2, Byref $tMemArray) ; Parameters ....: $sFile1 - first file to read. ; $sFile2 - second file to read. ; $tMemArray - a ptr dll struct which holds a ptr entry which is filled by the DLL. ; Return values .: Number of unequal bytes found in both files otherwise negative value on error. ; Author ........: UEZ ; Modified ......: ; Remarks .......: The memory pointer $tMemArray must be released using _MemGlobalFree() which holds the pointer to the result. ; The result contains integer values (offset, file1, file2) from the differences between the two files. ; Large memory consumption as everything is kept in memory but 1/3 less than _WinAPI_FileCompareBinaryString. ; Related .......: ; Link ..........: https://www.autoitscript.com/forum/index.php?showtopic=211619 ; Example .......: No ; =============================================================================================================================== Func _WinAPI_FileCompareBinary($sFile1, $sFile2, ByRef $tMemArray) If Not FileExists($sFile1) Then Return SetError(-10, 0, 0) If Not FileExists($sFile2) Then Return SetError(-20, 0, 0) If Not FileGetSize($sFile1) Then Return SetError(-30, 0, 0) If Not FileGetSize($sFile2) Then Return SetError(-40, 0, 0) If Not IsDllStruct($tMemArray) Then Return SetError(-50, 0, 0) Local $aReturn = DllCall(@AutoItX64 ? "_WinAPI_FileCompare_x64.dll" : "_WinAPI_FileCompare.dll", "int64", "_WinAPI_FileCompareBinary", "str", $sFile1, "str", $sFile2, "struct*", $tMemArray) If @error Then Return SetError(-60, 0, 0) If $aReturn[0] < 0 Then SetError($aReturn[0], 0, 0) Return $aReturn[0] EndFunc ;==>_WinAPI_FileCompareBinary ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WinAPI_FileComparePrint ; Description ...: Reads two files into the memory and compares them byte by byte. Result will be printed to the console only. ; Syntax ........: _WinAPI_FileComparePrint($sFile1, $sFile2[, $bUnbuffered = False]) ; Parameters ....: $sFile1 - first file to read. ; $sFile2 - second file to read. ; $bUnbuffered - [optional] a boolean value. Default is False. If $bUnbuffered then file will be read ; byte by byte and result will be displayed, otherwise both files will be read into the ; memory and then compared. ; Return values .: 1 if successfull, otherwise 0. ; Author ........: UEZ ; Modified ......: ; Remarks .......: Use #AutoIt3Wrapper_Change2CUI=y when compiling to display result in console. ; Related .......: ; Link ..........: https://www.autoitscript.com/forum/index.php?showtopic=211619 ; Example .......: No ; =============================================================================================================================== Func _WinAPI_FileComparePrint($sFile1, $sFile2, $bUnbuffered = False) If Not FileExists($sFile1) Then Return SetError(-10, 0, 0) If Not FileExists($sFile2) Then Return SetError(-20, 0, 0) If Not FileGetSize($sFile1) Then Return SetError(-30, 0, 0) If Not FileGetSize($sFile2) Then Return SetError(-40, 0, 0) DllCall(@AutoItX64 ? "_WinAPI_FileCompare_x64.dll" : "_WinAPI_FileCompare.dll", "none", "_WinAPI_FileComparePrint", "str", $sFile1, "str", $sFile2, "bool", $bUnbuffered) If @error Then Return SetError(-60, 0, 0) Return 1 EndFunc ;==>_WinAPI_FileComparePrint Func _WinAPI_FileCompareAbout() DllCall(@AutoItX64 ? "_WinAPI_FileCompare_x64.dll" : "_WinAPI_FileCompare.dll", "none", "About") EndFunc ;==>_WinAPI_FileCompareAbout Example1: ;Coded by UEZ build 2024-03-22 beta #AutoIt3Wrapper_UseX64=y #include <WinAPIFiles.au3> #include <Memory.au3> #include "_WinAPI_FileCompare.au3" Global $tMemArray = DllStructCreate("ptr addr") Global $fTimer = TimerInit() Global $iReturn = _WinAPI_FileCompareBinaryString("img1.bmp", "img2.bmp", $tMemArray) ConsoleWrite("Dll runtime: " & TimerDiff($fTimer) & " ms" & @CRLF) If $iReturn Then If _WinAPI_IsBadReadPtr($tMemArray.addr, $iReturn) <> 1 Then ConsoleWrite(@CRLF) ConsoleWrite("Displaying result..." & @CRLF) ConsoleWrite("Offset" & @TAB & @TAB & "File1" & @TAB & "File2" & @CRLF) Global $i, $j, $t, $c = 0 For $i = 0 To $iReturn For $j = 0 To 2 $t = DllStructCreate("char string[15]", Ptr($tMemArray.addr + $i * 15 + ($j = 0 ? $j : 6 + $j * 3))) ConsoleWrite($t.string & ($j = 0 ? ":" : "") & @TAB) Next $c += 1 ConsoleWrite(@CRLF) Next ConsoleWrite(@CRLF) ConsoleWrite("Found " & $c & " differences!" & @CRLF) ConsoleWrite(@CRLF) If $tMemArray.addr Then _MemGlobalFree($tMemArray.addr) Else ConsoleWrite("Access violation to memory address" & @CRLF) EndIf Else ConsoleWrite("Files are equal!" & @CRLF) EndIf Example2: ;Coded by UEZ build 2024-03-22 beta #AutoIt3Wrapper_UseX64=y #include <WinAPIFiles.au3> #include <Memory.au3> #include "_WinAPI_FileCompare.au3" Global $tMemArray = DllStructCreate("ptr addr") Global $fTimer = TimerInit() Global $iReturn = _WinAPI_FileCompareBinary("img1.bmp", "img2.bmp", $tMemArray) ConsoleWrite("Dll runtime: " & TimerDiff($fTimer) & " ms" & @CRLF) If $iReturn Then If _WinAPI_IsBadReadPtr($tMemArray.addr, $iReturn) <> 1 Then ConsoleWrite(@CRLF) ConsoleWrite("Displaying result..." & @CRLF) ConsoleWrite("Offset" & @TAB & @TAB & "File1" & @TAB & "File2" & @CRLF) Global $i, $j, $t, $c = 0 For $i = 0 To $iReturn For $j = 0 To 2 Switch $j Case 0 $t = DllStructCreate("ulong offset", Ptr($tMemArray.addr + $i * 8)) ConsoleWrite(Hex($t.offset, 8) & ":" & @TAB) Case 1 $t = DllStructCreate("ubyte hex1", Ptr($tMemArray.addr + $i * 8 + 4)) ConsoleWrite(Hex($t.hex1, 2) & @TAB) Case 2 $t = DllStructCreate("ubyte hex2", Ptr($tMemArray.addr + $i * 8 + 5)) ConsoleWrite(Hex($t.hex2, 2) & @TAB) EndSwitch Next $c += 1 ConsoleWrite(@CRLF) Next ConsoleWrite(@CRLF) ConsoleWrite("Found " & $c & " differences!" & @CRLF) ConsoleWrite(@CRLF) If $tMemArray.addr Then _MemGlobalFree($tMemArray.addr) Else ConsoleWrite("Access violation to memory address" & @CRLF) EndIf Else ConsoleWrite("Files are equal!" & @CRLF) EndIf Example3: ;Coded by UEZ build 2024-03-22 beta #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Change2CUI=y #include "_WinAPI_FileCompare.au3" _WinAPI_FileComparePrint("img1.bmp", "img2.bmp") I used the two images from here: Examples output should look like this here (always hex values): Dll runtime: 5.6315 ms Displaying result... Offset File1 File2 0009AB99: F0 C7 0009AB9A: EF CB 0009AB9B: 81 34 0009C795: 23 00 0009C796: 7C 80 0009C797: F5 FF Found 6 differences! You can read out the result and put it to an array... With this version you should be able to use multi-threading / multi-calls of the DLL as the memory is now allocated with each call. For x86 it may fail when the memory cannot be allocated (2GB limit) and the dll will return 0. I may add another feature to the DLL to get around the x86 limitation at the expense of speed by using chunked memory allocation if it makes sense... All files can be found also in the 7-Zip archive. _WinAPI_FileCompare DLL v0.70 build 2024-03-22.7z
    6 points
  14. argumentum

    MsgBox_Extn() UDF

    It started in the help area, to delay the OK button for X seconds but is a good example for a mix of _WinAPI_SetTimer(), _WinAPI_SetWindowsHookEx(), IsFunc(), FuncName() and a callback. ; same as MsgBox() + button to delay[ /options ] [+ X,Y,W,H ] _MsgBox_Extn(5, BitOR($MB_TOPMOST, $MB_ICONINFORMATION, $MB_OK), "My title", "My Message", 20) ;~ _MsgBox_Extn("0, 20, 100", BitOR($MB_TOPMOST, $MB_ICONINFORMATION, $MB_OKCANCEL), "My title", "My Message", 20) ;~ _MsgBox_Extn("5/1, 20, 100", BitOR($MB_TOPMOST, $MB_ICONINFORMATION, $MB_YESNO), "My title", "My Message", 20) ;~ _MsgBox_Extn("5 sec. / -4th button, 20, 100, 600, 300", BitOR($MB_TOPMOST, $MB_ICONINFORMATION, $MB_CANCELTRYCONTINUE, $MB_HELP), "My title", "My Message", 20) The use is simple ( to me that I wrote it ). Try the examples above and it'll be self evident. Is a MsgBox with an extra ( 1st ) parameter. All expected returns are the same. But in @error there is also the return value and in @extended the line number were something is wrong. I may start coding this way for myself too. Is like a UDF with training wheels. A fun example of the callback is: #include <MsgBox_Extn.au3> ; https://www.autoitscript.com/forum/index.php?showtopic=211523 ConsoleWrite(@CRLF & "+++ _MsgBox_Extn() returned: $" & _MsgBox_Extn_ReturnMeaning(Example_CallBack(4)) & ' (' & @extended & ')' & @CRLF & @CRLF) ConsoleWrite('==========------------==========------------==========------------==========------------==========------------==========') ConsoleWrite(@CRLF & "+++ _MsgBox_Extn() returned: $" & _MsgBox_Extn_ReturnMeaning(Example_CallBack(1)) & ' (' & @extended & ')' & @CRLF & @CRLF) Func Example_CallBack($iTryButton) If _MsgBox_Extn_Version() < 5 Then Return SetError(1, 0, -2) Local $MsgText = 'Now this example will punish you' & @CR & 'by wasting 60 seconds of your life.' _MsgBox_Extn_SetCallBackFunc(_MyCallBack_TimerProc) If @error Then Return SetError(2, 0, -2) ConsoleWrite('+++ Using "' & FuncName(_MsgBox_Extn_SetCallBackFunc()) & '" as callback function.' & @CRLF) Local $iMisuseAtLineNumber, $iRet = _MsgBox_Extn("60/-" & $iTryButton, BitOR($MB_OKCANCEL, $MB_HELP), 'Example', $MsgText, 15) ; "-4" is wrong. Part of the demo. $iReturn = @error $iMisuseAtLineNumber = @extended ; so misuse/error, can be gathered for debug. If $iMisuseAtLineNumber Then ConsoleWrite('! At line ' & $iMisuseAtLineNumber & ' in the UDF, there was a complain. ( Naggy UDF ! )' & @CRLF) ConsoleWrite('@error (' & $iReturn & ') holds the same value as Return (' & $iRet & '). Why ?, meh, it may come in handy.' & _ ' There is no error return in MsgBox. Let''s give it some use.' & @CRLF) _MsgBox_Extn_SetCallBackFunc(Default) ; if you're not gonna use it anymore. Return $iRet EndFunc ;==>Example_CallBack Func _MyCallBack_TimerProc() Switch _MsgBox_Extn_SecCount() Case 60 ConsoleWrite('UDF version: ' & _MsgBox_Extn_Version() & @CRLF) Case 58 ; With the MsgBox HWnd, you can have your fun. ControlEnable(_MsgBox_Extn_GetHWnd(), "", "Button2") Case 57 _MsgBox_Extn_SetMessageText('Nah, just kidding =)') _MsgBox_Extn_SecCount(3) _MsgBox_Extn_SetCounterButtonText(_MsgBox_Extn_SetCounterButtonText() & " ?") Case 1 ; Setting "SetCounterButtonText" is used on a next loop. In 1 second. _MsgBox_Extn_SetCounterButtonText(_MsgBox_Extn_GetOrigBttnText()) Case 0 _MsgBox_Extn_SetButtonText(Default, Default, _MsgBox_Extn_GetOrigBttnText( _MsgBox_Extn_TotalCount()) & " ???") _MsgBox_Extn_ApplyButtonText() EndSwitch EndFunc ;==>_MyCallBack_TimerProc and the UDF code: #include-once ; #include <MsgBox_Extn.au3> ; https://www.autoitscript.com/forum/index.php?showtopic=211523 #include <WinAPISys.au3> #include <WinAPISysWin.au3> ; do check these include with your current version of AutoIt, it func() not found ( note for the future ) #include <WinAPI.au3> #include <MsgBoxConstants.au3> ; for the demo Global Const $g__MsgBox_Extn_tagCBT_CREATEWND = "ptr lpcs;HWND tagCBT_CREATEWND" ; https://www.autoitscript.com/forum/topic/191204-hookdlgbox-udf/ Global Const $g__MsgBox_Extn_tagCREATESTRUCT = "ptr lpCreateParams;handle hInstance;HWND hMenu;HWND hwndParent;int cy;int cx;int y;int x;LONG style;ptr lpszName;ptr lpszClass;DWORD dwExStyle" Global Const $g__MsgBox_Extn_aReturnMeaning[13] = [11, "IDOK", "IDCANCEL", "IDABORT", "IDRETRY", "IDIGNORE", "IDYES", "IDNO", "ID#8", "ID#9", "IDTRYAGAIN", "IDCONTINUE", "IDTIMEOUT"] Global $g__MsgBox_Extn_Globals_UDFversion = 5, _ $g__MsgBox_Extn_Globals_hHook = 0, _ $g__MsgBox_Extn_Globals_DisableAll = 0, _ $g__MsgBox_Extn_Globals_BttnAtlText[5] = [4, Default, Default, Default, Default], _ $g__MsgBox_Extn_Globals_BttnOriText[5] = [4, Default, Default, Default, Default], _ $g__MsgBox_Extn_Globals_DelayOnBttnNo = 1, _ $g__MsgBox_Extn_Globals_aWinPos = 0, _ $g__MsgBox_Extn_Globals_iSecCount = 0, _ $g__MsgBox_Extn_Globals_hWnd = 0, _ $g__MsgBox_Extn_Globals_hCallBackFunc = Default, _ $g__MsgBox_Extn_Globals_iDoitOnlyOnce = 1, _ $g__MsgBox_Extn_Globals_BttnOriCount = 0, _ $g__MsgBox_Extn_Globals_iWarning = 0, _ $g__MsgBox_Extn_Globals_sOriginalText ; same as MsgBox() + button to delay[ /options ] [+ X,Y,W,H ] ;~ _MsgBox_Extn(5, BitOR($MB_TOPMOST, $MB_ICONINFORMATION, $MB_OK), "My title", "My Message", 20) ;~ _MsgBox_Extn("0, 20, 100", BitOR($MB_TOPMOST, $MB_ICONINFORMATION, $MB_OKCANCEL), "My title", "My Message", 20) ;~ _MsgBox_Extn("5/1, 20, 100", BitOR($MB_TOPMOST, $MB_ICONINFORMATION, $MB_YESNO), "My title", "My Message", 20) ;~ _MsgBox_Extn("5 sec. / -4th button, 20, 100, 600, 300", BitOR($MB_TOPMOST, $MB_ICONINFORMATION, $MB_CANCELTRYCONTINUE, $MB_HELP), "My title", "My Message", 20) ; SecDelay The time delay until the control is re-enabled ; or a comma delimited string up to "delay [, X pos [, Y pos [, Width [, Height]]]]" ; "delay" can be formated as "delay [ /ButtonNumber]". Default is Button1. ; if ButtonNumber is a negative number, it'll disable all the buttons. ; flag The flag indicates the type of message box and the possible button combinations. See remarks in MsgBox(). ; title The title of the message box. ; text The text of the message box. ; timeout [optional] Timeout in seconds. After the timeout has elapsed the message box will close automatically. The default is 0, which is no timeout. ; hwnd [optional] The window handle to use as the parent for this dialog. ; Return Value ; Success: the ID of the button pressed. ; Failure: $IDTIMEOUT (-1) if the message box timed out. ; ; @extended = function misuse Func _MsgBox_Extn($iSecDelay, $iFlag, $sTitle, $sText, $iSecTimeout = 0, $hParent_hwnd = 0) ; https://www.autoitscript.com/forum/index.php?showtopic=211499&view=findpost&p=1530323 $g__MsgBox_Extn_Globals_aWinPos = StringSplit($iSecDelay, ",") ReDim $g__MsgBox_Extn_Globals_aWinPos[6] Local $aBttnNoDelay = StringSplit(StringReplace($g__MsgBox_Extn_Globals_aWinPos[1], "\", "/"), "/") ReDim $aBttnNoDelay[3] $g__MsgBox_Extn_Globals_DelayOnBttnNo = Int($aBttnNoDelay[2]) If Not $g__MsgBox_Extn_Globals_DelayOnBttnNo Then $g__MsgBox_Extn_Globals_DelayOnBttnNo = 1 If $g__MsgBox_Extn_Globals_DelayOnBttnNo < 0 Then $g__MsgBox_Extn_Globals_DisableAll = 1 $g__MsgBox_Extn_Globals_DelayOnBttnNo = Abs($g__MsgBox_Extn_Globals_DelayOnBttnNo) EndIf If $g__MsgBox_Extn_Globals_DelayOnBttnNo > 4 Then _MsgBox_Extn_ConsoleWrite('Note: Button' & $g__MsgBox_Extn_Globals_DelayOnBttnNo & ' will not exist. Setting to Button1 to, be nice ?. Check the code.' & @CRLF) $g__MsgBox_Extn_Globals_DelayOnBttnNo = 1 ; function misuse ; no more than a 4th button. EndIf If $g__MsgBox_Extn_Globals_aWinPos[0] > 5 Then _MsgBox_Extn_ConsoleWrite('Note: ' & $g__MsgBox_Extn_Globals_aWinPos[0] & ' parameters are too many. Check the code.' & @CRLF) $g__MsgBox_Extn_Globals_aWinPos[0] = 5 ; better safe than sorry. ; function misuse ; $iSecDelay = "delay [, X pos [, Y pos [, Width [, Height]]]]" only. EndIf For $n = 1 To $g__MsgBox_Extn_Globals_aWinPos[0] $g__MsgBox_Extn_Globals_aWinPos[1] = Int($g__MsgBox_Extn_Globals_aWinPos[1]) Next For $n = $g__MsgBox_Extn_Globals_aWinPos[0] + 1 To 5 $g__MsgBox_Extn_Globals_aWinPos[$n] = Null ; these are unused place holders. Next Local $hTimerProc = DllCallbackRegister(__MsgBox_Extn_TimerProc, 'none', 'hwnd;uint;uint_ptr;dword') Local $iTimerID = _WinAPI_SetTimer(0, 0, 1000, DllCallbackGetPtr($hTimerProc)) ; $iTimerID should be 0 if the $hWnd is 0. Local $hProc = DllCallbackRegister(__MsgBox_Extn_CbtHookProc, "int", "int;int;int") $g__MsgBox_Extn_Globals_hHook = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($hProc), 0, _WinAPI_GetCurrentThreadId()) Local $iRet = MsgBox($iFlag, $sTitle, $sText, $iSecTimeout, $hParent_hwnd) _WinAPI_KillTimer(0, $iTimerID) DllCallbackFree($hTimerProc) _WinAPI_UnhookWindowsHookEx($g__MsgBox_Extn_Globals_hHook) DllCallbackFree($hProc) Local $iExt = $g__MsgBox_Extn_Globals_iWarning $g__MsgBox_Extn_Globals_iWarning = 0 $g__MsgBox_Extn_Globals_hHook = 0 $g__MsgBox_Extn_Globals_iSecCount = 0 $g__MsgBox_Extn_Globals_aWinPos = 0 $g__MsgBox_Extn_Globals_hWnd = 0 $g__MsgBox_Extn_Globals_iDoitOnlyOnce = 1 $g__MsgBox_Extn_Globals_DelayOnBttnNo = 1 $g__MsgBox_Extn_Globals_DisableAll = 0 Dim $g__MsgBox_Extn_Globals_BttnOriText[5] = [4, Default, Default, Default, Default] _MsgBox_Extn_SetButtonText() ; re-init all prior alternate button text to defaults. $g__MsgBox_Extn_Globals_BttnOriCount = 0 Return SetError($iRet, $iExt, $iRet) EndFunc ;==>_MsgBox_Extn ; Return the meaning/name of the enumerator/constant Func _MsgBox_Extn_ReturnMeaning($iIndex) $iIndex = Int($iIndex) If $iIndex = -1 Then Return SetExtended($iIndex, $g__MsgBox_Extn_aReturnMeaning[12]) Switch $iIndex Case 8, 9 Return SetError(1, $iIndex, "unkown index " & $iIndex) Case 1 To 12 Return SetExtended($iIndex, $g__MsgBox_Extn_aReturnMeaning[$iIndex]) EndSwitch Return SetError(2, $iIndex, "unkown index " & $iIndex) EndFunc ;==>_MsgBox_Extn_ReturnMeaning ; Returns the UDF version. Just in case more stuff is added. Func _MsgBox_Extn_Version() Return $g__MsgBox_Extn_Globals_UDFversion EndFunc ;==>_MsgBox_Extn_Version ; Get the original text of any of the 4 possible buttons. ; For if _MsgBox_Extn_SetCallBackFunc() is used. Func _MsgBox_Extn_GetOrigBttnText($iIndex = $g__MsgBox_Extn_Globals_DelayOnBttnNo) If $iIndex > 4 Or $iIndex < 1 Then $g__MsgBox_Extn_Globals_iWarning = @ScriptLineNumber _MsgBox_Extn_ConsoleWrite('Note: an $iIndex of ' & $iIndex & ' should have been between 1 and 4. Therefore is an error.' & @CRLF) $iIndex = $g__MsgBox_Extn_Globals_DelayOnBttnNo EndIf Return SetExtended(IsKeyword($g__MsgBox_Extn_Globals_BttnOriText[$iIndex]), $g__MsgBox_Extn_Globals_BttnOriText[$iIndex]) EndFunc ;==>_MsgBox_Extn_GetOrigBttnText ; Reset the original text of the 4 possible buttons. Or just the one you pass along as Index. ; For if _MsgBox_Extn_SetCallBackFunc() is used. Func _MsgBox_Extn_ResetButtonText($iIndex = Default) If IsKeyword($iIndex) = 1 Then For $n = 1 To $g__MsgBox_Extn_Globals_BttnOriText[0] $g__MsgBox_Extn_Globals_BttnAtlText[$n] = $g__MsgBox_Extn_Globals_BttnOriText[$n] Next Else If $iIndex > 4 Or $iIndex < 1 Then $g__MsgBox_Extn_Globals_iWarning = @ScriptLineNumber _MsgBox_Extn_ConsoleWrite('Note: an $iIndex of ' & $iIndex & ' should have been between 1 and 4. Therefore is an error.' & @CRLF) $iIndex = $g__MsgBox_Extn_Globals_DelayOnBttnNo EndIf $g__MsgBox_Extn_Globals_BttnAtlText[$n] = $g__MsgBox_Extn_Globals_BttnOriText[$n] EndIf EndFunc ;==>_MsgBox_Extn_ResetButtonText ; Set any of the 4 possible buttons, from left to right, with an alternate text. Func _MsgBox_Extn_SetButtonText($iButton1 = Default, $iButton2 = Default, $iButton3 = Default, $iButton4 = Default) $g__MsgBox_Extn_Globals_BttnAtlText[1] = $iButton1 $g__MsgBox_Extn_Globals_BttnAtlText[2] = $iButton2 $g__MsgBox_Extn_Globals_BttnAtlText[3] = $iButton3 $g__MsgBox_Extn_Globals_BttnAtlText[4] = $iButton4 EndFunc ;==>_MsgBox_Extn_SetButtonText ; After _MsgBox_Extn_SetButtonText(), you'll need to _MsgBox_Extn_ApplyButtonText() ; For use in _MsgBox_Extn_SetCallBackFunc() Func _MsgBox_Extn_ApplyButtonText() For $n = 1 To $g__MsgBox_Extn_Globals_BttnAtlText[0] If Not IsKeyword($g__MsgBox_Extn_Globals_BttnAtlText[$n]) Then ControlSetText($g__MsgBox_Extn_Globals_hWnd, "", "Button" & $n, String($g__MsgBox_Extn_Globals_BttnAtlText[$n]), 1) EndIf Next EndFunc ;==>_MsgBox_Extn_ApplyButtonText ; Set a new message text on the fly ; For use in _MsgBox_Extn_SetCallBackFunc() Func _MsgBox_Extn_SetMessageText($sStr) Local $iRet, $iStatic = 2 If ControlGetText($g__MsgBox_Extn_Globals_hWnd, "", "Static2") = "" Or @error Then $iStatic = 1 $iRet = ControlSetText($g__MsgBox_Extn_Globals_hWnd, "", "Static" & $iStatic, String($sStr)) Return SetError(Int(Not $iRet), $iStatic, $iRet) EndFunc ;==>_MsgBox_Extn_SetMessageText ; Set a new default text on the fly ; For use in _MsgBox_Extn_SetCallBackFunc() Func _MsgBox_Extn_SetCounterButtonText($sNewText = Default) If Not IsKeyword($sNewText) Then $g__MsgBox_Extn_Globals_sOriginalText = String($sNewText) Return $g__MsgBox_Extn_Globals_sOriginalText EndFunc ;==>_MsgBox_Extn_SetCounterButtonText ; Set a new count down on the fly via _MsgBox_Extn_SetCallBackFunc() Func _MsgBox_Extn_SecCount($iNewValue = Default) If Not IsKeyword($iNewValue) Then $g__MsgBox_Extn_Globals_aWinPos[1] = Int($iNewValue) $g__MsgBox_Extn_Globals_iSecCount = -1 EndIf Return $g__MsgBox_Extn_Globals_aWinPos[1] - $g__MsgBox_Extn_Globals_iSecCount EndFunc ;==>_MsgBox_Extn_SecCount Func _MsgBox_Extn_TotalCount() Return $g__MsgBox_Extn_Globals_BttnOriCount EndFunc ;==>_MsgBox_Extn_TotalCount ; The handle of the MsgBox(), to use in _MsgBox_Extn_SetCallBackFunc() Func _MsgBox_Extn_GetHWnd() Return $g__MsgBox_Extn_Globals_hWnd EndFunc ;==>_MsgBox_Extn_GetHWnd Func _MsgBox_Extn_ConsoleWrite($sStr, $iLineNumber = @ScriptLineNumber) Local Static $iReturn = Not (StringRight(@ScriptName, 4) = '.au3') $g__MsgBox_Extn_Globals_iWarning = $iLineNumber If $iReturn Then Return "" ConsoleWrite('"MsgBox_Extn.au3" (' & $iLineNumber & ',0) : ' & $sStr) EndFunc ;==>_MsgBox_Extn_ConsoleWrite ; To do stuff within the time the delay is active. ; example at https://www.autoitscript.com/forum/index.php?showtopic=211499&view=findpost&p=1530455 Func _MsgBox_Extn_SetCallBackFunc($hCallBackFunc = Null) ; a no parameter func(). Use helper func ( _MsgBox_Extn_* ) Local $iErr = 0 If IsKeyword($hCallBackFunc) = 1 Then ; $KEYWORD_DEFAULT (1) the Default keyword. ; $KEYWORD_NULL (2) the Null keyword. $g__MsgBox_Extn_Globals_hCallBackFunc = "" ; ..to remove the value ElseIf IsFunc($hCallBackFunc) Then $g__MsgBox_Extn_Globals_hCallBackFunc = $hCallBackFunc ElseIf IsKeyword($hCallBackFunc) = 2 Then ; This is to return the $hCallBackFunc in use. Else ; if we get to this point, is not a keyword nor a function. Therefore is an error. _MsgBox_Extn_ConsoleWrite('Note: If we get to this point, is not a keyword nor a function. Therefore is an error.' & @CRLF) $g__MsgBox_Extn_Globals_hCallBackFunc = "" ; since is an error, let's remove whatever was there. $iErr = 1 EndIf Return SetError($iErr, 0, $g__MsgBox_Extn_Globals_hCallBackFunc) EndFunc ;==>_MsgBox_Extn_SetCallBackFunc #Region INTERNAL Func __MsgBox_Extn_TimerProc($hWnd, $iMsg, $iTimerID, $iTime) ;~ ConsoleWrite('+ Func __MsgBox_Extn_TimerProc(' & $hWnd & ', ' & $iMsg & ', ' & $iTimerID & ', ' & $iTime & ')' & @CRLF) #forceref $hWnd, $iMsg, $iTimerID, $iTime $g__MsgBox_Extn_Globals_iSecCount += 1 If $g__MsgBox_Extn_Globals_iSecCount < $g__MsgBox_Extn_Globals_aWinPos[1] Then ControlSetText($g__MsgBox_Extn_Globals_hWnd, "", "Button" & $g__MsgBox_Extn_Globals_DelayOnBttnNo, _MsgBox_Extn_SetCounterButtonText() & ' (' & $g__MsgBox_Extn_Globals_aWinPos[1] - $g__MsgBox_Extn_Globals_iSecCount & ')') ElseIf $g__MsgBox_Extn_Globals_iSecCount = $g__MsgBox_Extn_Globals_aWinPos[1] Then ControlSetText($g__MsgBox_Extn_Globals_hWnd, "", "Button" & $g__MsgBox_Extn_Globals_DelayOnBttnNo, _MsgBox_Extn_SetCounterButtonText()) If $g__MsgBox_Extn_Globals_DisableAll Then For $n = 1 To 4 ControlEnable($g__MsgBox_Extn_Globals_hWnd, "", "Button" & $n) Next Else ControlEnable($g__MsgBox_Extn_Globals_hWnd, "", "Button" & $g__MsgBox_Extn_Globals_DelayOnBttnNo) EndIf EndIf If IsFunc($g__MsgBox_Extn_Globals_hCallBackFunc) Then $g__MsgBox_Extn_Globals_hCallBackFunc() ; $hWnd, $iMsg, $iTimerID, $iTime) ; there's no use for these. EndFunc ;==>__MsgBox_Extn_TimerProc Func __MsgBox_Extn_CbtHookProc($nCode, $wParam, $lParam) ;~ ConsoleWrite('+ Func __MsgBox_Extn_CbtHookProc(' & $nCode & ', ' & $wParam & ', ' & $lParam & ')' & @CRLF) If $nCode = 3 And $g__MsgBox_Extn_Globals_iDoitOnlyOnce = 1 And _WinAPI_GetClassName(HWnd($wParam)) = "#32770" Then $g__MsgBox_Extn_Globals_iDoitOnlyOnce = 2 $g__MsgBox_Extn_Globals_hWnd = HWnd($wParam) If $g__MsgBox_Extn_Globals_aWinPos[2] <> Null Then Local $tcs = DllStructCreate($g__MsgBox_Extn_tagCREATESTRUCT, DllStructGetData(DllStructCreate($g__MsgBox_Extn_tagCBT_CREATEWND, $lParam), "lpcs")) If $g__MsgBox_Extn_Globals_aWinPos[2] <> Null Then DllStructSetData($tcs, "x", $g__MsgBox_Extn_Globals_aWinPos[2]) If $g__MsgBox_Extn_Globals_aWinPos[3] <> Null Then DllStructSetData($tcs, "y", $g__MsgBox_Extn_Globals_aWinPos[3]) If $g__MsgBox_Extn_Globals_aWinPos[4] <> Null Then DllStructSetData($tcs, "cx", $g__MsgBox_Extn_Globals_aWinPos[4]) ; these Cx,Cy don't do anything functional If $g__MsgBox_Extn_Globals_aWinPos[5] <> Null Then DllStructSetData($tcs, "cy", $g__MsgBox_Extn_Globals_aWinPos[5]) ; but, you can use them if you wish. EndIf EndIf If $nCode = 5 And $g__MsgBox_Extn_Globals_iDoitOnlyOnce = 2 And $g__MsgBox_Extn_Globals_aWinPos[1] > 0 And HWnd($wParam) = $g__MsgBox_Extn_Globals_hWnd Then ; 5=HCBT_ACTIVATE $g__MsgBox_Extn_Globals_iDoitOnlyOnce = 0 _MsgBox_Extn_ApplyButtonText() If $g__MsgBox_Extn_Globals_DisableAll Then For $n = 1 To 4 ControlDisable($g__MsgBox_Extn_Globals_hWnd, "", "Button" & $n) Next Else ControlDisable($g__MsgBox_Extn_Globals_hWnd, "", "Button" & $g__MsgBox_Extn_Globals_DelayOnBttnNo) EndIf For $n = 1 To 4 $g__MsgBox_Extn_Globals_BttnOriText[$n] = ControlGetText($g__MsgBox_Extn_Globals_hWnd, "", "Button" & $n) If $g__MsgBox_Extn_Globals_BttnOriText[$n] = "" And @error Then If Not $g__MsgBox_Extn_Globals_BttnOriCount Then $g__MsgBox_Extn_Globals_BttnOriCount = $n - 1 $g__MsgBox_Extn_Globals_BttnOriText[$n] = Default EndIf Next If $g__MsgBox_Extn_Globals_DelayOnBttnNo > $g__MsgBox_Extn_Globals_BttnOriCount Then _MsgBox_Extn_ConsoleWrite('Note: Button' & $g__MsgBox_Extn_Globals_DelayOnBttnNo & ' does not exist on this ' & $g__MsgBox_Extn_Globals_BttnOriCount & ' button MsgBox. Setting to Button1. Check the code.' & @CRLF) $g__MsgBox_Extn_Globals_DelayOnBttnNo = 1 EndIf _MsgBox_Extn_SetCounterButtonText(_MsgBox_Extn_GetOrigBttnText($g__MsgBox_Extn_Globals_DelayOnBttnNo)) ControlSetText($g__MsgBox_Extn_Globals_hWnd, "", "Button" & $g__MsgBox_Extn_Globals_DelayOnBttnNo, _MsgBox_Extn_SetCounterButtonText() & ' (' & $g__MsgBox_Extn_Globals_aWinPos[1] & ')') If IsFunc($g__MsgBox_Extn_Globals_hCallBackFunc) Then $g__MsgBox_Extn_Globals_hCallBackFunc() ElseIf $nCode = 5 And $g__MsgBox_Extn_Globals_iDoitOnlyOnce = 2 And HWnd($wParam) = $g__MsgBox_Extn_Globals_hWnd Then _MsgBox_Extn_ApplyButtonText() EndIf Return _WinAPI_CallNextHookEx($g__MsgBox_Extn_Globals_hHook, $nCode, $wParam, $lParam) EndFunc ;==>__MsgBox_Extn_CbtHookProc #EndRegion INTERNAL And a $MB_HELP usage example ( somewhere down there ). If you don't feel like copy and paste all this then here: MsgBox_Extn[v5].zip In version 5 there more stuff. Lost count, but it has nagging code to let the user know, if the code has a complain about the parameters. So, this is a good example as far as examples but M23's Extended Message Box is a better option if you need a flexible MsgBox UDF.
    6 points
  15. ... lets do some marketing first: pardon the image size of 225% scale on another monitor The idea is to have some DPI awareness in our GUIs and with this all you have to do is prefix "_HiDpi_" to your current code. Simple. This version ( HiDpi v. 0.2023.7.29(b) stable.zip ) is stable but only system aware. ( pictures above ) This next version ( HiDpi v. 0.2023.8.3(a) under development.zip ) is what I've got so far in regards of per-monitor awareness This one ( HiDpi v. 0.2023.8.4(ResizeTestbed) under development.zip ) is for the brave of heart. I'm looking for ideas. This is a testbed for anyone wanting to contribute regarding resizing controls. I have now started to use _WinAPI_DPI.au3 because I feel that this UDF is ready for that UDF. Therefore, too many and too big files for copy and paste. And that is good. Means that the UDF is getting closer to stable. FAQ (of sorts) Q: When did you come up with this ? A: Never. These are helper functions for _WinAPI_SetDPIAwareness.au3 but I did not get to finish. Nonetheless it's functional as is and applies to most of the cases in need of DPI awareness. Per-monitor would need more involved coding and I only have so much time and know how for now. Q: Will you open a ticket and ask to be included in the standard UDFs ? A: No. This is a just for now. Eventually the functionality would be a standard feature without the need of this. Q: Will you add ... A: Only in the case that either, I realize is needed and code it or, you code it and ask to be included in this bundle of functions UDF Q: This is not working ... A: The best way to go about a problem with this code is to open it's own thread in GUI Help and Support and post there with a mention of me. I'll read and answer there. Q: Are you going to share "logo4.gif", "SampleAVI.avi", etc. A: You are right. I forgot to say that the example file will work as expected if created in "..\Examples\GUI\HiDpi_v_n.n.n.n\", as a subfolder of where "SampleControls.au3" is at. There it will find all the files required for the example. Because after all, this example is that example but "_HiDpi_fied" ( so to say ). Q: Is there a tool that will magically update all my old scripts ? A: I've posted a script to get you closer but is not magical. Should work just fine for simple GUIs. Q: Are you going to work on a Per-monitor version ? A: yes, as time permits.
    6 points
  16. Nine

    Printer Manager

    In this topic, it was mentioned by @mLipok that it could be doable to manage printers with winspool.drv DLL. It was enough to get my attention on it. I do not remember seeing any UDF gathering all those functions. Func _PRNT_GetDefaultPrinter() Func _PRNT_SetDefaultPrinter($sPrinter) Func _PRNT_OpenPrinter($sName) Func _PRNT_ClosePrinter($hPrinter) Func _PRNT_GetPrinterInfo($hPrinter, $bGlobal, $bRAW = False) Func _PRNT_SetPrinterInfo($hPrinter, $iProp, $iValue, $bGlobal) Func _PRNT_EnumPrinters() Func _PRNT_IsValidDevmode($tDevMode) Func _PRNT_EnumJobs($hPrinter) Version 2023-10-17 *added new functions _PRNT_IsValidDevmode and _PRNT_EnumJobs Version 2023-10-15 * solved a problem where garbage collector would destroy $tDevMode after a while on return of _PRNT_GetPrinterInfo There is a multitude of other functions that could be part of this UDF, but I have decided to stop here and see how you like it. If you have comments or suggestions, they are always welcome. Printer_UDF.zip
    6 points
  17. I've been using AutoIt for a couple of decades now, and created hundreds of programs, and my knowledge of C and derivatives could be written on a Napkin, and in all reality has never served me in my use of AutoIt. That said, I have of course benefited from the understanding of C etc by those who have developed and maintain AutoIt. I mostly came to AutoIt via VB 4, 5 & 6, especially VBA, where I would have created (and still do) lots of VBA macros. I'd dabbled with some C variants etc, but was quite turned off by them, they not matching how my mind works or wants to work. I'd class AutoIt as a bit like VB, but with a lot of the nonsense missing. To this day, despite how experienced I am with VBA, it still regularly gives me grief ... that rarely occurs with AutoIt ... all to do, in my view, with the mentality behind them. But then I am totally self taught, in the monkey-see monkey-do style of coding, with the ability to analyze enough. I am not well versed on theory and concepts, other than what I have picked up on-the-fly. Jon & the AutoIt Team, past & present, have liberated many folk like myself, for which I will eternally be grateful. In my view, AutoIt is the best language for the average person on the street to use, bar none. It is simple enough and plain speaking enough, with a superb Help file, to introduce many to programming, without the requirement to be nerdy etc. Many of course then move onto other languages, but often retain AutoIt in their toolbox.
    6 points
  18. Thank you for your order, valued customer! We aim to serve! Will that be paid in cash, crypto, or by card?
    6 points
  19. This Beta version contains SciTE v 5.4.0 and a major change to the AutoComplete functionality and automatically addition of required #include lines at the top. Many LUA functions are updated. 2023-12-27 13:30 Merged SciTE Release 5.4.0 with the SciTE4AutoIt3 sources Many changes to the new LUA functions 2023-03-10 13:00 Merged SciTE Release 5.3.4 with the SciTE4AutoIt3 sources Added option to jump to the definition of a Variable when Ctrl+J is used with the caret placed with a variable name. Many other small changes... see this thread for details Move the zip into the Beta directory making it for more people available. Move this thread to AutoIt Technical discussions, so others can participate in testing when they want. 2023-03-14 20:00 Merged SciTE Release 5.3.5 with the SciTE4AutoIt3 sources Also show constant includes in #include<... dropdown. Fixed issue with portable directory duplicates due to improper case checking Fixed REGEX getting all possible *.au3 files when Dir returns a Timestamp in format hh:mm AM/PM How to test/install: Backup your current SciTE directory! Download the Beta SciTE4AutoIt3.exe installer or portable zip. Run installer or do your thing with the portable zip. Check below documentation on all possible configuration option via #Directive or in the SciTEUser.properties. Jos ============ Quick feature overview... check this Documentation for all details ======================================== This is how it looks with a basic example: Here I am using @Melba23's ExMsgBox include file which is located in my Private Include directory: This shown you in more details the basics of the changes: The announced change here has grown into a project on it own, which I feel is now at a stage where I could use some help from beta testers trying out these updated. I have created the initial documentation on all updates made and how the added functionality works, which is now part of the Helpfile available: AutoComplete & Dynamic Includes Previous Top Next Overview This LUA script functionality build in the SciTE4AutoIt3 version of SciTE will dynamically add #include statements required for the used UDFs or Global Const Variables. When dynamic.includes=1 you will be able to use Ctrl+Shift+z to process the whole file and scan it for missing Global Const Variables or UDFs. When dynamic.includes.whiletyping=1 is also set, the LUA functionality will add the required #include lines while typing. This only works when dynamic.includes=1. The AutoComplete functionality has also been changed and will now also search for partial matches in the names in stead of "Starting with", so you don't need to know the exact start of the funtion to be able to search for it. Changes to existing features Syntax Coloring All found Func's as defined here, not just the standard ones, will now immediately have their correct Font & formatting as defined for properties Styles 15-17. After you specified a none-standard known UDF, you will see it has Style 17 Color&Formatting when it is an UDF that exists in an Include file specifically for this Script. Selection for #include lines You can now use either < ' " as starting character to trigger the DropdownList with available include files. This list will now include all Standard, User defined and Dynamically found Include files. You can now type any part of the include name, not just the starting letters, to find the Include file you want. For example when you type: #include<apic this will be shown and we just press 2 times the Down key: .. then when you hit the Tab key, this will be the result: Smart AutoComplete function for Variables, Functions and Abbreviations The Dropdown will show al list of possible Variables or Functions and Abbreviation when you start typing. The match is done on the whole functionname now, not just the starting characters. The Starting $ or _ characters are ignored in this search and the results are shown in the order of the starting position in the found "words" of the typed characters: Example 1: When we type Find the below is returned: As you can see they are sorted in the order of starting position of "Find" and then Alphabetically Example 2: When you type $Yes, the result will be: New: How Dynamic #Include line insertion works Example1 When you type the following in your source: _ArrayAdd .. and then when you hit the Opening bracket or space key, the required #include<array.au3> line will be added within the existing or newly created #region: The same will happen when you use one of the Global Const variables from one of the *constants*.au3 includes in the defined include directories. This #region can be moved to any place in the script you prefer and will be used from here on as long as you do not change anything in those 2 #region lines. Any Subsequent added include file will be added to the end of the list with the Date&Time of the addition so you can easily see when/what was added. Example2 This is an Example for an new script in the SciTE_Jump Directory showing the use of the #SciTE4AutoIt3_Dynamic_Include_Path=; directive: The includes for this Utility are located in the Includes subdirectory, so aren't considered unless we specify it as follows: #SciTE4AutoIt3_Dynamic_Include_Path=;Includes; ... and then we start typing the name of one of the UDFs in a include in this directory and hit Tab on the first one shown: When we then hit the Opening bracket or Space key, the required #include"includes\_SciTE.au3" line will be added within the existing or newly created #region: Example3 This is an Example for a Global Const include file addition: We have just typed the last line of this script: .. and hit the Space key, the required #include<MsgBoxConstants.au3> line will be added within the existing #Region above the #EndRegion line: These are all the Func's (UDFs) that will be recognized by the dynamic include process: All Funcs in the default autoit/includes directory with format _ABC(), undocumented Funcs will be added to AutoComplete All Funcs except __*.au3 from all extra *.au3 Files in the openfile= paths that have a #include-once in it, are added to Style 16 (UserUDFs). All Funcs from the current script file are added to style 17 (InFIleUDFs) All Gobal Const Variables defined in any of the previous defined paths that are defined in a *constants*.au3 scriptfile which also includes #include-once. All Funcs except __*.au3 from all *.au3 Files in the current script directory are added to Style 16 (UserUDFs). All Funcs except __*.au3 from all *.au3 Files in the directories defined with Directive:#SciTE4AutoIt3_Dynamic_Include_Path=;Includes\relative\path;d;\includes\absolute\path Items 1-4 are read from those directories one time during the life of SciTE, but only when the first *.au3 files is opened. (slows it down ~0.5 sec one time to build all required tables) Items 5-6 are read each time an *au3 file is Opened or Switched to its Tab. (slows it down ~0.1 - 0.2 secs per change of tab and at Save time, to build all required current file tables) Configuration options for AutoComplete & Dynamic Includes This is the section in au3.properties where the autocomplete & dynamic includes config is defined. You can copy any of these lines into your SciTEUser.properties: ## ------------------------------------------------------------------------------------------------------------------------ ## dynamic.include Directives and properties reference ## ----------------------------------------------------- #SciTE4AutoIt3_Dynamic_Include=y ;dynamic.include=y/n #SciTE4AutoIt3_Dynamic_Include_whiletyping=y ;dynamic.include.whiletyping=y/n #SciTE4AutoIt3_Dynamic_Include_recursive_check=n ;dynamic.include.recursive.check=n/y #SciTE4AutoIt3_Dynamic_Include_use_local_cache=n ;dynamic.include.use.local.cache=n/y #SciTE4AutoIt3_Dynamic_Include_version=prod ;dynamic.include.version=prod/beta #SciTE4AutoIt3_Dynamic_Include_verboselevel=0 ;dynamic.include.verbose.level=0/1/2 #SciTE4AutoIt3_Dynamic_Include_Path= #SciTE4AutoIt3_AutoItDynamicIncludes_debug=n ;debug.autoitdynamicincludes=n/y #SciTE4AutoIt3_AutoItAutocomplete_debug=n ;debug.autoitautocomplet=n/y #SciTE4AutoIt3_AutoItGotoDefinition_debug=n ;debug.autoitgotodefinition=n/y #SciTE4AutoIt3_AutoItTools_debug=n ;debug.autoIttools=n/y ## ================================================ ## dynamic.include config ## ================================================ #> dynamic.include=y/n n=disabled y=will automatically build the func tables for coloring and autocomplete (requires restart SciTE!) dynamic.include=y #> whiletyping=y/n n=disabled y=will automatically add any required standard or USERincludefile for the current line, on the fly, when ) or enter ispressed !) dynamic.include.whiletyping=y #> use.local.cache=n/y n=disable y=Use cache file for local Include UDFs and VARs which could increase the speed when you have a lot of local includefiles which normally shouldn't be the case dynamic.include.use.local.cache=n #> version prod=Use AutoIt3 Production version beta=Use AutoIt3 Beta version dynamic.include.version=prod #> recursive.check=n/y n=disable y=When you like to only add an Include when it isn't included through another #included file yet. dynamic.include.recursive.check=n # level of debug messages 0/1/2 0=disabled; 1= Warnings & Timing per Function; 2=1+Total timing dynamic.include.verbose.level=0 #> Max number of includes files to read from the user directories in the list. This doesn't including the standard AutoIt3 includes. dynamic.max.includes=150 #> Max number total UDFs in the Userlist to handle by dynamic includes. This doesn't including the standard AutoIt3 includes-UDFs. dynamic.max.funcs=3000 #> Scriptlines longer that this value won't be looked at for Checking for required #Include statements. dynamic.max.line.length=300 ## ================================================ ## Autocomplete and call tip settings ## ================================================ autocomplete.au3.disable=0 autocomplete.au3.ignorecase=1 # Define minimum length before AutoComplete dropdown is shown- default=2 autocomplete.au3.min.length=2 # Include Abbrevs in AutoComplete dropdown (default=1/y) autocomplete.au3.include_abbrevs=1 # Don't show AutoItComplete with these styles (Internal only in SciTE4AutoIt3) autocomplete.ignore.styles.$(au3)=1;2;3;6;7;10;13 # Define which character will be added after Tab or Enter was entered and not on a Function/UDF: Can be \s \t \n for space;tab;newline autocomplete.au3.on.enter=\n autocomplete.au3.on.tab= # List of all AutoComplete API files used api.$(au3)=$(SciteDefaultHome)\api\au3.api;$(SciteDefaultHome)\api\au3.autoit3wrapper.api;$(SciteUserHome)\au3.std.dynamic.calltips.api;$(SciteUserHome)\au3.file.dynamic.calltips.api;$(SciteUserHome)\au3.usr.dynamic.calltips.api;$(SciteUserHome)\au3.user.calltips.api ## ================================================ ## Separate settings for debugging these Lua files ## ================================================ #> Enable debugging for these lua scripts: debug.autoitdynamicincludes=n debug.autoitautocomplete=n debug.autoitgotodefinition=n debug.autoitindentfix=n debug.autoittools=n #> when debug.tofile is defined, log records will be send to the log in stead of OutputPane: debug.tofile=$(SciteUserHome)\SciTE_LUA_Scripts_Debug.err # ------------------------------------------------------------------------------------------------------------------------
    5 points
  20. Added the ability to load a custom CSS file where you can change the look of help pages as you would with any html file displaying in Internet Explorer. Also, all external links open in your default browser. This area is to share your CSS coloring or report a problem with the file. Examples of how it could look are: Buuf: Dark: Light ( default ) or just forego all themes and use High Contrast in the OS The general idea is that is your PC. Make it look as you wish The file is in the file downloads area.
    5 points
  21. GuiBuilderPlus GuiBuilderPlus is a small, easy to use GUI designer for AutoIt. Originally created long ago as AutoBuilder by the user CyberSlug, enhanced as GuiBuilder by TheSaint, and further enhanced and expanded as GuiBuilderNxt by jaberwacky, GuiBuilderPlus is a continuation of their great work, with a focus on increased stability and usability followed by new features. ------ Yes, I have decided to bring back our old friend the GuiBuilder. This utility has a long history, which you can read about in TheSaint's Gui Creators topic, starting all the back back with CyberSlug's AutoBuilder. Even though I've hacked the original code to pieces in order to document and better understand what is going on, the essence of GuiBuilder still lives on! I am using the awesome updates from GuiBuilderNxt by jaberwacky as a starting point since he already did a lot of the hard work of parsing and updating the original code, plus I really like the layout that came about from that update. Unfortunately development seems to have stopped in 2016. Not sure how much interest there is in this, but suggestions and bug reports are welcome. See Full Changelog: Download the latest version: v1.3.0 (2024-03-24) GuiBuilderPlus v1.3.0 - 2024-03-24.zip FIXED: Wrong line endings when copying from code preview window FIXED: Issue changing properties when Obect Explorer window is not open FIXED: Issue when selecting controls under certain other conditions FIXED: SaveAs keyboard shortcut FIXED: Undo/Redo for Global property ADDED: Auto-size property for Labels, Buttons, and Inputs GitHub Repository: https://github.com/KurtisLiggett/GuiBuilderPlus
    5 points
  22. BIG THANKS to @UEZ for his code, which I adapted, plus adding some of my own. See his post here. I spent quite a while trying to come up with something simple to include in a program of mine. The examples in the Help file didn't quite do it for me, some very complex. Here's an image I needed to rotate by 1 degree right, and then trim and resize, for embedding into my FLAC and MP3 files for that album. The image was sourced from eBay, as alas Discogs let me down. Admittedly the album title wasn't very helpful, and there are two other volumes, though I only have the first one. Anyway, I have provided the image, so you can test and play around with it. #include <GDIPlus.au3> ; BIG THANKS to UEZ ; I modified his example from - https://www.autoitscript.com/forum/topic/155932-gdiplus-need-help-with-rotating-an-image/?do=findComment&comment=1127106 Global $hBackbuffer, $hBitmap, $hBitmap_Scaled, $hClone, $hCoverBitmap, $hCoverGC, $hCoverMatrix, $hCoverTexture, $hGraphic, $iH, $inifile, $iW, $newfile, $sCLSID $inifile = @ScriptDir & "\Settings.ini" $newfile = @ScriptDir & "\rotated.jpg" If FileExists($newfile) Then FileDelete($newfile) _GDIPlus_Startup() $hCoverTexture = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\cover.jpg") $iW = _GDIPlus_ImageGetWidth($hCoverTexture) $iH = _GDIPlus_ImageGetHeight($hCoverTexture) $iW = $iW / 2 $iH = $iH / 2 $hBitmap_Scaled = _GDIPlus_ImageResize($hCoverTexture, $iW, $iH, 5) Global $hGUI = GUICreate("", $iW, $iH) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic) $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) $hCoverBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hBackbuffer) $hCoverGC = _GDIPlus_ImageGetGraphicsContext($hCoverBitmap) $hCoverMatrix = _GDIPlus_MatrixCreate() Rotate() Sleep(1000) Local $crop = 1, $resize = 1, $trim If $crop = 1 Then Local $lft = IniRead($inifile, "Image Crop", "left", 0) Local $tp = IniRead($inifile, "Image Crop", "top", 0) Local $wd = IniRead($inifile, "Image Crop", "width", $iW) Local $ht = IniRead($inifile, "Image Crop", "height", $iH) Local $size = $lft & "_" & $tp & "_" & $wd & "_" & $ht ; $trim = InputBox("Crop Query", "Please set the desired values." & @LF & @LF & "Left_Top_Width_Height", $size, "", 200, 160, Default, Default) If @error = 0 Then $trim = StringSplit($trim, "_", 1) If $trim[0] = 4 Then $lft = $trim[1] $tp = $trim[2] $wd = $trim[3] $ht = $trim[4] IniWrite($inifile, "Image Crop", "left", $lft) IniWrite($inifile, "Image Crop", "top", $tp) IniWrite($inifile, "Image Crop", "width", $wd) IniWrite($inifile, "Image Crop", "height", $ht) If $wd < 1 Then $wd = $iW EndIf If $ht < 1 Then $ht = $iH EndIf If $lft < 1 Then $lft = 0 EndIf If $tp < 1 Then $tp = 0 EndIf $wd = $wd - $lft $ht = $ht - $tp ; 188_55_630_496 $hClone = _GDIPlus_BitmapCloneArea($hBitmap, $lft, $tp, $wd, $ht, $GDIP_PXF24RGB) Else MsgBox(262192, "Crop Error", "Wrong number of values specified. 4 required.", 0, $DropboxGUI) EndIf EndIf Else $hClone = "none" EndIf If $resize = 1 Then If $hClone = "none" Then $hClone_Scaled = _GDIPlus_ImageResize($hBitmap, 600, 600, 5) Else $hClone_Scaled = _GDIPlus_ImageResize($hClone, 600, 600, 5) EndIf Else $hClone_Scaled = $hBitmap EndIf $sCLSID = _GDIPlus_EncodersGetCLSID("JPG") _GDIPlus_ImageSaveToFileEx($hClone_Scaled, $newfile, $sCLSID) If FileExists($newfile) Then ShellExecute($newfile) GUIDelete($hGUI) _GDIPlus_BitmapDispose($hBitmap_Scaled) _GDIPlus_BitmapDispose($hClone_Scaled) If $hClone <> "none" Then _GDIPlus_ImageDispose($hClone) _GDIPlus_MatrixDispose($hCoverMatrix) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_GraphicsDispose($hCoverGC) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_BitmapDispose($hCoverBitmap) _GDIPlus_BitmapDispose($hCoverTexture) _GDIPlus_ImageDispose($hBackbuffer) _GDIPlus_Shutdown() Exit Func Rotate() _GDIPlus_GraphicsClear($hBackbuffer, 0xFF6495ED) _GDIPlus_MatrixTranslate($hCoverMatrix, 0, 0) ; move it back to 0, 0 since (112 / 2) and (37 / 2) are it's middle origin point _GDIPlus_MatrixRotate($hCoverMatrix, 1) ; rotate it around it's middle origin point (minus to rotate left) _GDIPlus_GraphicsSetTransform($hCoverGC, $hCoverMatrix) _GDIPlus_MatrixTranslate($hCoverMatrix, 0, 0) _GDIPlus_GraphicsClear($hCoverGC, 0xFFFFFFFF) ; show the GC _GDIPlus_GraphicsDrawImageRect($hCoverGC, $hCoverTexture, 0, 0, $iW, $iH) ; place the arrow at the center of it's GC _GDIPlus_GraphicsDrawImage($hBackbuffer, $hCoverBitmap, 0, 0) ; move it's GC by an offset so the image is at the correct XY using it's origin _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iW, $iH) EndFunc Resulting image. Enjoy! P.S. I should have probably removed the comments by UEZ in the Rotate function, especially as I changed it to not rotate around the center. Some of the code in that function is likely redundant too, because of that change.
    5 points
  23. Here's a workaround using external processes. #pragma compile(AutoItExecuteAllowed, true) For $i = 1 To 10 _ToolTip_Separate_Process("Test ToolTip " & $i & @CRLF & @CRLF & @CRLF & "Test ToolTip " & $i, 2000, 50 * $i, 50 * $i) Sleep(500) Next Func _ToolTip_Separate_Process($sText = "ToolTip", $iSleep = 2000, $iX = Default, $iY = Default, $sTitle = "", $iIcon = 0, $iOptions = 0) Run(@AutoItExe & ' /AutoIt3ExecuteLine "sleep(' & $iSleep & ' + ToolTip(''' & $sText & ''',' & $iX & ',' & $iY & ',''' & $sTitle & ''',' & $iIcon & ',' & $iOptions & '))"') EndFunc ;==>_ToolTip_Separate_Process
    5 points
  24. SmOke_N

    ClipBoard.au3 udf extras

    After answering some clipboard questions in the help forum, I found myself writing a couple of helper funcs so I thought I'd share. I don't think I added any headers, I'm probably assuming (maybe to much?) that most will get it (yep, to lazy). Example code: #include "ClipBoardMisc.au3" #include <Array.au3> #cs Example 1 collect all the text/unicode/binary data in an array from clip #ce Global $gaArgs = _cbTest_GetAllData() _ArrayDisplay($gaArgs, Default, Default, Default, Default, _ "Format Type|Data TEXT|Data Unicode|Data Byte|Data ByteStr") Func _cbTest_GetAllData() Local $aClipFormats = _ClipBoard_GetCurrentFormatArray() If @error Then Return SetError(1, 0, Null) Local $aRet[UBound($aClipFormats)][5] ; [n][3] is memory address For $i = 0 To UBound($aClipFormats) - 1 ; Using all CBRT_ globals because I'm to lazy to go through all the CFSTR and do ; exhausting test functions to test what type of strings they are ; See: https://geekdude.io/static/ahk/Constants.W32.ini if you want to get a long list of CFSTR_ options $aRet[$i][0] = $aClipFormats[$i][2] $aRet[$i][1] = _ClipBoard_GetMemoryData($aClipFormats[$i][3], $CBRT_TEXT) $aRet[$i][2] = _ClipBoard_GetMemoryData($aClipFormats[$i][3], $CBRT_UNICODE) $aRet[$i][3] = _ClipBoard_GetMemoryData($aClipFormats[$i][3], $CBRT_BYTE) $aRet[$i][4] = _ClipBoard_GetMemoryData($aClipFormats[$i][3], $CBRT_BYTESTR) Next Return $aRet EndFunc Example 2: Get specific format id types array #include "ClipBoardMisc.au3" #include <Array.au3> ;~ #cs Example 2 ; Make sure you use "copy" on a file to test this ; Func: _ClipBoard_GetTypeArray($sType, $hOwner = 0) ; ; $sType: 1. String to be split by "|" separator char ; 2. Return type to be added similar as a struct ; example: $sType = "Text;str|FileNameW;wstr" ; Separates 2 types of arrays internally ; 1. Type array: [n] = "Text" ; [n] = "FileNameW" ; 2. Return type: [n] = "str" ; [n] = "wstr" ; Valid Format Return Strying types: ; "str" or "chr" ; "wstr" or "wchr" or "unicode" ; "byte" ; "bytestr" ; Return: Success: 2D array ; [n][0] = Found Type ; [n][1] = Found Value ; ; Note: It will not validate if the memory address is valid for your return type Global $ga_Test = _ClipBoard_GetTypeArray("filename;str|filenameW;wstr") If @error Then MsgBox(16, "Error", "Error: " & @error & " :: Extended: " & @extended) Else _ArrayDisplay($ga_Test) EndIf ;~ #ce ; updated zip ClipBoardMisc.zip
    5 points
  25. Since I'm working on updating the UDFs, I made a demo: that is quite ugly code wise. Hence my participation on this thread. I like your UDF and would love to see it merged to the extent that is currently functional to the standard distribution for a next release. Would you like to make the changes to make it so ? am recruiting you šŸ¤Ŗ ( am not affiliated with MVPs or developers but am nonetheless bringing up ideas , and try my best to have more capable product for us all ) By the way: this demo is to showcase _WinAPI_DwmSetWindowAttribute() and since it has no examples in the help file, I made two of which this is one. Also the enumeration is based in WinXP or 7. It all needs to be updated to Win 11. Having examples help the users use the function and also, out of the attention it gets, it get's debugged and expanded
    5 points
  26. Andreik

    Real Time Assembler

    I needed a tool to test simple assembly code so I end up with this. This is written using fasmg (a bare assembly engine) to generate binary code for various CPU architectures and you can directly call (test) the code with few parameters. Even if it can generate code for various CPUs, use the call/execute functionality just in 32-bit mode (really, don't try to run 64-bit code and then ask why it doesn't work or why it's crashing ). Basically write the asm code in the left edit control and binary code will be generated automatic in the right panel (if you don't have errors). Before writting the asm code make sure you included cpu/x64.inc (or whatever CPU architecture is your CPU) and maybe one of the directive use16, use32, use64 (use32 if you want to execute the code from application). Also if you want to resolve the offset for each line (this is not mandatory), include line.inc after you included all other includes (example below). #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Comment=Real Time Assembler #AutoIt3Wrapper_Res_Description=Real Time Assembler #AutoIt3Wrapper_Res_Fileversion=1.0.0.3 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #AutoIt3Wrapper_Res_ProductVersion=1 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include 'BinaryCall.au3' #include 'Fasmg.au3' If @AutoItX64 Then MsgBox(0x10, 'Error', 'This application can run just in 32-bit mode.') ; MB_ICONERROR Exit EndIf Global $hMain, $cCode, $cAsm, $hCode Global $cParam1, $cParam2, $cParam3, $cParam4, $cParam5, $cResult Global $sFont = 'Segoe UI', $iFontSize = 12 Global Const $ParamTypes = 'none|byte|boolean|short|ushort|word|int|long|' & _ 'bool|uint|ulong|dword|int64|uint64|ptr|hwnd|handle|float|double|int_ptr|' & _ 'long_ptr|lresult|lparam|uint_ptr|ulong_ptr|dowrd_ptr|wparam|str|wstr|struct' $hMain = GUICreate('Real Time Assembler', 1000, 600) $cCode = GUICtrlCreateEdit('', 10, 10, 385, 580, 0x00201000) ; WS_VSCROLL + ES_WANTRETURN $cAsm = GUICtrlCreateEdit('', 405, 10, 385, 580, 0x00200800) ; WS_VSCROLL + ES_READONLY $cParamLabel = GUICtrlCreateLabel('Parameters', 800, 10, 200, 20, 0x200) ; SS_CENTERIMAGE $cType1 = GUICtrlCreateCombo('', 800, 40, 190, 30, 0x03) ; CBS_DROPDOWNLIST $cParam1 = GUICtrlCreateInput('', 800, 80, 190, 30) $cType2 = GUICtrlCreateCombo('', 800, 120, 190, 30, 0x03) ; CBS_DROPDOWNLIST $cParam2 = GUICtrlCreateInput('', 800, 160, 190, 30) $cType3 = GUICtrlCreateCombo('', 800, 200, 190, 30, 0x03) ; CBS_DROPDOWNLIST $cParam3 = GUICtrlCreateInput('', 800, 240, 190, 30) $cType4 = GUICtrlCreateCombo('', 800, 280, 190, 30, 0x03) ; CBS_DROPDOWNLIST $cParam4 = GUICtrlCreateInput('', 800, 320, 190, 30) $cType5 = GUICtrlCreateCombo('', 800, 360, 190, 30, 0x03) ; CBS_DROPDOWNLIST $cParam5 = GUICtrlCreateInput('', 800, 400, 190, 30) $cResultLabel = GUICtrlCreateLabel('Result', 800, 440, 190, 20, 0x200) ; SS_CENTERIMAGE $cRetType = GUICtrlCreateCombo('', 800, 470, 190, 30, 0x03) ; CBS_DROPDOWNLIST $cResult = GUICtrlCreateLabel('', 800, 510, 190, 30, 0x1000) ; SS_SUNKEN $cRun = GUICtrlCreateButton('Execute', 845, 560, 100, 30) $hCode = GUICtrlGetHandle($cCode) GUICtrlSetBkColor($cAsm, 0xFFFFFF) GUICtrlSetFont($cCode, $iFontSize, Default, Default, $sFont) GUICtrlSetFont($cAsm, $iFontSize, Default, Default, $sFont) GUICtrlSetFont($cParamLabel, $iFontSize, Default, Default, $sFont) GUICtrlSetFont($cType1, $iFontSize, Default, Default, $sFont) GUICtrlSetFont($cType2, $iFontSize, Default, Default, $sFont) GUICtrlSetFont($cType3, $iFontSize, Default, Default, $sFont) GUICtrlSetFont($cType4, $iFontSize, Default, Default, $sFont) GUICtrlSetFont($cType5, $iFontSize, Default, Default, $sFont) GUICtrlSetFont($cRetType, $iFontSize, Default, Default, $sFont) GUICtrlSetFont($cParam1, $iFontSize, Default, Default, $sFont) GUICtrlSetFont($cParam2, $iFontSize, Default, Default, $sFont) GUICtrlSetFont($cParam3, $iFontSize, Default, Default, $sFont) GUICtrlSetFont($cParam4, $iFontSize, Default, Default, $sFont) GUICtrlSetFont($cParam5, $iFontSize, Default, Default, $sFont) GUICtrlSetFont($cRun, $iFontSize, Default, Default, $sFont) GUICtrlSetFont($cResultLabel, $iFontSize, Default, Default, $sFont) GUICtrlSetFont($cResult, $iFontSize, Default, Default, $sFont) GUICtrlSendMsg($cParam1, 0x1501, False, 'Param# 1') ; EM_SETCUEBANNER GUICtrlSendMsg($cParam2, 0x1501, False, 'Param# 2') ; EM_SETCUEBANNER GUICtrlSendMsg($cParam3, 0x1501, False, 'Param# 3') ; EM_SETCUEBANNER GUICtrlSendMsg($cParam4, 0x1501, False, 'Param# 4') ; EM_SETCUEBANNER GUICtrlSendMsg($cParam5, 0x1501, False, 'Param# 5') ; EM_SETCUEBANNER GUICtrlSetData($cType1, $ParamTypes, 'none') GUICtrlSetData($cType2, $ParamTypes, 'none') GUICtrlSetData($cType3, $ParamTypes, 'none') GUICtrlSetData($cType4, $ParamTypes, 'none') GUICtrlSetData($cType5, $ParamTypes, 'none') GUICtrlSetData($cRetType, $ParamTypes, 'none') GUISetState(@SW_SHOW, $hMain) EnvSet('INCLUDE', @ScriptDir & '\include') $hFasmg = Memory_DllOpen(Base64($Fasmg, False)) ConsoleWrite('Fasmg version: ' & Memory_DllCall($hFasmg, 'str', 'fasmg_GetVersion')[0] & @CRLF) GUIRegisterMsg(0x0111, "WM_COMMAND") ; WM_COMMAND While True Switch GUIGetMsg() Case -3 ; GUI_EVENT_CLOSE ExitLoop Case $cRun CallFunction() EndSwitch Sleep(10) WEnd Memory_DllClose($hFasmg) Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg If $lParam = $hCode And BitShift($wParam, 16) = 0x0300 Then ; EN_CHANGE Local $sBinaryCode = Compile(GUICtrlRead($cCode)) GUICtrlSetData($cAsm, $sBinaryCode) EndIf Return 'GUI_RUNDEFMSG' EndFunc Func Compile($sCode, $iBufferSize = 5000) If Not $sCode Then Return Local $iCodeLines = 0, $iPrefix = 0 Local $iLine = StringRegExp($sCode, '^([\s\S]*)(include ''line.inc'')([\s\S]*)$', 0) Local $iDirective = StringRegExp($sCode, '^([\s\S]*)(use16|use32|use64)([\s\S]*)$', 0) If $iLine Then Local $aCode = StringSplit($sCode, @CRLF, 1) For $Index = 1 To $aCode[0] If StringStripWS($aCode[$Index], 7) = 'include ''line.inc''' Then $iCodeLines = $aCode[0] - $Index + 1 $iPrefix = $aCode[0] - $iCodeLines ExitLoop EndIf Next EndIf Local $tMemory = DllStructCreate('byte Code[' & $iBufferSize & ']') Local $pMemory = DllStructGetPtr($tMemory) Local $tFasmg = DllStructCreate('dword Address; dword Size;') DllStructSetData($tFasmg, 'Address', $pMemory) DllStructSetData($tFasmg, 'Size', DllStructGetSize($tMemory)) Local $aCall = Memory_DllCall($hFasmg, 'int', 'fasmg_Assemble', 'str', $sCode, 'str', Null, 'ptr', DllStructGetPtr($tFasmg), 'str', Null, 'handle', Null, 'handle', Null) If $aCall[0] = 0 Then Local $sResult = '' If $iLine And $iDirective And $iCodeLines Then Local $NextOffset = 1, $CurrentOffset = 0, $PrevOffset = 0 Local $iActualCodeSize = DllStructGetData($tFasmg, 'Size') - ($iCodeLines * 4) Local $tActualCode = DllStructCreate('byte Code[' & $iActualCodeSize & ']', $pMemory) Local $sBinary = DllStructGetData($tActualCode, 'Code') Local $iOffsets = (DllStructGetData($tFasmg, 'Size') - $iActualCodeSize) / 4 Local $tOffsets = DllStructCreate('dword Offset[' & $iOffsets & ']', $pMemory + $iActualCodeSize) For $Index = $iOffsets - 2 to 1 Step -1 $CurrentOffset = Number(DllStructGetData($tOffsets, 'Offset', $Index)) $sResult &= Stylize(BinaryMid($sBinary, $NextOffset, $CurrentOffset - $PrevOffset)) $NextOffset += $CurrentOffset - $PrevOffset $PrevOffset = $CurrentOffset Next For $Index = 1 To $iPrefix + 2 $sResult = @CRLF & $sResult Next Else Local $tCode = DllStructCreate('byte Code[' & DllStructGetData($tFasmg, 'Size') & ']', $pMemory) $sResult = Stylize(DllStructGetData($tCode, 'Code')) EndIf Return $sResult Else Return '' EndIf EndFunc Func Stylize($sBinaryCode) Local $sCode = StringTrimLeft(StringStripWS(String($sBinaryCode), 3), 2) Local $iLen = StringLen($sCode) If Mod($iLen, 2) <> 0 Then Return @CRLF & @CRLF Local $sResult For $Index = 1 To $iLen Step 2 $sResult &= StringMid($sCode, $Index, 2) & ' ' Next Return StringStripWS($sResult, 3) & @CRLF EndFunc Func CallFunction() If @AutoItX64 Or StringInStr(GUICtrlRead($cCode), 'use64') Then GUICtrlSetData($cResult, 'No!') Return EndIf Local $sCode = StringStripWS(GUICtrlRead($cAsm), 8) If Not $sCode Then Return Local $aRet Local $sRetType = GUICtrlRead($cRetType) Local $sType1 = GUICtrlRead($cType1) Local $vParam1 = GUICtrlRead($cParam1) Local $sType2 = GUICtrlRead($cType2) Local $vParam2 = GUICtrlRead($cParam2) Local $sType3 = GUICtrlRead($cType3) Local $vParam3 = GUICtrlRead($cParam3) Local $sType4 = GUICtrlRead($cType4) Local $vParam4 = GUICtrlRead($cParam4) Local $sType5 = GUICtrlRead($cType5) Local $vParam5 = GUICtrlRead($cParam5) Local $dCode = Binary('0x' & $sCode) Local $iSize = BinaryLen($dCode) Local $tCode = DllStructCreate('byte Code[' & $iSize & ']') DllStructSetData($tCode, 'Code', $dCode) Local $sCall = 'DllCallAddress(''' & $sRetType & ''',' & DllStructGetPtr($tCode) & ',' If $vParam1 Then $sCall &= '''' & $sType1 & ''',' & (($sType1 = 'str' Or $sType1 = 'wstr') ? ('''' & $vParam1 & '''') : $vParam1) & ',' EndIf If $vParam2 Then $sCall &= '''' & $sType2 & ''',' & (($sType2 = 'str' Or $sType2 = 'wstr') ? ('''' & $vParam2 & '''') : $vParam2) & ',' EndIf If $vParam3 Then $sCall &= '''' & $sType3 & ''',' & (($sType3 = 'str' Or $sType3 = 'wstr') ? ('''' & $vParam3 & '''') : $vParam3) & ',' EndIf If $vParam4 Then $sCall &= '''' & $sType4 & ''',' & (($sType4 = 'str' Or $sType4 = 'wstr') ? ('''' & $vParam4 & '''') : $vParam4) & ',' EndIf If $vParam5 Then $sCall &= '''' & $sType5 & ''',' & (($sType5 = 'str' Or $sType5 = 'wstr') ? ('''' & $vParam5 & '''') : $vParam5) & ',' EndIf $sCall = StringTrimRight($sCall, 1) & ')' $aRet = Execute($sCall) GUICtrlSetData($cResult, IsArray($aRet) ? $aRet[0] : '') EndFunc To make this work I rewrite ward's BinaryCall UDF to use DllCallAddress() and get rid of kernel API hack, but this can work without this UDF with fasmg.dll as a file (I just prefer to load it from memory). Probably it have some bugs but right now it's a tool that can be used for fast debug of assembly code. A simple example: include 'cpu/x64.inc' include 'line.inc' use32 mov eax, [esp+4] add eax, [esp+8] ret 8 This is a simple function that add two integers Add(int a, int b) and return an integer as result. RTA.zip
    5 points
  27. Spent the weekend making animations and putting more of the battle system code together. It's coming along. Making the animations is quite time consuming (even with Aseprite). I've got another screen shot but the forum thing says the file is too big I'll have to downsize the file and try again later. Decided to make a note of the source size. As of 9/19/2023 over 5500 lines of code across the entire project Here's some compiled animations
    5 points
  28. UEZ

    AutoIt Snippets

    _WinAPI_SetDPIAwareness.au3 ;Coded by UEZ build 2023-07-25 beta ;To get it working properly, please compile script first and start the exe afterwards #AutoIt3Wrapper_Res_HiDpi=y #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Change2CUI=y #include <GUIConstantsEx.au3> #include <Misc.au3> #include <WinAPIGdiDC.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> #Region _WinAPI_SetDPIAwareness ;https://learn.microsoft.com/en-us/windows/win32/api/windef/ne-windef-dpi_awareness Global Enum $DPI_AWARENESS_INVALID = -1, $DPI_AWARENESS_UNAWARE = 0, $DPI_AWARENESS_SYSTEM_AWARE = 1, $DPI_AWARENESS_PER_MONITOR_AWARE = 2 ;https://learn.microsoft.com/en-us/windows/win32/hidpi/dpi-awareness-context Global Const $DPI_AWARENESS_CONTEXT_UNAWARE = $DPI_AWARENESS_UNAWARE - 1 Global Const $DPI_AWARENESS_CONTEXT_SYSTEM_AWARE = $DPI_AWARENESS_UNAWARE - 2 Global Const $DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE = $DPI_AWARENESS_UNAWARE - 3 Global Const $DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 = $DPI_AWARENESS_UNAWARE - 4 Global Const $DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED = $DPI_AWARENESS_UNAWARE - 5 ; enum _MONITOR_DPI_TYPE Global Enum $MDT_EFFECTIVE_DPI = 0, $MDT_ANGULAR_DPI, $MDT_RAW_DPI Global Const $MDT_DEFAULT = $MDT_EFFECTIVE_DPI Global Const $WM_DPICHANGED = 0x02E0 ;https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-adjustwindowrectexfordpi Func _WinAPI_AdjustWindowRectExForDpi($dpi, $dwStyle, $dwExStyle, $bMenu = False) Local $tRECT = DllStructCreate($tagRECT) Local $aResult = DllCall("user32.dll", "bool", "AdjustWindowRectExForDpi", "struct*", $tRECT, "dword", $dwStyle, "bool", $bMenu, "dword", $dwExStyle, "uint", $dpi) ;requires Win10 v1607+ / no server support If @error Then Return SetError(@error, @extended, 0) Return $tRECT EndFunc ;==>_WinAPI_AdjustWindowRectExForDpi Func _WinAPI_GetDPI($hWnd = _WinAPI_GetDesktopWindow()) Local Const $hDC = _WinAPI_GetDC($hWnd) If @error Then Return SetError(1, 0, 0) Local Const $iDPI = _WinAPI_GetDeviceCaps($hDC, $LOGPIXELSX) If @error Or Not $iDPI Then _WinAPI_ReleaseDC($hWnd, $hDC) Return SetError(2, 0, 0) EndIf _WinAPI_ReleaseDC($hWnd, $hDC) Return $iDPI EndFunc ;==>_WinAPI_GetDPI ;https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdpiforwindow Func _WinAPI_GetDpiForWindow($hWnd) Local $aResult = DllCall("user32.dll", "uint", "GetDpiForWindow", "hwnd", $hWnd) ;requires Win10 v1607+ / no server support If @error Then Return SetError(@error, @extended, 0) Return $aResult[0] EndFunc ;==>_WinAPI_GetDpiForWindow ;https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setprocessdpiawarenesscontext Func _WinAPI_SetProcessDpiAwarenessContext($DPI_AWARENESS_CONTEXT_value) Local $aResult = DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", "int", $DPI_AWARENESS_CONTEXT_value) ;requires Win10 v1703+ / Windows Server 2016+ If @error Then Return SetError(@error, @extended, 0) Return $aResult[0] EndFunc ;==>_WinAPI_SetProcessDpiAwarenessContext ;https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setthreaddpiawarenesscontext Func _WinAPI_SetThreadDpiAwarenessContext($DPI_AWARENESS_CONTEXT_value) Local $aResult = DllCall("user32.dll", "bool", "SetThreadDpiAwarenessContext", "int", $DPI_AWARENESS_CONTEXT_value) ;requires Win10 v1703+ / Windows Server 2016+ If @error Then Return SetError(@error, @extended, 0) Return $aResult[0] EndFunc ;==>_WinAPI_SetThreadDpiAwarenessContext ;https://learn.microsoft.com/en-us/windows/win32/api/shellscalingapi/nf-shellscalingapi-setprocessdpiawareness Func _WinAPI_SetProcessDpiAwareness($PROCESS_DPI_AWARENESS = $DPI_AWARENESS_PER_MONITOR_AWARE) Local $iResult = DllCall("Shcore.dll", "long", "SetProcessDpiAwareness", "int", $PROCESS_DPI_AWARENESS) ;requires Win 8.1+ / Server 2012 R2+ If @error Or $iResult Then Return SetError(1, 0, 0) Return 1 EndFunc ;==>_WinAPI_SetProcessDpiAwareness Func _WinAPI_SetDPIAwareness($DPIAwareContext = $DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE, $iMode = 1) Switch @OSBuild Case 6000 To 9199 If Not DllCall("user32.dll", "bool", "SetProcessDPIAware") Then Return SetError(1, 0, 0) Case 9200 To 13999 $DPIAwareContext = ($DPIAwareContext < 0) ? 0 : ($DPIAwareContext > 2) ? 2 : $DPIAwareContext _WinAPI_SetProcessDpiAwareness($DPIAwareContext) If @error Then Return SetError(2, @error, 0) Case @OSBuild > 13999 $DPIAwareContext = ($DPIAwareContext < -5) ? -5 : ($DPIAwareContext > -1) ? -1 : $DPIAwareContext $iMode = ($iMode < 1) ? 1 : ($iMode > 2) ? 2 : $iMode Switch $iMode Case 1 _WinAPI_SetProcessDpiAwarenessContext($DPIAwareContext) If @error Then Return SetError(3, 0, 0) Case 2 _WinAPI_SetThreadDpiAwarenessContext($DPIAwareContext) If @error Then Return SetError(4, 0, 0) EndSwitch EndSwitch If @OSBuild < 14393 Then $iDPI = _WinAPI_GetDPI() If @error Then Return SetError(5, 0, 0) Else Local Const $hGUI_dummy = GUICreate("", 1, 1, 0, 0) $iDPI = _WinAPI_GetDpiForWindow($hGUI_dummy) GUIDelete($hGUI_dummy) If @error Then Return SetError(6, 0, 0) EndIf Return $iDPI EndFunc ;==>_WinAPI_SetDPIAwareness #EndRegion Global $dpiScaledX, $dpiScaledY, $aCtrlFS[5][2], $hGUI, $hGUI_child, $g_iDPI_ratio2, $iLable_child, $iPic_child, _ $sImage = "c:\Program Files (x86)\AutoIt3\Examples\GUI\Merlin.gif" Example1() Func Example1() Local $iDPI = _WinAPI_SetDPIAwareness($DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) If @error Or Not $iDPI Then Exit MsgBox($MB_ICONERROR, "ERROR", "Cannot set DPI awareness!", 10) ConsoleWrite("DPI read: " & $iDPI & @CRLF) Local $iDPI_ratio = $iDPI / 96 $g_iDPI_ratio2 = 96 / $iDPI $hGUI = GUICreate("Example 1", 314 * $iDPI_ratio, 130 * $iDPI_ratio, -1, 10) GUISetFont(12 * $iDPI_ratio, 400, 0, "Times New Roman") $aCtrlFS[0][0] = GUICtrlCreateLabel("Label1", 16 * $iDPI_ratio, 16 * $iDPI_ratio, 40 * $iDPI_ratio, 21 * $iDPI_ratio) $aCtrlFS[0][1] = 10 GUICtrlSetBkColor(-1, 0x3399FF) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $aCtrlFS[1][0] = GUICtrlCreateLabel("Label2", 64 * $iDPI_ratio, 16 * $iDPI_ratio, 40 * $iDPI_ratio, 21 * $iDPI_ratio) $aCtrlFS[1][1] = 10 GUICtrlSetBkColor(-1, 0x3399FF) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $aCtrlFS[2][0] = GUICtrlCreateLabel("Label3", 112 * $iDPI_ratio, 16 * $iDPI_ratio, 40 * $iDPI_ratio, 21 * $iDPI_ratio) $aCtrlFS[2][1] = 10 GUICtrlSetBkColor(-1, 0x3399FF) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $aCtrlFS[3][0] = GUICtrlCreateInput("Input1", 160 * $iDPI_ratio, 16 * $iDPI_ratio, 137 * $iDPI_ratio, 22 * $iDPI_ratio) $aCtrlFS[3][1] = 10 GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $aCtrlFS[4][0] = GUICtrlCreateButton("Close", 16 * $iDPI_ratio, 48 * $iDPI_ratio, 283 * $iDPI_ratio, 65 * $iDPI_ratio) $aCtrlFS[4][1] = 16 GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $hGUI_child = GUICreate("Child", 320 * $iDPI_ratio, 260 * $iDPI_ratio, -1, -1, -1, -1, $hGUI) GUISetBkColor(0xFFFFFF) $iLable_child = GUICtrlCreateLabel("Label11", 16, 16, 288 * $iDPI_ratio, 168 * $iDPI_ratio) GUICtrlSetFont(-1, 65, 400, 0, "Times New Roman", 5) $iPic_child = GUICtrlCreatePic($sImage, 0, 160 * $iDPI_ratio, 68 * $iDPI_ratio, 71 * $iDPI_ratio) ResizeFont($hGUI) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hGUI_child) GUIRegisterMsg($WM_DPICHANGED, "WM_DPICHANGED") While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $aCtrlFS[4][0] GUIDelete($hGUI_child) GUIDelete($hGUI) ExitLoop EndSwitch WEnd EndFunc ;==>Example1 Func ResizeFont($hWnd) Local $iDPI = _WinAPI_GetDpiForWindow($hWnd), $dpi_ratio = $iDPI / 96 Switch $hWnd Case $hGUI Local $i For $i = 0 To UBound($aCtrlFS) - 1 GUICtrlSetFont($aCtrlFS[$i][0], $aCtrlFS[$i][1] * $dpi_ratio * $g_iDPI_ratio2, 400, 0, "Times New Roman", 5) Next Case $hGUI_child GUICtrlSetFont($iLable_child, 65 * $dpi_ratio * $g_iDPI_ratio2, 400, 0, "Times New Roman", 5) EndSwitch EndFunc ;==>ResizeFont Func WM_DPICHANGED($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam Local $dpi_ratio2 = 96 / _WinAPI_LoWord($wParam) Local $dpi_ratio = _WinAPI_LoWord($wParam) / 96 Local $tRECT = DllStructCreate($tagRECT, $lParam) Local $iX = $tRECT.left, $iY = $tRECT.top, $iW = $tRECT.right - $iX, $iH = $tRECT.bottom - $iY _WinAPI_AdjustWindowRectExForDpi(_WinAPI_HiWord($wParam), BitOR($WS_BORDER, $WS_CAPTION, $WS_CLIPSIBLINGS, $WS_GROUP, $WS_POPUP, $WS_SYSMENU, $WS_VISIBLE), $WS_EX_WINDOWEDGE) _WinAPI_SetWindowPos($hWnd, 0, $iX, $iY, $iW, $iH, BitOR($SWP_NOZORDER, $SWP_NOACTIVATE)) ResizeFont($hWnd) Local $aPos = ControlGetPos($hWnd, "", $iPic_child) If UBound($aPos) = 4 Then _WinAPI_MoveWindow(GUICtrlGetHandle($iPic_child), $aPos[0] * $dpi_ratio2 * $g_iDPI_ratio2, $aPos[1] * $dpi_ratio2 * $g_iDPI_ratio2, $aPos[2] * $dpi_ratio * $g_iDPI_ratio2, $aPos[3] * $dpi_ratio * $g_iDPI_ratio2) GUICtrlSetImage($iPic_child, $sImage) EndIf $tRECT = 0 ConsoleWrite("DPI change to " & _WinAPI_LoWord($wParam) & " detected and applied to the GUI elements" & @CRLF) Return 1 EndFunc ;==>WM_DPICHANGED
    5 points
  29. Here is something that I have been wanting in AutoIt for years but sadly no one had created it yet. Well, I decided to hunker down and do something about it! I present to you, MbTCP - a Modbus TCP/IP UDF. What is Modbus? Modbus is a communications protocol commonly used to communicate with various types of PLC's, sensors, SCADA systems, and many other industrial applications. Modbus TCP is the ethernet variant (as opposed to Modbus RTU which uses a serial connection). This UDF takes care of all the behind-the-scenes legwork and makes it easy to get right to the data. No need to worry about which function codes to use or how to format the data. Modbus typically works on discrete coils and inputs (think BOOL) or 16-bit registers (think INT). However, some devices support 32-bit signed and unsigned integers and 32-bit floating point numbers. This is possible by reading or writing 2 consecutive 16-bit registers and formatting them on both ends. The UDF will take care of all that as well (although maybe not in the most sophisticated ways...šŸ˜ ). Because there is no standard for working with 32-bit numbers, it is necessary to have the option to enable or disable big-endianness. Similarly, not all devices start counting at register 1. Some of them actually start at register 0. The UDF allows you to define these parameters when creating the connection to the device. Available data types for input and holding registers are INT16, UINT16, INT32, UINT32, and FLOAT32. Function List: ; _MbTcp_Connect ......................: Open a connection to a remote device ; _MbTcp_ReadCoils ....................: Read 1 or more output coils (function code 1) ; _MbTcp_ReadDiscreteInputs ...........: Read 1 or more discrete inputs (function code 2) ; _MbTcp_ReadHoldingRegisters .........: Read 1 or more holding registers (function code 3) ; _MbTcp_ReadInputRegisters ...........: Read 1 or more input registers (function code 4) ; _MbTcp_WriteCoils ...................: Write 1 or more output coils (function code 5 and 15) ; _MbTcp_WriteRegisters ...............: Write 1 or more holding registers (function code 6 and 16) ; _MbTcp_Disconnect ...................: Close the connection to a device ; _MbTcp_DisconnectAll ................: Close the connection to all connected devices To get started, follow these easy steps: Create a new connection to the device using _MbTcp_Connect Call any of the available read or write functions That's it. The program will automatically clean up any connections that are left open on exit. You may also manually disconnect from any device if needed. The most basic example of use. Connect to a device and read one holding register starting at register 2. #include "MbTcp.au3" ;connect to device at IP 127.0.0.1 Local $iConnection1 = _MbTcp_Connect("127.0.0.1") If @error Then MsgBox(16, "Error", "Failed to connect to the Modbus device at 127.0.0.1." & @CRLF & "Error Code: " & @error) Exit Else ConsoleWrite("Successfully connected to device at 127.0.0.1" & @CRLF) EndIf ;read 1 holding register Local $iReadData = _MbTcp_ReadHoldingRegisters($iConnection1, 2, 1) If @error Then MsgBox(16, "Error", "Failed to read the Modbus value." & @CRLF & "Error Code: " & @error) Else ConsoleWrite("Value: " & $iReadData & @CRLF) EndIf The next example shows how we can format the data to return an unsigned integer instead of the default signed integer. In the following example, we connect to a device that uses big-endian word order and starts at register 0 instead of 1. Then we read and write a group of registers. I may add more examples here if needed. There are a number of Modbus simulators out there if you want to test locally on your computer. But I really like a tool named Mod_RSsim link. Let me know if you find any issues. I know I will probably end up needing to add a timeout option. MbTcp_20230620.zip
    5 points
  30. Version 1.6.2.0

    16,568 downloads

    Extensive library to control and manipulate Microsoft Active Directory. Threads: Development - General Help & Support - Example Scripts - Wiki Previous downloads: 30467 Known Bugs: (last changed: 2020-10-05) None Things to come: (last changed: 2020-07-21) None BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort
    5 points
  31. I need from from time to time to run small processes to perform task that would otherwise clog the main process. Yes, there is a number of other UDF that could have done it very well, but I felt they were an over-kill for what I wanted. Don't throw me stones, I know it's not really multi-threading, but it is as close as I could get with simple AutoIt. If someone wonders why I called it PMT, the P stands for Pretending. And I'm also not pretending it is an elaborate UDF. Just small and simple to use... Version 2024-03-24 * corrected bug when 8 parameters (max) is passed to the function Example : #AutoIt3Wrapper_Res_SaveSource=y #include "PMT-UDF.AU3" #include <Constants.au3> _PMT_Init() Local $hProc1 = _PMT_Start("Test1", Default, "Test 1") _PMT_Start("Test2") _PMT_Start("Test3", 5) Local $sResponse While Sleep(50) $sResponse = _PMT_GetResponse($hProc1) If @error Then Exit MsgBox($MB_OK, "Error", "Process has dropped") If $sResponse <> "" Then MsgBox($MB_OK, "Success", $sResponse & @CRLF) ExitLoop EndIf WEnd Func Test1($sTitle, $sMessage) Local $iResp = MsgBox($MB_OK, $sTitle, $sMessage) Return "Done with value " & $iResp EndFunc Func Test2() MsgBox($MB_OK, "2", "Test 2") EndFunc Func Test3($iTimeout) MsgBox($MB_OK, "3", "Test 3", $iTimeout) EndFunc You can pass up to 8 parameters to _PMT_Start. It is up to you to manage the right number. You cannot pass structures, maps or arrays as parameter (only bool, ptr, hWnd, int, float, string, and the keyword Default). You could use my WCD-IPC if need be to exchange large amount of data. If you want to run it compiled, you need to have add #AutoIt3Wrapper_Res_SaveSource=y at the start of your script. In the case you decide to compile your script, _PMT_Init allows you to identity where AutoIt3 is located (in the situation where AutoIt is not installed in the usual directory) to get the right includes in your "threads". Let me know if you have any question, or suggestion, I will be glad to hear them. Enjoy. PMT-UDF.au3
    4 points
  32. @UEZ, nice. I've fiddled with the UEZ listing a bit you can now rotate the image visually with a slider you can also finely adjust the rotation with two buttons I also added 2 "rulers", one vertical and one horizontal, which you can move by clicking on them and dragging them, in order to have a reference to control the orientation of the image ;Coded by UEZ 2024-03-16 ; [few mods by Gianni :) ] #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> ; --- rulers ----- Global $iThickness = 4 Global $hGUI1 = GUICreate("", @DesktopWidth, $iThickness, 0, @DesktopHeight / 2, $WS_POPUP, $WS_EX_TOPMOST) GUICtrlCreateLabel("", 0, 0, @DesktopWidth, $iThickness, -1, $GUI_WS_EX_PARENTDRAG) GUISetBkColor(0x00ff00, $hGUI1) WinSetTrans($hGUI1, "", 127) GUISetState(@SW_SHOW, $hGUI1) Global $hGUI2 = GUICreate("", $iThickness, @DesktopHeight, @DesktopWidth / 2, 0, $WS_POPUP, $WS_EX_TOPMOST) GUICtrlCreateLabel("", 0, 0, $iThickness, @DesktopHeight, -1, $GUI_WS_EX_PARENTDRAG) GUISetBkColor(0x00ff00, $hGUI2) WinSetTrans($hGUI2, "", 127) GUISetState(@SW_SHOW, $hGUI2) ; ---------------- Global $sFile = "cover.jpg" ;FileOpenDialog("Select an image", "", "Images (*.jpg;*.png;*.gif;*.bmp)") If @error Then Exit Const $fPI = ACos(-1) _GDIPlus_Startup() Global $hImage = _GDIPlus_ImageLoadFromFile($sFile) Global $aDim = _GDIPlus_ImageGetDimension($hImage) Global Const $hGUI = GUICreate("Image Rotate", $aDim[0], $aDim[1] + 50) Global Const $hDC = _WinAPI_GetDC($hGUI) Global Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $aDim[0], $aDim[1]) Global Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Global Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Global Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) Global Const $hPen = _GDIPlus_PenCreate(0xFFFFFFFF) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, 4) _GDIPlus_GraphicsDrawImageRect($hCanvas, $hImage, 0, 0, $aDim[0], $aDim[1]) Global $hButton1 = GUICtrlCreateButton(' < ', 10, $aDim[1] + 10, 40) Global $Slider = GUICtrlCreateSlider(60, $aDim[1] + 10, 360, 25) GUICtrlSetLimit(-1, 360, 0) ; change min/max value Global $hButton2 = GUICtrlCreateButton(' > ', 430, $aDim[1] + 10, 40) Global $hSlider = GUICtrlGetHandle($Slider) Global $Dummy = GUICtrlCreateDummy() GUIRegisterMsg($WM_HSCROLL, "WM_HVSCROLL") ;horz slider GUISetState(@SW_SHOW, $hGUI) _ImageRefresh() ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Dummy _GDIPlus_ImageRotate($hImage, GUICtrlRead($Slider)) _ImageRefresh() Case $hButton1 _FineTuning(1) Case $hButton2 _FineTuning(2) EndSwitch WEnd _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_ReleaseDC($hGUI, $hDC) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _GDIPlus_PenDispose($hPen) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Func _FineTuning($iDirection) Local Static $iAngle Local Static $iSliderPos = GUICtrlRead($Slider) If $iSliderPos <> GUICtrlRead($Slider) Then $iAngle = 0 $iSliderPos = GUICtrlRead($Slider) EndIf Switch $iDirection Case 1 $iAngle -= .1 If $iAngle < 0 Then $iAngle = .9 $iSliderPos -= 1 If $iSliderPos < 0 Then $iSliderPos = 359 GUICtrlSetData($Slider, $iSliderPos) EndIf Case 2 $iAngle += .1 If $iAngle > .9 Then $iAngle = 0 $iSliderPos += 1 If $iSliderPos > 359 Then $iSliderPos = 0 GUICtrlSetData($Slider, $iSliderPos) EndIf EndSwitch _GDIPlus_ImageRotate($hImage, $iSliderPos + $iAngle) _ImageRefresh() EndFunc ;==>_FineTuning Func _ImageRefresh() _GDIPlus_GraphicsClear($hCanvas) _GDIPlus_GraphicsDrawImageRect($hCanvas, $hImage, 0, 0, $aDim[0], $aDim[1]) _WinAPI_BitBlt($hDC, 0, 0, $aDim[0], $aDim[1], $hDC_backbuffer, 0, 0, $SRCCOPY) EndFunc ;==>_ImageRefresh Func _GDIPlus_ImageRotate($hImage, $fDegree) ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $fDegree = ' & $fDegree & @TAB & '>Error code: ' & @error & @CRLF) ;### Debug Console Local $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $aDim[0] / 2, $aDim[1] / 2) _GDIPlus_MatrixRotate($hMatrix, $fDegree) _GDIPlus_MatrixTranslate($hMatrix, -$aDim[0] / 2, -$aDim[1] / 2) _GDIPlus_GraphicsSetTransform($hCanvas, $hMatrix) _GDIPlus_MatrixDispose($hMatrix) EndFunc ;==>_GDIPlus_ImageRotate Func WM_HVSCROLL($hwnd, $iMsg, $wParam, $lParam) #forceref $hwnd, $iMsg, $wParam, $lParam Switch $iMsg Case $WM_HSCROLL Switch $lParam Case $hSlider GUICtrlSendToDummy($Dummy, GUICtrlRead($Slider)) EndSwitch Case $WM_VSCROLL EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_HVSCROLL
    4 points
  33. here is a small and funny script to quickly test your CSS file "on the fly" (no need to compile the help), save your CSS file along this script. just run this script while autoit help is open. The script sets the CSS parameters for the pages as you browse them. #include <IE.au3> Global $oIE Global $sMyCSS = FileRead(".\AutoItHelp.css") ; Your custom CSS file _Example() Func _Example() Local $sHelpVersion = "AutoIt Help (v3.3.16.1)" ; get this from the Help window's title bar Local $hWND = WinGetHandle($sHelpVersion) ; handle of the AutoIt Help window If Not WinExists($hWND) Then Return MsgBox(0, 'Help not found', "no AutoIt Help running", 3) $oIE = _IEAttach($hWND, "embedded") ; get reference to the BrowserControl embedded in the Help If @error Then Return MsgBox(0, 'Browser Control error', "problems on attaching Browser Control", 3) ; Set your custom CSS settings _WebBrowser_CSS_Inject($oIE, $sMyCSS) ; get a reference to the browser's window (for event management purpose) Local $oWindow = $oIE.document.parentwindow ; setup an event management Local $Event = ObjEvent($oWindow, "IEEvent_", 'HTMLWindowEvents') While WinExists($hWND) ; stay alive only while the help is running GUIGetMsg() ; just to delay the CPU load WEnd Return MsgBox(0, '', "AutoIt Help closed", 3) EndFunc ;==>_Example ; following function is fired each time the Help page changes Volatile Func IEEvent_onload($oEvent) ; ConsoleWrite("Debug: onload event" & @crlf) _WebBrowser_CSS_Inject($oIE, $sMyCSS) ; ; apply your custom CSS setting to the loaded page EndFunc ;==>IEEvent_onload ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WebBrowser_CSS_Inject ; Description ...: this function creates into the html document a CSS node element with embedded the passed CSS or a link to a CSS ; Syntax ........: _WebBrowser_CSS_Inject(Byref $oIE_Server, $sStylesheet[, $bIsUrl = False]) ; Parameters ....: $oIE_Server - a Webbrowser object reference. ; $sStylesheet - CSS source to be injected into the page (either, a CSS or an URL (a link to a CSS) ; $bIsUrl - [optional] True if above parameter is an URL (a link to a CSS source). Default is False. ; Return values .: A Node Object reference, representing the appended node ; Author ........: Gianni ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _WebBrowser_CSS_Inject(ByRef $oIE_Server, $sStylesheet, $bIsUrl = False) ; Inject css Local $oStyleNode Local $objDocument = $oIE_Server.document ; If $bIsUrl Then ; use the link to load a stylesheet $oStyleNode = $objDocument.createElement('link') ; // Creates <link /> $oStyleNode.type = "text/css" $oStyleNode.rel = 'stylesheet' $oStyleNode.href = $sStylesheet Else ; inject the stylesheet directly $oStyleNode = $objDocument.createElement('style') ; // Creates <style></style> $oStyleNode.type = 'text/css' $oStyleNode.styleSheet.cssText = $sStylesheet ; // Syntax for IE EndIf ; Local $oNode = $objDocument.getElementsByTagName('head').item(0).appendChild($oStyleNode) If $bIsUrl Then ; wait till css has been downloaded Do Sleep(250) ; ConsoleWrite('css: ' & $oNode.ReadyState & @CRLF) ; debug purpose Until $oNode.ReadyState = "loaded" Or $oNode.ReadyState = "complete" EndIf Return $oNode EndFunc ;==>_WebBrowser_CSS_Inject
    4 points
  34. Well, it's in the notes... While listening to an audio book I got annoyed at the constant misreading of numbers. Example: 692,000 would be read as six hundred ninety two zero-zero-zero. It got me thinking, how difficult is it to read them out to an understandable value? See Zips for Examples AutCode is a part of my personal format library, not sure I'll be releasing it, but maybe. Edit: 02/25/2024 This is script breaking, I added more bloat (purposely) and added Spanish as a sub language. I'm not 100% sure if it's absolutely correct though lol. Same day: Fixed decimal issue and returning the not needed zero/cero at the end of 1200 etc Same day: Added some escape char code for ramdon delimiters being passed Edit: 02/26/2024 Added a Text to Number approach, seems to work on English. Fixed code for NumberToText... probably going to zip them, cuz my copy-paste-kungfu is evidently weak! Same day, fixed Spanish issue with y un mil being shown as y mil Edit: 02/27/2024 Added Text to Number approach for Spanish as well, update in zip as well as an example Update same day: had to fix some found issues with decimal, didn't realize I did case sensitive, and I'm to lazy to make it an option (as we're working with numbers and I don't feel like we should have case sensitivity). Updated same day: fixed some other language issues found in Spanish with something like "mil" only being sent to Text To Number. Added: _AutCode_TextNumberGetLanguage , it's just a simple way to get the language of the numbers you're sending... If I'm being honest, I don't see it being incredibly useful. At the moment, it's sending a string return of the language, I don't like this, so I may change it to what it should be in my opinion (to match $N2T_XXX vars). But I'm tired of playing with this thing atm. Edit: 03/01/2024 Added a database version, it's been nearly a decade since I played with databases, so it is definitely not marked for speed at the moment. Once I'm more proficient (again ), I'll probably update the query optimization and db performance... right now it's fairly vanilla... But hey, it works. See NumTextNumDB zip for this one. Zip has both x86/x64 sqlite3 dll from official site (feel free to download your own if you don't want to do a checksum or don't trust mine) and the .db3 filled with the query data. Edit: 03/03/2024 Fixed: English and Spanish only returning blank string when "0", "00", or "000" only is passed Fixed: English and Spanish returning zero [thousands,millions] when something like 100,000,000 is passed Added: German and French -- Removed non-db version that I am no longer updating because it has less features and the same features are in the db version. NumTextNumDB_03032024(1).zip
    4 points
  35. 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 ;--------------------------------------------------------------------------------------------------------------------------------
    4 points
  36. Firstly, this idea comes from https://github.com/killtimer0/uiaccess Normally, you cannot use the screenshot tool to capture the start menu or the Task manager. But here, if you use the screenshot tool with the UIAccess attribute, you can do this.As shown in the above figure This project is used to obtain UIAccess permissions. It can enable your program window to obtain a higher Z order, such as higher than the Task manager. It is on the same level as the on-screen keyboard. It can be used to solve the problem of window occlusion when making screen markers/recording tools. But here, you don't need to do this!You can put the program anywhere on the hard disk without restrictions. The only thing you need is Administrator permission! The 'TokenUIAccess' attribute is present in the process token, which means that after we raise the permission, we can set this permission through' SetTokenInformation 'to bypass the digital signature and the specified installation path. But after some testing, I finally found that to complete this operation, I must have the 'SeTcbPrivilege' permission, so one solution is to 'steal' a token from other system processes in order to obtain the permission. However, modifying the UIAccess of a running program is invalid, so in the end, a new process can only be started. Although this may have some flaws, it still has better more practical than digital signatures. This UDF requires administrator privileges, but you can still use it to create a process with standard user privileges and uiaccess attributes USAGE: Just include it into your scripts. Example: #include <GUIConstantsEx.au3> #include <_uiaccess.au3> Local $hGUI = GUICreate("Example", 300, 300) Local $Checkbox1 = GUICtrlCreateCheckbox("TOPMOST", 10, 50, 340, 20) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Checkbox1 If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) Then WinSetOnTop($hGUI, "", 1) Else WinSetOnTop($hGUI, "", 0) EndIf EndSwitch WEnd 20230711 add: Process SessionId check. 20240221 fix:Some handles were not properly closed _uiaccess.au3
    4 points
  37. ..in the words of @Andreik: "nah, you do it". So I posted #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <WindowsConstants.au3> Global $g_hStatus, $g_aParts Example() Func Example() ; Create GUI Local $hGUI = GUICreate("StatusBar Resize Equidistant (v" & @AutoItVersion & ")", 400, 300, -1, -1, $WS_OVERLAPPEDWINDOW) ; Set parts $g_hStatus = _GUICtrlStatusBar_Create($hGUI) Dim $g_aParts[3] ; = [75, 150, -1] ; it no longer matters _GUICtrlStatusBar_SetParts($g_hStatus, $g_aParts) _GUICtrlStatusBar_SetText($g_hStatus, "Part 0") _GUICtrlStatusBar_SetText($g_hStatus, "Part 1", 1) _GUICtrlStatusBar_SetText($g_hStatus, "Part 2", 2) _GUICtrlStatusBar_Resize_Equidistant($g_hStatus, $g_aParts, $hGUI) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_SIZE, "WM_SIZE") ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example ; Resize the status bar when GUI size changes Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _GUICtrlStatusBar_Resize_Equidistant($g_hStatus, $g_aParts, $hWnd) If @error Then _GUICtrlStatusBar_Resize($g_hStatus) Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE Func _GUICtrlStatusBar_Resize_Equidistant($hStatus, ByRef $aParts, $hGUI) Local $aPos = WinGetPos($hGUI) If @error Then Return SetError(1, 0, 0) Local $iSize = Int(($aPos[2] - 24) / UBound($aParts)) Local $aTemp[UBound($aParts)] ; the "- 24" makes it look more even For $n = 0 To UBound($aParts) - 2 $aTemp[$n] = $iSize * ($n + 1) Next $aTemp[$n] = -1 $aParts = $aTemp ; in case of WinGetPos() error. _GUICtrlStatusBar_SetParts($g_hStatus, $aTemp) EndFunc ;==>_GUICtrlStatusBar_Resize_Equidistant Same as resize but proportional/equidistant.
    4 points
  38. A sort of billboard based on the Edge browser and 'served' by AutoIt. Main script engine taken from this post by @Danyfirex: https://www.autoitscript.com/forum/topic/207856-show-parsed-html-code-in-default-browser-not-ie-moved/?do=findComment&comment=1499455 Basically the smallest embedded web server ever. Obviously the content displayed in the browser is generated by the HTML/CSS/Javascript listing embedded in the AutoIt script. AutoIt simply runs msEdge and "serves" the web page. Nothing special, but an interesting way to contain everything in one file. Reports of errors and suggestions for improvements are welcome Cheers P.S. To easily adapt and prepare the HTML listing, ready to be embedded into the AutoIt listing, see this other post: https://www.autoitscript.com/forum/topic/204362-microsoft-edge-webview2-embed-web-code-in-your-native-application/?do=findComment&comment=1474817 #cs a kind of billboard based on Edge browser and 'served' by AutoIt Main script engine taken from this post by @Danyfirex: https://www.autoitscript.com/forum/topic/207856-show-parsed-html-code-in-default-browser-not-ie-moved/?do=findComment&comment=1499455 basically the smallest embedded web server ever #ce OnAutoItExitRegister('_Done') _EdgeBroswerLoadPage() Func _EdgeBroswerLoadPage() Local $sUrl = "http://127.0.0.1:80" TCPStartup() ; https://learn.microsoft.com/en-us/deployedge/microsoft-edge-configure-kiosk-mode ; https://developer.chrome.com/blog/autoplay ; $pid = Run('"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --app=' & $sUrl & ' --kiosk --edge-kiosk-type=public-browsing --no-first-run --window-size="800,800" --kiosk-idle-timeout-minutes=0 --autoplay-policy=no-user-gesture-required') $pid = Run(@ComSpec & " /c start msedge.exe --app=" & $sUrl & ' --kiosk --edge-kiosk-type=public-browsing --no-first-run --window-size="800,800" --kiosk-idle-timeout-minutes=0 --autoplay-policy=no-user-gesture-required', '', @SW_HIDE) Local $iTimer = TimerInit(), $bTimeout = False, $iMaxWait = 5000 Do Sleep(250) $hEdgeHostWin = WinGetHandle("[CLASS:Chrome_WidgetWin_1]", "Chrome Legacy Window") $bTimeout = TimerDiff($iTimer) > $iMaxWait Until (IsHWnd($hEdgeHostWin) Or $bTimeout) If $bTimeout Then Exit MsgBox(0, 'Error', "Problem on starting MsEdge.") WinMove($hEdgeHostWin, '', (@DesktopWidth / 2 - 400), (@DesktopHeight / 2) - 400, 800, 800) $iConnectedSocket = _ConnectToSock() If @error Then Exit _Done() TCPSend($iConnectedSocket, StringToBinary(_GetSource(), 4)) Sleep(5000) TCPCloseSocket($iConnectedSocket) EndFunc ;==>_EdgeBroswerLoadPage Func _ConnectToSock() Local $iConnectedSocket = -1 Local $hTimer = TimerInit() Local $bErrorTimeout = False Local $iMySocket = TCPListen("127.0.0.1", 80) Do Sleep(300) $iConnectedSocket = TCPAccept($iMySocket) If TimerDiff($hTimer) > (1000 * 5) Then $bErrorTimeout = True ConsoleWrite('Error connect sock' & @CRLF) ExitLoop EndIf Until $iConnectedSocket <> -1 If $bErrorTimeout Then TCPShutdown() Return SetError(1, 0, "Error connect sock") EndIf TCPRecv($iConnectedSocket, 1024) ; ConsoleWrite($iConnectedSocket & @CRLF) Return $iConnectedSocket EndFunc ;==>_ConnectToSock Func _GetSource() Local $sPeace = "Peace;Paz;Paix;Frieden;Pace;Paz;Vrede;Fred;ŠœŠøр;平和;和平;Ų³Ł„Ų§Ł…;ą¤¶ą¤¾ą¤‚ą¤¤ą¤æ;ķ‰ķ™”;Hòa bình;Mír;Barış;שלום;ą“øą“®ą“¾ą“§ą“¾ą“Øą“‚;ŲµŁ„Ų­;įžŸįž“įŸ’įžįž·įž—įž¶įž–;" & _ "Amani;Uxolo;Aman;Rauha;Pokój;Beke;ŠœŠøр;ą¶“ą·Š‍ą¶»ą·ą¶®ą¶øą·’ą¶š;ą·ƒą·ą¶øą¶ŗ;Pokój;ąøŖąø±ąø™ąø•ąø“ąø ąø²ąøž;ą°øą°®ą°¾ą°§ą°¾ą°Øą°‚;Aşiti;Rukuhia;Afioun;Rahu;Barış;Paqe;Paqe;Víðir;Rau;" & _ "Mír;Kalinaw;Salaam;Kapayapaan;ą¶“ą·Š‍ą¶»ą·ą¶®ą¶øą·’ą¶šą¶ŗą·ą¶œą·š;Miers;ą½žą½²ą¼‹ą½‚ą½“ą½¦;Barış;Heddwch;ą¤®ą¤¾ą¤Øą¤øą¤æą¤• ą¤¶ą¤¾ą¤‚ą¤¤ą¤æ;Shanti;Paghi;Pokoj;Ų±ŁˆŲ§ŲØŲ· ŲÆŲ§Ų“ŲŖŁ†;השקט;Fred;ą½žą½²ą¼‹ą½–ą½ ą½²ą¼‹ą½‚ą½“ą½¦;" & _ "Mir;Hòu-î;Peac;Aaman;ŁˆŲ§Ł¾Ų³ŪŒ;Rauhaa;Iřiwa;Ų³ŁƒŁŠŁ†Ų©;Hapus;Mirë;ŲµŁ„Ų­ŲŒ Ų§Ł…Ł†;Santiphap;Paix;Amani;Ashtari;Pangaduan;ŠœŠøр;Sülh;שאלווע;ą°¶ą°¾ą°‚ą°¤ą°æ;" & _ "Udo;Beke;Uhuru;Irimë;ą²¶ą²¾ą²‚ą²¤ą²æ;Hasiti;Kį»į»kan;Milgħuba;ą»€ąŗŖąŗ·ąŗ­ąŗ”ąŗŖąŗ°ąŗ«ąŗ§ąŗ±ąŗ™;Kapayapaan;Ų±Ų§Ų­ŲŖ;Peis;Rāmā;Udo;į€™į€¼į€±į€¬į€€į€ŗį€›į€­į€Æį€øį€›į€¬;ą¶“ą·Š‍ą¶»ą·ą¶®ą¶øą·’ą¶š;Laipni;Rahu;ąØøąØ¼ąØ¾ąØ‚ąØ¤ą©€;Paqe;Pax;Paz;Mir;ŲµŁ„Ų­;" $sPeace = StringReplace($sPeace, ";", " ") Local $sSource = "" $sSource &= "<!doctype html>" & @CRLF $sSource &= "<html lang=""en"">" & @CRLF $sSource &= "<head>" & @CRLF $sSource &= "<meta charset=""utf-8"">" & @CRLF $sSource &= "<title>Peace</title>" & @CRLF $sSource &= "<style>" & @CRLF $sSource &= "/* ---- cube---- */" & @CRLF $sSource &= "/* https://3dtransforms.desandro.com/ */" & @CRLF $sSource &= ".cube {" & @CRLF $sSource &= " width: 200px;" & @CRLF $sSource &= " height: 200px;" & @CRLF $sSource &= " position: relative;" & @CRLF $sSource &= " transform-style: preserve-3d;" & @CRLF $sSource &= " transform: translateZ(-100px);" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= ".scene--hero {" & @CRLF $sSource &= " height: 200px;" & @CRLF $sSource &= " margin: 180px;" & @CRLF $sSource &= " perspective: 500px;" & @CRLF $sSource &= " border: none;" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= ".cube--hero {" & @CRLF $sSource &= " margin: 0 auto;" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= ".cube.is-spinning {" & @CRLF $sSource &= " animation: spinCube 8s infinite ease-in-out;" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= "@keyframes spinCube {" & @CRLF $sSource &= " 0% { transform: translateZ(-100px) rotateX( 0deg) rotateY( 0deg); }" & @CRLF $sSource &= " 100% { transform: translateZ(-100px) rotateX(360deg) rotateY(720deg); }" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= ".cube__face {" & @CRLF $sSource &= " position: absolute;" & @CRLF $sSource &= " width: 200px;" & @CRLF $sSource &= " height: 200px;" & @CRLF $sSource &= " border: 2px solid black;" & @CRLF $sSource &= " line-height: 200px;" & @CRLF $sSource &= " font-size: 100px;" & @CRLF $sSource &= " font-weight: bold;" & @CRLF $sSource &= " color: white;" & @CRLF $sSource &= " text-align: center;" & @CRLF $sSource &= " backface-visibility: hidden;" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= "/* Cube faces colors */" & @CRLF $sSource &= ".cube__face--front { background: hsla( 0, 100%, 50%, 0.7); }" & @CRLF $sSource &= ".cube__face--right { background: hsla( 60, 100%, 50%, 0.7); }" & @CRLF $sSource &= ".cube__face--back { background: hsla(120, 100%, 50%, 0.7); }" & @CRLF $sSource &= ".cube__face--left { background: hsla(180, 100%, 50%, 0.7); }" & @CRLF $sSource &= ".cube__face--top { background: hsla(240, 100%, 50%, 0.7); }" & @CRLF $sSource &= ".cube__face--bottom { background: hsla(300, 100%, 50%, 0.7); }" & @CRLF $sSource &= "" & @CRLF $sSource &= ".cube__face--front { transform: rotateY( 0deg) translateZ(100px); }" & @CRLF $sSource &= ".cube__face--right { transform: rotateY( 90deg) translateZ(100px); }" & @CRLF $sSource &= ".cube__face--back { transform: rotateY(180deg) translateZ(100px); }" & @CRLF $sSource &= ".cube__face--left { transform: rotateY(-90deg) translateZ(100px); }" & @CRLF $sSource &= ".cube__face--top { transform: rotateX( 90deg) translateZ(100px); }" & @CRLF $sSource &= ".cube__face--bottom { transform: rotateX(-90deg) translateZ(100px); }" & @CRLF $sSource &= "" & @CRLF $sSource &= "/* --------------------------------------------------------------------------- */" & @CRLF $sSource &= "/* https://beamtic.com/rotating-radial-stripes-css */" & @CRLF $sSource &= "#body_stripes_container .radial_stripes {" & @CRLF $sSource &= " position:absolute; /* absolute; */" & @CRLF $sSource &= " margin:-100px 0 0 25px; /* auto; */" & @CRLF $sSource &= " left:0;" & @CRLF $sSource &= " top:0;" & @CRLF $sSource &= " width:100vw;" & @CRLF $sSource &= " height:100vw;" & @CRLF $sSource &= " opacity:1;" & @CRLF $sSource &= " animation:rotate 60s infinite linear;" & @CRLF $sSource &= "}" & @CRLF $sSource &= ".radial_stripes {background-image: url(""data:image/svg+xml,%3Csvg id='Layer_1' data-name='Layer 1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 1003.97 1009.5'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill-rule:evenodd;fill:url(%23radial-gradient);%7D%3C/style%3E%3CradialGradient id='radial-gradient' cx='615.23' cy='557.75' r='503.37' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-opacity='0.5'/%3E%3Cstop offset='1' stop-color='%23333' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ctitle%3Eradial-stripes%3C/title%3E%3Cpath class='cls-1' d='M615.23,53V557.75L510.29,64ZM318.54,149.4,615.23,557.75,409.93,96.64Zm-140.44,156L615.23,557.75,240.13,220ZM113.24,505l502,52.76-480-156Zm21.94,208.74,480.05-156-502,52.76Zm105,181.76,375.1-337.74L178.1,810.13Zm169.8,123.37,205.3-461.11L318.54,966.1Zm205.3,43.64V557.75L510.29,1051.47Zm205.3-43.64L615.23,557.75l104.94,493.72Zm169.8-123.37L615.23,557.75,911.91,966.1Zm104.94-181.76-480-156,437.13,252.38ZM1117.21,505l-502,52.76,502,52.76Zm-64.85-199.62L615.23,557.75l480-156Zm-140.45-156L615.23,557.75,990.33,220ZM720.17,64,615.23,557.75,820.53,96.64Z' transform='translate(-113.24 -53)'/%3E%3C/svg%3E"");}" & @CRLF $sSource &= "" & @CRLF $sSource &= "/* Animations */" & @CRLF $sSource &= "@keyframes rotate {" & @CRLF $sSource &= " from {transform:rotate(0deg);}" & @CRLF $sSource &= " to {transform:rotate(360deg);}" & @CRLF $sSource &= "}" & @CRLF $sSource &= "/* --------------------------------------------------------------------------- */" & @CRLF $sSource &= "/* Author: w3schools.in" & @CRLF $sSource &= "URL: https://www.w3schools.in/css/examples/infinite-scrolling-text" & @CRLF $sSource &= "license: Free to use without republishing." & @CRLF $sSource &= "https://www.w3schools.in/page/copyright */" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Container styles */" & @CRLF $sSource &= " .scrolling-text-container {" & @CRLF $sSource &= " border-radius: 4px;" & @CRLF $sSource &= " overflow: hidden;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Inner container styles */" & @CRLF $sSource &= " .scrolling-text-inner {" & @CRLF $sSource &= " display: flex;" & @CRLF $sSource &= " white-space: pre;" & @CRLF $sSource &= " font-size: 32px;" & @CRLF $sSource &= " font-weight: 600;" & @CRLF $sSource &= " padding: 8px 0;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Text styles */" & @CRLF $sSource &= " .scrolling-text {" & @CRLF $sSource &= " display: flex;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " .scrolling-text-item {" & @CRLF $sSource &= " padding: 0 30px;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Apply the animation to the text items */" & @CRLF $sSource &= " .scrolling-text-inner > div {" & @CRLF $sSource &= " animation: var(--direction) var(--marquee-speed) linear infinite;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Pause the animation when a user hovers over it */" & @CRLF $sSource &= " .scrolling-text-container:hover .scrolling-text-inner > div {" & @CRLF $sSource &= " animation-play-state: paused;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Setting the Animation using Keyframes */" & @CRLF $sSource &= " @keyframes scroll-left {" & @CRLF $sSource &= " 0% {" & @CRLF $sSource &= " transform: translateX(0%);" & @CRLF $sSource &= " }" & @CRLF $sSource &= " 100% {" & @CRLF $sSource &= " transform: translateX(-100%);" & @CRLF $sSource &= " }" & @CRLF $sSource &= " }" & @CRLF $sSource &= "/* color */" & @CRLF $sSource &= "/* https://stackoverflow.com/questions/25507496/css-change-text-color-randomly */" & @CRLF $sSource &= " h1 {" & @CRLF $sSource &= " background-image: -webkit-linear-gradient(92deg,#f35626,#feab3a);" & @CRLF $sSource &= " -webkit-background-clip: text;" & @CRLF $sSource &= " -webkit-text-fill-color: transparent;" & @CRLF $sSource &= " -webkit-animation: hue 6s infinite linear;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " @-webkit-keyframes hue {" & @CRLF $sSource &= " from {" & @CRLF $sSource &= " -webkit-filter: hue-rotate(0deg);" & @CRLF $sSource &= " }" & @CRLF $sSource &= " to {" & @CRLF $sSource &= " -webkit-filter: hue-rotate(360deg);" & @CRLF $sSource &= " }" & @CRLF $sSource &= " }" & @CRLF $sSource &= "/* ----- */" & @CRLF $sSource &= "</style>" & @CRLF $sSource &= "</head>" & @CRLF $sSource &= "<body class=""page--intro"">" & @CRLF $sSource &= "<!-- --------------------------------- -->" & @CRLF $sSource &= "<div id=""body_stripes_container"">" & @CRLF $sSource &= "<div class=""radial_stripes""></div>" & @CRLF $sSource &= "</div>" & @CRLF $sSource &= "<!-- --------------------------------- -->" & @CRLF $sSource &= "" & @CRLF $sSource &= "<div class=""scene scene--hero"">" & @CRLF $sSource &= "<div class=""cube cube--hero is-spinning"">" & @CRLF $sSource &= "<div class=""cube__face cube__face--front""><iframe width=""100%"" height=""100%"" src=""https://www.youtube.com/embed/sEMiWoRRixY?autoplay=1&amp;loop=1&amp;modestbranding=1&amp;controls=0&amp;showinfo=0&amp;rel=0&amp;playlist=sEMiWoRRixY"" allow=""autoplay"" frameborder=""0""></iframe></div>" & @CRLF ; &#x2764&#xFE0F</div> <!-- red heart -->" & @CRLF $sSource &= "<!-- <div class=""cube__face cube__face--front""><img src=""https://www.autoitscript.com/forum/cdn/images/logo_autoit_210x72.svg"" alt=""ā˜ŗ""></div> --> <!-- AutoIt logo -->" & @CRLF $sSource &= "<div class=""cube__face cube__face--right"">&#x1F91F</div> <!-- love-you gesture -->" & @CRLF $sSource &= "<div class=""cube__face cube__face--back"">&#x1F54A&#xFE0F</div> <!-- dove of peace -->" & @CRLF $sSource &= "<div class=""cube__face cube__face--left"">&#x1F3F3&#xFE0F&#x200D&#x1F308</div> <!-- peace flag -->" & @CRLF $sSource &= "<div class=""cube__face cube__face--top"">&#x2696&#xFE0F</div> <!-- balance of justice -->" & @CRLF $sSource &= "<div class=""cube__face cube__face--bottom"">&#x262E&#xFE0E</div> <!-- peace sign -->" & @CRLF $sSource &= "<!-- <div class=""cube__face cube__face--bottom""><img src=""https://www.autoitscript.com/forum/uploads/monthly_2022_02/Gianni.jpg.eb7f87bf14dac954de68a882e057e0d5.jpg"" alt=""ā˜ŗ""></div> --> <!-- Gianni -->" & @CRLF $sSource &= "</div>" & @CRLF $sSource &= "</div>" & @CRLF $sSource &= "<!-- --------------------------------- -->" & @CRLF $sSource &= "<!-- Marquee -->" & @CRLF $sSource &= "<div class=""scrolling-text-container"">" & @CRLF $sSource &= " <div class=""scrolling-text-inner"" style=""--marquee-speed: 120s; --direction:scroll-left"" role=""marquee"">" & @CRLF $sSource &= " <div class=""scrolling-text"">" & @CRLF $sSource &= " <div class=""scrolling-text-item""> </div>" & @CRLF $sSource &= " <div class=""scrolling-text-item""><h1>" & $sPeace & "</h1></div>" & @CRLF $sSource &= " </div>" & @CRLF $sSource &= " </div>" & @CRLF $sSource &= "</div>" & @CRLF $sSource &= "<!-- --------------------------------- -->" & @CRLF $sSource &= "</body>" & @CRLF $sSource &= "</html>" & @CRLF Return $sSource EndFunc ;==>_GetSource Func _Done() TCPShutdown() ConsoleWrite(" << Done >>" & @CRLF) EndFunc ;==>TheEnd
    4 points
  39. jugador

    RegisterActiveObject

    reference post https://www.autoitscript.com/forum/topic/202618-implementing-irunningobjecttable-interface/?do=findComment&comment=1525707 Main.au3 #include "RegisterActiveObject UDF3.au3" __ExampleA() Func __ExampleA() Local $s_Clsid Local $o_object = __RegisterActiveObject(Default, $s_Clsid) If @error Or Not IsObj($o_object) Then Return Local $aArray[2] = ["Item A0", "item A1"] $o_object.add("String", 'Apple') $o_object.add("Number", 12345) $o_object.add("Array", $aArray) ConsoleWrite('$o_object -> Count item: ' & $o_object.Count & @CRLF) RunWait( @AutoItExe & " /AutoIt3ExecuteScript " & '"Client.au3" ' & $s_Clsid) ConsoleWrite('$o_object -> Count item: ' & $o_object.Count & @CRLF) __RevokeActiveObject() EndFunc Client.au3 MsgBox( 0, "Client", "Client Started" ) __Client($CmdLine[1]) Func __Client($o_Clsid) Local $m_object = ObjGet("", $o_Clsid) If Not IsObj($m_object) Then Return MsgBox(0, "Client", '$m_object -> Count item: ' & $m_object.Count) $m_object.add("Double", 567.55) MsgBox( 0, "Client", "client End" ) EndFunc for connect to vbscipt change this line of Main.au3 RunWait( @AutoItExe & " /AutoIt3ExecuteScript " & '"Client.au3" ' & $s_Clsid) to RunWait( 'wscript.exe "Client.vbs" ' & ObjName($o_object, 3)) Client.vbs Dim Arg Arg = WScript.Arguments(0) Set M_object = GetObject(, Arg) msgbox VarType(M_object) & " " & TypeName(M_object) msgbox M_object.Count M_object.Add "Double", 567.55 Set M_object = Nothing RegisterActiveObject UDF2.au3 RegisterActiveObject UDF3.au3
    4 points
  40. Jos

    MailSlot

    Haha ... feeling a noob here being directed to the Wiki to RTFM.
    4 points
  41. Local $oShell = ObjCreate('Shell.Application') For $oWindow In $oShell.Windows $oWindow.navigate("d:\") Next
    4 points
  42. Managed to figure out how to get the SSL working thru the *.000webhostapp.com so now there is at least one link that is SSL. Looking at Linode for hosting, also looking at Uberspace.de. Also here's a couple sprites that I've converted to GIF. The animation I may not use in the actual program, just something I drew while practicing this art style I've managed to develop. Being able to use GDI+ in the script is very helpful.
    4 points
  43. Andreik

    Bulldozer

    This is a replication of an old game called Bulldozer created by John 'FlyMan' Hattan (The Code Zone). There is another implementation in AutoHotkey made by Weston Campbell so I made one in AutoIt. In Weston's github repository you can check the game objective and all valid movements and objects. The controls are: UP - Move bulldozer up DOWN - Move bulldozer down RIGHT - Move bulldozer right LEFT - Move bulldozer left R - Restart current level U - Undo last move J - Jump to a specific level PAUSE - Pause the game Currently I added just first 30 40 60 levels but the original game have 180 levels (eventually I will add all of them). Since Weston's code is on github I suppose it's under some kind of creative license so I didn't bother to create other sprites but if someone have time and inspiration to create new sprites, I am open to add new sprites. To do: Maybe some music Hall of fame / Score table Add all original game levels Add more custom levels Provide access to settings (fonts, colors, sprites, hotkeys, etc) In the attachment is a compiled executable and also the source code. #NoTrayIcon #include-once #include <GDIPlus.au3> #include <WinAPI.au3> #include <SQLite.au3> If Not FileExists(@ScriptDir & '\Bulldozer.sqlite') Then MsgBox(0x10, 'Error', 'Database could not be located!', 10) Exit EndIf _SQLite_Startup(@ScriptDir & '\sqlite3.dll') Global $hDB = _SQLite_Open(@ScriptDir & '\Bulldozer.sqlite') Global Const $TileSize = Number(ReadProperty('TileSize', 32)) Global Const $XTiles = Number(ReadProperty('XTiles', 35)) Global Const $YTiles = Number(ReadProperty('YTiles', 25)) If @DesktopWidth < $XTiles * $TileSize Or @DesktopHeight < $YTiles * $TileSize Then MsgBox(0x30, 'Warning', 'For a better experience you need a display with a resolution ' & String($XTiles * $TileSize) & 'x' & String($YTiles * $TileSize) & '.', 10) EndIf Global $X, $Y, $Direction Global $mResources[] Global $mTiles[] Global $aTiles = GetTiles() If IsArray($aTiles) Then For $Index = 1 To UBound($aTiles) - 1 If $aTiles[$Index][1] Then $mTiles[$aTiles[$Index][0]] = $aTiles[$Index][1] Next Else _SQLite_Close() _SQLite_Shutdown() MsgBox(0x10, 'Error', 'Cannot retrieve game tiles from database!', 10) Exit EndIf Global $CurrentLevel = 1 Global $MaxLevel = Number(ReadProperty('MaxLevel', 1)) Global $AutoRestart = Number(ReadProperty('AutoRestart', 0)) Global $Font = ReadProperty('Font', 'Segoe UI') Global $FontSize = Number(ReadProperty('FontSize', 40)) Global $SecFontSize = Number(ReadProperty('SMFontSize', 20)) Global $MessageColor = ReadProperty('MessageColor', 0xFFFFFFFF) Global $SecMessageColor = ReadProperty('SMColor', 0xFF00A000) Global $Start, $PlayTime = 0, $Pause = False, $MsgShow = False Global $LastMove = Null, $PrevLevel = Null, $NumOfMoves = 0 Global $hMain, $aLevel[$YTiles][$XTiles] Global $ClearColor = ReadProperty('ClearColor', '0xFF000000') Global $KeyboardEnabled = False _GDIPlus_Startup() $mResources['Bitmap'] = _GDIPlus_BitmapCreateFromScan0($XTiles * $TileSize, $YTiles * $TileSize) $mResources['Graphics'] = _GDIPlus_ImageGetGraphicsContext($mResources['Bitmap']) _GDIPlus_GraphicsSetCompositingMode($mResources['Graphics'], 0) _GDIPlus_GraphicsSetCompositingQuality($mResources['Graphics'], 2) _GDIPlus_GraphicsSetInterpolationMode($mResources['Graphics'], 2) _GDIPlus_GraphicsSetSmoothingMode($mResources['Graphics'], 2) _GDIPlus_GraphicsSetTextRenderingHint($mResources['Graphics'], 3) For $Index = 1 To UBound($aTiles) - 1 If $aTiles[$Index][2] Then $mResources[$aTiles[$Index][0]] = _GDIPlus_BitmapCreateFromMemory(Unpack($aTiles[$Index][2])) Next $hMain = GUICreate('Bulldozer', $XTiles * $TileSize, $YTiles * $TileSize) $hPic = GUICtrlCreatePic('', 0, 0, $XTiles * $TileSize, $YTiles * $TileSize) GUISetState(@SW_SHOW, $hMain) LoadLevel() DrawLevel() DrawBulldozer($mResources['Bulldozer' & $Direction]) PushToScreen() While True If GUIGetMsg() = -3 Then Quit() If LevelDone() Then NextLevel() If WinActive($hMain) Then If $KeyboardEnabled = False Then KeyboardInput(True) Else If $KeyboardEnabled Then KeyboardInput(False) EndIf Sleep(10) WEnd Func Quit() Local $aKeys = MapKeys($mResources) For $Index = 0 To UBound($aKeys) - 1 $aKeys[$Index] = 'Graphics' ? _GDIPlus_GraphicsDispose($mResources[$aKeys[$Index]]) : _GDIPlus_BitmapDispose($mResources[$aKeys[$Index]]) Next _GDIPlus_Shutdown() _SQLite_Close() _SQLite_Shutdown() Exit EndFunc Func KeyboardInput($Set = True) Local $aKeys = GetKeyboard() If IsArray($aKeys) Then For $Index = 1 To UBound($aKeys) - 1 HotKeySet($aKeys[$Index][0], $Set ? $aKeys[$Index][1] : Null) Next EndIf $KeyboardEnabled = $Set EndFunc Func MoveRight() If $Pause Or $MsgShow Then Return $PrevLevel = $aLevel IsMovable($X + 1, $Y) If $X + 1 < $XTiles And IsMovable($X + 1, $Y) Then If IsRock($X + 1, $Y) And (IsEmpty($X + 2, $Y) Or IsEmptySocket($X + 2, $Y)) Then $aLevel[$Y][$X + 1] = IsSocket($X + 1, $Y) ? $mTiles['Socket'] : $mTiles['None'] $aLevel[$Y][$X + 2] = IsEmpty($X + 2, $Y) ? $mTiles['Rock'] : $mTiles['RockSocket'] $X += 1 ElseIf IsRock($X + 1, $Y) And (Not IsMovable($X + 2, $Y) Or IsRock($X + 2, $Y)) Then $X = $X Else $X += 1 EndIf $NumOfMoves += 1 EndIf $LastMove = 'R' DrawLevel() DrawBulldozer($mResources['BulldozerR']) PushToScreen() EndFunc Func MoveLeft() If $Pause Or $MsgShow Then Return $PrevLevel = $aLevel If $X - 1 > 0 And IsMovable($X - 1, $Y) Then If IsRock($X - 1, $Y) And (IsEmpty($X - 2, $Y) Or IsEmptySocket($X - 2, $Y)) Then $aLevel[$Y][$X - 1] = IsSocket($X - 1, $Y) ? $mTiles['Socket'] : $mTiles['None'] $aLevel[$Y][$X - 2] = IsEmpty($X - 2, $Y) ? $mTiles['Rock'] : $mTiles['RockSocket'] $X -= 1 ElseIf IsRock($X - 1, $Y) And (Not IsMovable($X - 2, $Y) Or IsRock($X - 2, $Y)) Then $X = $X Else $X -= 1 EndIf $NumOfMoves += 1 EndIf $LastMove = 'L' DrawLevel() DrawBulldozer($mResources['BulldozerL']) PushToScreen() EndFunc Func MoveUp() If $Pause Or $MsgShow Then Return $PrevLevel = $aLevel If $Y - 1 > 0 And IsMovable($X, $Y - 1) Then If IsRock($X, $Y - 1) And (IsEmpty($X, $Y - 2) Or IsEmptySocket($X, $Y - 2)) Then $aLevel[$Y - 1][$X] = IsSocket($X, $Y - 1) ? $mTiles['Socket'] : $mTiles['None'] $aLevel[$Y - 2][$X] = IsEmpty($X, $Y - 2) ? $mTiles['Rock'] : $mTiles['RockSocket'] $Y -= 1 ElseIf IsRock($X, $Y - 1) And (Not IsMovable($X, $Y - 2) Or IsRock($X, $Y - 2)) Then $Y = $Y Else $Y -= 1 EndIf $NumOfMoves += 1 EndIf $LastMove = 'U' DrawLevel() DrawBulldozer($mResources['BulldozerU']) PushToScreen() EndFunc Func MoveDown() If $Pause Or $MsgShow Then Return $PrevLevel = $aLevel If $Y + 1 < $YTiles And IsMovable($X, $Y + 1) Then If IsRock($X, $Y + 1) And (IsEmpty($X, $Y + 2) Or IsEmptySocket($X, $Y + 2)) Then $aLevel[$Y + 1][$X] = IsSocket($X, $Y + 1) ? $mTiles['Socket'] : $mTiles['None'] $aLevel[$Y + 2][$X] = IsEmpty($X, $Y + 2) ? $mTiles['Rock'] : $mTiles['RockSocket'] $Y += 1 ElseIf IsRock($X, $Y + 1) And (Not IsMovable($X, $Y + 2) Or IsRock($X, $Y + 2)) Then $Y = $Y Else $Y += 1 EndIf $NumOfMoves += 1 EndIf $LastMove = 'D' DrawLevel() DrawBulldozer($mResources['BulldozerD']) PushToScreen() EndFunc Func IsMovable($CX, $CY) If $CX < 0 Or $CX >= $XTiles Then Return False If $CY < 0 Or $CY >= $YTiles Then Return False Switch $aLevel[$CY][$CX] Case $mTiles['None'], $mTiles['Rock'], $mTiles['RockSocket'], $mTiles['Socket'] Return True Case Else Return False EndSwitch EndFunc Func IsRock($CX, $CY) If $CX < 0 Or $CX >= $XTiles Then Return False If $CY < 0 Or $CY >= $YTiles Then Return False Switch $aLevel[$CY][$CX] Case $mTiles['Rock'], $mTiles['RockSocket'] Return True Case Else Return False EndSwitch EndFunc Func IsEmpty($CX, $CY) If $CX < 0 Or $CX >= $XTiles Then Return False If $CY < 0 Or $CY >= $YTiles Then Return False Switch $aLevel[$CY][$CX] Case $mTiles['None'] Return True Case Else Return False EndSwitch EndFunc Func IsEmptySocket($CX, $CY) If $CX < 0 Or $CX >= $XTiles Then Return False If $CY < 0 Or $CY >= $YTiles Then Return False Switch $aLevel[$CY][$CX] Case $mTiles['Socket'] Return True Case Else Return False EndSwitch EndFunc Func IsSocket($CX, $CY) If $CX < 0 Or $CX >= $XTiles Then Return False If $CY < 0 Or $CY >= $YTiles Then Return False Switch $aLevel[$CY][$CX] Case $mTiles['RockSocket'], $mTiles['Socket'] Return True Case Else Return False EndSwitch EndFunc Func JumpToLevel() Local $iLevel = InputBox('Jump to level', 'Please type the level that you want to play') If $iLevel And Int($iLevel) > 0 And Int($iLevel) <= $MaxLevel Then $CurrentLevel = $iLevel LoadLevel() DrawLevel() DrawBulldozer($mResources['Bulldozer' & $Direction]) PushToScreen() EndIf EndFunc Func LevelDone() For $j = 0 To $YTiles - 1 For $i = 0 To $XTiles - 1 If $aLevel[$j][$i] = $mTiles['Socket'] Then Return False Next Next Return True EndFunc Func NextLevel() $PlayTime += Int(TimerDiff($Start) / 1000) ShowMessage('Level ' & $CurrentLevel & ' completed.' & @CRLF & ' ', 'Solved in ' & $NumOfMoves & ' moves.' & @CRLF & 'Time: ' & FormatTime($PlayTime), 4000) If $CurrentLevel + 1 > $MaxLevel Then GameEnd() Else $CurrentLevel += 1 LoadLevel() DrawLevel() DrawBulldozer($mResources['Bulldozer' & $Direction]) PushToScreen() EndIf EndFunc Func LoadLevel() Local $Data = SQLite_Query($hDB, 'SELECT Data FROM levels WHERE Level = ' & $CurrentLevel) If @extended Then $Data = BinaryToString(Unpack($Data[1][0])) $Data = StringSplit($Data, @CRLF, 1) For $Line = 1 To $YTiles Local $Row = StringSplit($Data[$Line], '') For $Index = 1 To $Row[0] $aLevel[$Line - 1][$Index - 1] = $Row[$Index] Next Next $X = $Data[26] $Y = $Data[27] $Direction = $Data[28] ShowMessage('Level ' & $CurrentLevel) $NumOfMoves = 0 $PlayTime = 0 $Start = TimerInit() EndIf EndFunc Func RestartLevel() If $Pause Then Return LoadLevel() DrawLevel() DrawBulldozer($mResources['Bulldozer' & $Direction]) PushToScreen() EndFunc Func GameEnd() ShowMessage('Congratulations!' & @CRLF & @CRLF & 'You have finished the game.', Null, 4000) If $AutoRestart Then $CurrentLevel = 1 RestartLevel() Else Quit() EndIf EndFunc Func FormatTime($Sec) If $Sec < 60 Then Return $Sec & ' seconds' Local $Min = Int($Sec / 60) $Sec -= $Min * 60 If $Min > 60 Then Local $Hours = Int($Sec / 60) $Min -= $Hours * 60 Return $Hours & ' hour' & ($Hours > 1 ? 's' : '') & ($Min <> 0 ? ', ' & $Min & ' minute' & ($Min > 1 ? 's' : '') : '') & ($Sec <> 0 ? ', ' & $Sec & ' second' & ($Sec > 1 ? 's' : '') : '') Else Return $Min & ' minute' & ($Min > 1 ? 's' : '') & ($Sec <> 0 ? ', ' & $Sec & ' second' & ($Sec > 1 ? 's' : '') : '') EndIf EndFunc Func ShowMessage($Message, $SecMessage = Null, $iDelay = 1500) $MsgShow = True Local $hFamily = _GDIPlus_FontFamilyCreate($Font) Local $hFont = _GDIPlus_FontCreate($hFamily, $FontSize, 1) Local $tLayout = _GDIPlus_RectFCreate(0, 0, $XTiles * $TileSize, ($SecMessage ? ($YTiles * $TileSize / 2) : ($YTiles * $TileSize))) Local $hBrush = _GDIPlus_BrushCreateSolid($MessageColor) Local $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_StringFormatSetLineAlign($hFormat, ($SecMessage ? 2 : 1)) _GDIPlus_GraphicsClear($mResources['Graphics'], $ClearColor) _GDIPlus_GraphicsDrawStringEx($mResources['Graphics'], $Message, $hFont, $tLayout, $hFormat, $hBrush) If $SecMessage Then _GDIPlus_StringFormatSetLineAlign($hFormat, 0) Local $hSecFont = _GDIPlus_FontCreate($hFamily, $SecFontSize, 1) Local $tSecLayout = _GDIPlus_RectFCreate(0, ($YTiles * $TileSize / 2) , $XTiles * $TileSize, $YTiles * $TileSize / 2) Local $hSecBrush = _GDIPlus_BrushCreateSolid($SecMessageColor) _GDIPlus_GraphicsDrawStringEx($mResources['Graphics'], $SecMessage, $hSecFont, $tSecLayout, $hFormat, $hSecBrush) EndIf PushToScreen() _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_FontDispose($hFont) If $SecMessage Then _GDIPlus_BrushDispose($hSecBrush) _GDIPlus_FontDispose($hSecFont) EndIf _GDIPlus_FontFamilyDispose($hFamily) Local $DelayTimer = TimerInit() Do If GUIGetMsg() = -3 Then Quit() Sleep(10) Until TimerDiff($DelayTimer) >= $iDelay $MsgShow = False EndFunc Func UndoLastMove() If $PrevLevel = Null Then Return If $LastMove = Null Then Return If $Pause Then Return $aLevel = $PrevLevel DrawLevel() Switch $LastMove Case 'R' $X -= 1 DrawBulldozer($mResources['BulldozerR']) Case 'L' $X += 1 DrawBulldozer($mResources['BulldozerL']) Case 'U' $Y += 1 DrawBulldozer($mResources['BulldozerU']) Case 'D' $Y -= 1 DrawBulldozer($mResources['BulldozerD']) EndSwitch PushToScreen() $PrevLevel = Null $NumOfMoves -= 1 EndFunc Func Pause() $Pause = Not $Pause If $Pause Then $PlayTime += Int(TimerDiff($Start) / 1000) ShowMessage('Game is paused.', 'Press {Pause} button to resume your game.', 10) Else DrawLevel() DrawBulldozer($mResources['Bulldozer' & $Direction]) PushToScreen() $Start = TimerInit() EndIf Do Sleep(10) Until $Pause = False EndFunc Func DrawLevel() _GDIPlus_GraphicsClear($mResources['Graphics'], $ClearColor) For $j = 0 To $YTiles - 1 For $i = 0 To $XTiles - 1 Switch $aLevel[$j][$i] Case $mTiles['Wall1'] _GDIPlus_GraphicsDrawImageRect($mResources['Graphics'], $mResources['Wall1'], $i * $TileSize, $j * $TileSize, $TileSize, $TileSize) Case $mTiles['Wall2'] _GDIPlus_GraphicsDrawImageRect($mResources['Graphics'], $mResources['Wall2'], $i * $TileSize, $j * $TileSize, $TileSize, $TileSize) Case $mTiles['Wall3'] _GDIPlus_GraphicsDrawImageRect($mResources['Graphics'], $mResources['Wall3'], $i * $TileSize, $j * $TileSize, $TileSize, $TileSize) Case $mTiles['Wall4'] _GDIPlus_GraphicsDrawImageRect($mResources['Graphics'], $mResources['Wall4'], $i * $TileSize, $j * $TileSize, $TileSize, $TileSize) Case $mTiles['Wall5'] _GDIPlus_GraphicsDrawImageRect($mResources['Graphics'], $mResources['Wall5'], $i * $TileSize, $j * $TileSize, $TileSize, $TileSize) Case $mTiles['Wall6'] _GDIPlus_GraphicsDrawImageRect($mResources['Graphics'], $mResources['Wall6'], $i * $TileSize, $j * $TileSize, $TileSize, $TileSize) Case $mTiles['Wall7'] _GDIPlus_GraphicsDrawImageRect($mResources['Graphics'], $mResources['Wall7'], $i * $TileSize, $j * $TileSize, $TileSize, $TileSize) Case $mTiles['Wall8'] _GDIPlus_GraphicsDrawImageRect($mResources['Graphics'], $mResources['Wall8'], $i * $TileSize, $j * $TileSize, $TileSize, $TileSize) Case $mTiles['Rock'] _GDIPlus_GraphicsDrawImageRect($mResources['Graphics'], $mResources['Rock'], $i * $TileSize, $j * $TileSize, $TileSize, $TileSize) Case $mTiles['RockSocket'] _GDIPlus_GraphicsDrawImageRect($mResources['Graphics'], $mResources['RockSocket'], $i * $TileSize, $j * $TileSize, $TileSize, $TileSize) Case $mTiles['Socket'] _GDIPlus_GraphicsDrawImageRect($mResources['Graphics'], $mResources['Socket'], $i * $TileSize, $j * $TileSize, $TileSize, $TileSize) EndSwitch Next Next EndFunc Func DrawBulldozer($hImage) _GDIPlus_GraphicsDrawImageRect($mResources['Graphics'], $hImage, $X * $TileSize, $Y * $TileSize, $TileSize, $TileSize) EndFunc Func PushToScreen() Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($mResources['Bitmap']) _WinAPI_DeleteObject(GUICtrlSendMsg($hPic, 0x0172, 0, $hHBITMAP)) _WinAPI_DeleteObject($hHBITMAP) EndFunc Func ReadProperty($sProperty, $vFallback = Null) Local $aQuery = SQLite_Query($hDB, "SELECT Value FROM settings WHERE Property = " & _SQLite_FastEscape($sProperty)) If @extended Then Return $aQuery[1][0] Else Return $vFallback EndIf EndFunc Func GetTiles($vFallback = Null) Local $aQuery = SQLite_Query($hDB, 'SELECT Tile, Symbol, Data FROM tiles') If @extended Then Return $aQuery Else Return $vFallback EndIf EndFunc Func GetKeyboard($vFallback = Null) Local $aQuery = SQLite_Query($hDB, 'SELECT Key, Function FROM keyboard') If @extended Then Return $aQuery Else Return $vFallback EndIf EndFunc Func SQLite_Query($hDB, $sQuery) Local $aResult, $iRows, $iColumns _SQLite_GetTable2d($hDB, $sQuery, $aResult, $iRows, $iColumns) If @error Then Return SetError(1, 0, False) Else Return SetError(0, UBound($aResult, 1) - 1, $aResult) EndIf EndFunc Func Unpack($bData) Local $tData = DllStructCreate('byte Data[' & BinaryLen($bData) & ']') Local $bCode = Binary('0x8B7424048B4C2408AC347F8846FF4975F7C20800') Local $iSize = BinaryLen($bCode) Local $tCode = DllStructCreate('byte Code[' & $iSize & ']') DllStructSetData($tCode, 'Code', $bCode) DllStructSetData($tData, 'Data', $bData) DllCallAddress('int', DllStructGetPtr($tCode), 'ptr', DllStructGetPtr($tData), 'int', DllStructGetSize($tData)) Return DllStructGetData($tData, 'Data') EndFunc Have fun! Bulldozer.zip
    4 points
  44. Below, you will see how the Curl_Easy_Setopt function is defined in the UDF. If the value that is passed has a string data type, then the value is passed as a str (char *), all other data type values are passed as a ptr. In you original post, you are setting the POSTFIELDS value to the binary data in the variable ($sFileRead) when it is expecting a pointer to the binary data. Func Curl_Easy_Setopt($Handle, $Option, $Value) Return DllCall($g_hlibcurl, (@AutoItX64 ? "int" : "int:cdecl"), "curl_easy_setopt", "ptr", $Handle, "int", $Option, IsString($Value) ? "str" : "ptr", $Value)[0] EndFunc ;==>Curl_Easy_Setopt I don't have access to a WordPress site in order to test the example script below, but I think it is either correct or very close to being correct. Please give it a try and see if it works for you. If it doesn't, please show any responses and I'm sure I can help you get it working. The only real difference between the example script below and your original script is that it reads the image file data into a binary buffer and then passes a pointer to that buffer in the POSTFIELDS value. There are a couple other tweaks but they are not significant. Of course you will need to change the path to the UDF, the endpoint URL, username, and app password. #AutoIt3Wrapper_AU3Check_Parameters=-w 3 -w 4 -w- 5 -w 6 -d #include <Constants.au3> #include <cURL-Beege\curl.au3> ;<== Modify path as needed WordPress_Upload_Post_Example(@ScriptDir & "\hardware_store.jpg") Func WordPress_Upload_Post_Example($sImgFilePath) Local $tImgData = "" Local $sResponse = "" Local $iRespCode = 0, _ $iImgSize = FileGetSize($sImgFilePath) Local $hCurl = -1 Local $aHeaders[0] ;Validate image file size If $iImgSize = 0 Then Return MsgBox($MB_ICONERROR, "Error", "Input file is empty or does not exist.") ;Create a byte buffer for the image data and load the image file into it $tImgData = DllStructCreate(StringFormat("byte bytes[%i];", $iImgSize)) $tImgData.bytes = FileRead($sImgFilePath) ;Create an array of request headers $aHeaders = Curl_Slist_Append(0 , "Cache-Control: no-cache") $aHeaders = Curl_Slist_Append($aHeaders, "Content-Type: image/jpg") $aHeaders = Curl_Slist_Append($aHeaders, "Content-Disposition: attachment; filename=test.jpg") ;Set up and execute cURL request $hCurl = Curl_Easy_Init() If Not $hCurl Then Return MsgBox($MB_ICONERROR, "Error", "Curl_Easy_Init() failed.") Curl_Easy_Setopt($hCurl, $CURLOPT_URL , "https://www.mysite.com/wp-json/wp/v2/media") Curl_Easy_Setopt($hCurl, $CURLOPT_USERPWD , $WPAppUser & ':' & $WPAppPW) Curl_Easy_Setopt($hCurl, $CURLOPT_HTTPHEADER , $aHeaders) Curl_Easy_Setopt($hCurl, $CURLOPT_USERAGENT , "AutoIt/cURL") Curl_Easy_setopt($hCurl, $CURLOPT_SSL_VERIFYPEER , 1) Curl_Easy_setopt($hCurl, $CURLOPT_CAINFO , @ScriptDir & '\curl-ca-bundle.crt') ; Curl_Easy_Setopt($hCurl, $CURLOPT_ACCEPT_ENCODING, "") Curl_Easy_Setopt($hCurl, $CURLOPT_WRITEFUNCTION , Curl_DataWriteCallback()) Curl_Easy_Setopt($hCurl, $CURLOPT_WRITEDATA , $hCurl) Curl_Easy_Setopt($hCurl, $CURLOPT_FOLLOWLOCATION , 1) Curl_Easy_Setopt($hCurl, $CURLOPT_POSTFIELDS , DllStructGetPtr($tImgData)) Curl_Easy_Setopt($hCurl, $CURLOPT_POSTFIELDSIZE , DllStructGetSize($tImgData)) ;Get response code and response $iRespCode = Curl_Easy_Perform($hCurl) If $iRespCode <> $CURLE_OK Then Return ConsoleWrite("Status Message: " & Curl_Easy_StrError($iRespCode) & @LF) $sResponse = BinaryToString(Curl_Data_Get($hCurl)) ;Clean up curl environment Curl_Easy_Cleanup($hCurl) Curl_Data_Cleanup($hCurl) ;Display response ConsoleWrite($sResponse & @CRLF) EndFunc For the record, I'm not quite sure how/if $CURLOPT_SSL_VERIFYPEER and $CURLOPT_FOLLOWLOCATION are being set correctly since since their values are numeric data types. I didn't take a deep dive to see. But at first glance, it would seem to be interpreting those values as pointers. It may turn out that since the API is expecting a LONG, it is only reading the first 32 bits of what is being passed and interpreting it as a LONG (which would work I guess). In a 32-bit environment a LONG and a Ptr are the same size. Of course in a 64-bit environment a Ptr is 64 bits. So I guess the high order 32 bits are just getting truncated (or ignored). If it were my UDF, in the DllCall, I would set the data types of the option parameters to their expected data types. Actual cURL API declarations of the 3 options CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTFIELDS, char *postdata); CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_VERIFYPEER, long verify); CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FOLLOWLOCATION, long enable);
    4 points
  45. I don't have a folder with 10K files in it, but this works with 400 files, providing an array with each file in its own cell. Of course, you have to first select many files using Explorer, then run this code (even uncompiled) and handle the drop at your own pace. _ClipBoard_Open(0) Local $data = _ClipBoard_GetData($CF_HDROP) Local $bin = BinaryMid($data, 21, BinaryLen($data) - 24) Local $c, $s For $i = 1 To BinaryLen($bin) Step 2 $c = BinaryMid($bin, $i, 2) $s &= ($c <> 0 ? ChrW($c) : "|") Next $aFiles = StringSplit($s, "|", 3) _ArrayDisplay($aFiles) ; Close the clipboard _ClipBoard_Close()
    4 points
  46. Hello, This is my first post here although I've been using Autoit for around 5 years. Several years ago I started looking for a template to make Invoicing software in Autoit. For PDF generation I ran across MIPDF by Mihai Iancu and it works great. So I am including that along with the Invoice template that I created. I hope you all enjoy it and take it further than me and make a full featured personal financial manager in Autoit! Autoit Invoicing.zip
    4 points
  47. Hi all, I am happy to introduce my latest AutoIt hobby project. Glance. It is a gui library created with windows api functions. Back end of this library is a dll file created in Nim programming language. So you have to place the dll near to your exe. Here is a screenshot. Please see the image. And here is the sample code for the window in the image. #AutoIt3Wrapper_UseX64=y #include "glance.au3" Local $frm = glf_NewForm("My Autoit window in Nim", 1100, 500) ; Create new Form aka Window glf_FormCreateHwnd($frm) ; Create the form's handle Local $mbar = glf_FormAddMenuBar($frm, "File|Edit|Help") ; Create a menubar for this form glf_FormAddMenuItems($frm, "File", "New Job|Remove Job|Exit") ; Add some sub menus for 'File' & 'Edit' menus glf_FormAddMenuItems($frm, "Edit", "Format|Font") glf_FormAddMenuItems($frm, "New Job", "Basic Job|Intermediate Job|Review Job") ; Add some submenus to 'New Job' glf_MainMenuAddHandler($frm, "Basic Job", $gMenuEvents.onClick, "menuClick"); Add an event handler for 'Basic Job' Local $btn1 = glf_NewButton($frm, "Normal", 15) ; Now create some buttons Local $btn2 = glf_NewButton($frm, "Flat", 127) Local $btn3 = glf_NewButton($frm, "Gradient", 240) glf_ControlSetProperty($btn2, $gControlProps.backColor, 0x90be6d) ; Set back color property glf_ButtonSetGradient($btn3, 0xf9c74f, 0xf3722c) ; make this button gradient glf_ControlAddHandler($btn1, $gControlEvents.onClick, "onBtnClick") ; Add an event handler for btn1 Local $cal = glf_NewCalendar($frm, 15, 70) ; A simple calendar control. Local $cb1 = glf_NewCheckBox($frm, "Compress", 40, 280) ; Create two checkboxes Local $cb2 = glf_NewCheckBox($frm, "Extract", 40, 310) glf_ControlSetProperty($cb2, $gControlProps.foreColor, 0xad2831) ; Set the checked property to True Local $cmb = glf_NewComboBox($frm, 350, 25) ; Create new ComboBox glf_ComboAddRange($cmb, "Windows|Linux|Mac|ReactOS") ; Add some items. You can use an array also glf_ControlSetProperty($cmb, $gControlProps.backColor, 0x68d8d6) ; Set the back color Local $dtp = glf_NewDateTimePicker($frm, 350, 72) ; Create new DateTimePicker aka DTP Local $gb = glf_NewGroupBox($frm, "My Groupbox", 25, 245, 150, 100) ; Create new GroupBox glf_ControlSetProperty($gb, $gControlProps.foreColor, 0x1a659e) ; Set the fore color Local $lbl = glf_NewLabel($frm, "Static Label", 260, 370) ; Create a Label glf_ControlSetProperty($lbl, $gControlProps.foreColor, 0x008000) ; Set the fore color Local $lbx = glf_NewListBox($frm, 500, 25) ; Create a ListBox glf_ListBoxAddRange($lbx, "Windows|Linux|Mac OS|ReactOS") ; Add some items glf_ControlSetProperty($lbx, $gControlProps.backColor, 0xffc2d4); Set the back color Local $lv = glf_NewListView($frm, 270, 161, 330, 150) ; Create a ListView glf_ListViewSetHeaderFont($lv, "Gabriola", 18) ; Set header font glf_ControlSetProperty($lv, $gListViewProps.headerHeight, 32) ; Set header height glf_ControlSetProperty($lv, $gListViewProps.headerBackColor, 0x2ec4b6) ; Set header back color glf_ControlSetProperty($lv, $gControlProps.backColor, 0xadb5bd) ; Set list view back color glf_ListViewAddColumns($lv, "Windows|Linux|Mac OS", "0") ; Add three columns glf_ListViewAddRow($lv, "Win 8|Mint|OSx Cheetah") ; Add few rows glf_ListViewAddRow($lv, "Win 10|Ubuntu|OSx Catalina") glf_ListViewAddRow($lv, "Win 11|Kali|OSx Ventura") Local $cmenu = glf_ControlSetContextMenu($lv, "Forums|General|GUI Help|Dev Help") ; Add a context menu to list view Local $np1 = glf_NewNumberPicker($frm, 385, 114) ; Create two new NumberPicker aka Updown control Local $np2 = glf_NewNumberPicker($frm, 300, 114) glf_ControlSetProperty($np2, $gNumberPickerProps.buttonLeft, True) ; Set the buttons position to left. Default is right glf_ControlSetProperty($np2, $gControlProps.backColor, 0xeeef20) ; Set back color glf_ControlSetProperty($np2, $gNumberPickerProps.decimalDigits, 2) ; Set the decimal precision to two glf_ControlSetProperty($np2, $gNumberPickerProps.stepp, 0.25) ; Set the step value to 0.25 Local $pgb = glf_NewProgressBar($frm, 25, 363) ; Create a progressbar glf_ControlCreateHwnd($pgb) glf_ControlSetProperty($pgb, $gProgressBarProps.value, 30) ; Set the value to 30% glf_ControlSetProperty($pgb, $gProgressBarProps.showPercentage, True) ; We can show the percentage in digits Local $rb1 = glf_NewRadioButton($frm, "Compiled", 655, 25) ; Create new RadioButtons Local $rb2 = glf_NewRadioButton($frm, "Interpreted", 655, 55) glf_ControlSetProperty($rb1, $gRadioButtonProps.checked, True) ; Set one of them checked Local $tb = glf_NewTextBox($frm, "Some text", 270, 326, 150) ; Create a new TextBox glf_ControlSetProperty($tb, $gControlProps.foreColor, 0xd80032) ; Set the foreColor Local $tkb1 = glf_NewTrackBar($frm, 760, 351) ; Create new TrackBars Local $tkb2 = glf_NewTrackBar($frm, 540, 351) glf_ControlSetProperty($tkb1, $gTrackBarProps.customDraw, True) ; If set to True, we can change lot of aesthetic effects glf_ControlSetProperty($tkb2, $gTrackBarProps.customDraw, True) glf_ControlSetProperty($tkb1, $gTrackBarProps.showSelRange, True) ; We can see the selection are in different color. glf_ControlSetProperty($tkb2, $gTrackBarProps.ticColor, 0xff1654) ; Set tic color ; glf_ControlSetProperty($tkb2, $gTrackBarProps.channelColor, 0x006d77) ; Set channel color. Local $tv = glf_NewTreeView($frm, 760, 25, 0, 300) ; Create new TreeView glf_ControlSetProperty($tv, $gControlProps.backColor, 0xa3b18a) ; Set back color glf_ControlCreateHwnd($tv) glf_TreeViewAddNodes($tv, "Windows|Linux1|MacOS|ReactOS" ) ; Add some nodes glf_TreeViewAddChildNodes($tv, 0, "Win 7|Win 8|Win 10|Win 11") ; Add some child nodes glf_TreeViewAddChildNodes($tv, 1, "Mint|Ubuntu|Red Hat|Kali") glf_TreeViewAddChildNodes($tv, 2, "OSx Cheetah|OSx Leopard|OSx Catalina|OSx Ventura") func onBtnClick($c, $e) ; $c = sender of this event aka, the button itself. $e = EventArgs, like in .NET print("Calendar view mode", glf_ControlGetProperty($cb1, $gControlProps.width)) EndFunc func menuClick($m, $e) ; Here $m is menu itself. $e is MenuEventArgs print("Menu clicked", $m) EndFunc glf_FormShow($frm.ptr) ; All set, just show the form You can get the files from my git repo. Here is the link https://github.com/kcvinker/Glance.git
    4 points
  48. I think we all agree, even OP, that the more knowledge one has, the better. While it's not mandatory, the more knowledge you have, the more interesting things you can do and create on your own. Sure if someone else does it for you then it's easier, but it's not the same thing... "Knowledge makes you free" (Socrates)
    4 points
  49. Updated zip in the first post with a couple bug fixes and updates. I created my own sort of build process to streamline new releases, so let me know if I missed anything in the zip. FIXED: Bug when resizing the Code Generation window FIXED: Bug control randomly disappears FIXED: More seamless positioning of resize handles when crossing zero FIXED: Code preview was not always updating ADDED: New property "Image" for Icon and Pic controls with selection dialog UPDATED: Smaller tab width in code preview
    4 points
  50. The example below works in 32 bit and 64 bit environments. INPUT is a struct that contains a union. Since the original post only asked about keyboard input, I did not include what the MOUSEINPUT and HARDWAREINPUT unions would look like. There are alignment issues that have to be taken into account when running 32 bit or 64 bit. The example shows one way of handling it. #AutoIt3Wrapper_AU3Check_Parameters=-w 3 -w 4 -w 5 -w 6 -d ;~ #AutoIt3Wrapper_UseX64=N #include <Constants.au3> #include <Array.au3> #include <WinAPIDiag.au3> Enum Step *2 _ $KEYEVENTF_EXTENDEDKEY = 1, _ $KEYEVENTF_KEYUP, _ $KEYEVENTF_UNICODE, _ $KEYEVENTF_SCANCODE Const $INPUT_KEYBOARD = 1 Const $VK_SHIFT = 0x10 Const $VK_A = 0x41 Const $tagKeyInput = _ "dword type;" & _ (@AutoItX64 ? "byte alignment_pad[4];" : "") & _ "struct;" & _ " word wVk;" & _ " word wScan;" & _ " dword dwFlags;" & _ " dword time;" & _ " ulong_ptr dwExtraInfo;" & _ " byte reserved[8];" & _ "endstruct;" example() Func example() #cs ========================================================= Using the SendInput win32 API, this example sends "AbC" to the last active notepad instance (if it exists). Note: "A" is sent by using virtual key code and "C" is sent using a scan code. It was done just to show the 2 different ways of sending keyboard input. #ce ========================================================= Local $tKeyInput, _ $tInputArray Local $aResult Local $iNumberOfInputs = 8 ;Create a struct to get size $tKeyInput = DllStructCreate($tagKeyInput) ;Create an inputs array buffer $tInputArray = DllStructCreate(StringFormat("byte bytes[%i];", DllStructGetSize($tKeyInput) * $iNumberOfInputs)) ;Load input array[0] $tKeyInput = DllStructCreate($tagKeyInput, DllStructGetPtr($tInputArray) + (0 * DllStructGetSize($tKeyInput))) $tKeyInput.type = $INPUT_KEYBOARD $tKeyInput.wVk = $VK_SHIFT ;Load input array[1] $tKeyInput = DllStructCreate($tagKeyInput, DllStructGetPtr($tInputArray) + (1 * DllStructGetSize($tKeyInput))) $tKeyInput.type = $INPUT_KEYBOARD $tKeyInput.wVk = $VK_A ;Load input array[2] $tKeyInput = DllStructCreate($tagKeyInput, DllStructGetPtr($tInputArray) + (2 * DllStructGetSize($tKeyInput))) $tKeyInput.type = $INPUT_KEYBOARD $tKeyInput.wvk = $VK_A $tKeyInput.dwFlags = $KEYEVENTF_KEYUP ;Load input array[3] $tKeyInput = DllStructCreate($tagKeyInput, DllStructGetPtr($tInputArray) + (3 * DllStructGetSize($tKeyInput))) $tKeyInput.type = $INPUT_KEYBOARD $tKeyInput.wVk = $VK_SHIFT $tKeyInput.dwFlags = $KEYEVENTF_KEYUP ;Load input array[4] $tKeyInput = DllStructCreate($tagKeyInput, DllStructGetPtr($tInputArray) + (4 * DllStructGetSize($tKeyInput))) $tKeyInput.type = $INPUT_KEYBOARD $tKeyInput.wScan = AscW("b") $tKeyInput.dwFlags = $KEYEVENTF_UNICODE ;Load input array[5] $tKeyInput = DllStructCreate($tagKeyInput, DllStructGetPtr($tInputArray) + (5 * DllStructGetSize($tKeyInput))) $tKeyInput.type = $INPUT_KEYBOARD $tKeyInput.wScan = AscW("b") $tKeyInput.dwFlags = $KEYEVENTF_UNICODE + $KEYEVENTF_KEYUP ;Load input array[6] $tKeyInput = DllStructCreate($tagKeyInput, DllStructGetPtr($tInputArray) + (6 * DllStructGetSize($tKeyInput))) $tKeyInput.type = $INPUT_KEYBOARD $tKeyInput.wScan = AscW("C") $tKeyInput.dwFlags = $KEYEVENTF_UNICODE ;Load input array[7] $tKeyInput = DllStructCreate($tagKeyInput, DllStructGetPtr($tInputArray) + (7 * DllStructGetSize($tKeyInput))) $tKeyInput.type = $INPUT_KEYBOARD $tKeyInput.wScan = AscW("C") $tKeyInput.dwFlags = $KEYEVENTF_UNICODE + $KEYEVENTF_KEYUP ;Activate notepad window If Not WinActivate("[CLASS:Notepad]") Then Exit MsgBox($MB_ICONERROR, "WinActivate Error", "Notepad window not found.") ;Send input $aResult = DllCall('user32.dll', 'uint', 'SendInput', _ 'uint' , $iNumberOfInputs, _ 'struct*', $tInputArray, _ 'int' , DllStructGetSize($tKeyInput)) If $aResult[0] = 0 Then MsgBox(0, "GetLastError", _WinAPI_GetLastErrorMessage()) EndFunc
    4 points
×
×
  • Create New...