Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation since 03/06/2025 in Posts

  1. If you want the text scrolling to continue even when you drag the GUI or even when an MsgBox() is in action, you can use _WinAPI_SetTimer instead of AdlibRegister, as in this slightly modified version of your script. ... But if you don't care, then forget it ... #include <GUIConstants.au3> #include <WinAPISysWin.au3> $guiWidth = 300 $hGUI = GUICreate("Main GUI", $guiWidth, 70) $sString = "This is a long string that scrolls smoothly and infinitely in a short label control." ; Create a child GUI for scrolling label $iMargin = 10 $sGap = " " $iLabelWidth = $guiWidth - $iMargin * 2 $hChildGUI = GUICreate("", $iLabelWidth, 20, 10, 10, $WS_CHILD, -1, $hGUI) GUISetFont(12, 400, 0, "Arial") ; Create a label wide enough to hold a long string without truncation $idLabel = GUICtrlCreateLabel($sString, 0, 0, 2000, 20, BitOR($SS_NOPREFIX, $SS_LEFTNOWORDWRAP)) ; Get the string width $tmpLabel = GUICtrlCreateLabel($sString, 0, 0, -1, 20, BitOR($SS_NOPREFIX, $SS_LEFTNOWORDWRAP)) $iStringWidth = ControlGetPos($hChildGUI, "", $tmpLabel)[2] - 9 ; Label is wider than the string width by 9 pixels GUICtrlDelete($tmpLabel) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hChildGUI) ; Update the label data if the string width is larger than the label width If $iStringWidth > $iLabelWidth Then GUICtrlSetData($idLabel, $sString & $sGap & $sString) $iScrollPos = 0 $iMarquee = 0 $iScrollDelay = 40 ; AdlibRegister("_Marquee", $iScrollDelay) ; -- setup timer-- Local $hTimerProc = DllCallbackRegister('_Marquee', 'none', 'hwnd;uint;uint_ptr;dword') Local $iTimerID = _WinAPI_SetTimer(0, 0, $iScrollDelay, DllCallbackGetPtr($hTimerProc)) ; ---------------- EndIf MsgBox(64, "Info", "text scrolls") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; -- clean timer-- _WinAPI_KillTimer(0, $iTimerID) DllCallbackFree($hTimerProc) ; ---------------- Func _Marquee($hWnd, $iMsg, $iTimerID, $iTime) #forceref $hWnd, $iMsg, $iTimerID, $iTime $iMarquee += 1 If $iMarquee < 3000 / $iScrollDelay Then Return ; 3 seconds of halt when $sString comes to the initial position $iScrollPos -= 1 If - $iScrollPos = $iStringWidth + StringLen($sGap) * 4 Then ; Initialize the $idLabel's position $iMarquee = 0 $iScrollPos = 0 EndIf GUICtrlSetPos($idLabel, $iScrollPos, 0) EndFunc ;==>_Marquee
    4 points
  2. I will check deeply next few days ... don't call the wolf out of the forest
    3 points
  3. This concept was used in my zPlayer to display long file names in a short label control. #include <GUIConstants.au3> $guiWidth = 300 $hGUI = GUICreate("Main GUI", $guiWidth, 70) $sString = "This is a long string that scrolls smoothly and infinitely in a short label control." ; Create a child GUI for scrolling label $iMargin = 10 $sGap = " " $iLabelWidth = $guiWidth - $iMargin * 2 $hChildGUI = GUICreate("", $iLabelWidth, 20, 10, 10, $WS_CHILD, -1, $hGUI) GUISetFont(12, 400, 0, "Arial") ; Create a label wide enough to hold a long string without truncation $idLabel = GUICtrlCreateLabel($sString, 0, 0, 2000, 20, BitOR($SS_NOPREFIX, $SS_LEFTNOWORDWRAP)) ; Get the string width $tmpLabel = GUICtrlCreateLabel($sString, 0, 0, -1, 20, BitOR($SS_NOPREFIX, $SS_LEFTNOWORDWRAP)) $iStringWidth = ControlGetPos($hChildGUI, "", $tmpLabel)[2] - 9 ; Label is wider than the string width by 9 pixels GUICtrlDelete($tmpLabel) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hChildGUI) ; Update the label data if the string width is larger than the label width If $iStringWidth > $iLabelWidth Then GUICtrlSetData($idLabel, $sString & $sGap & $sString) $iScrollPos = 0 $iMarquee = 0 $iScrollDelay = 40 AdlibRegister("_Marquee", $iScrollDelay) EndIf Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func _Marquee() $iMarquee += 1 If $iMarquee < 3000/$iScrollDelay Then Return ; 3 seconds of halt when $sString comes to the initial position $iScrollPos -= 1 If -$iScrollPos = $iStringWidth + StringLen($sGap) * 4 Then ; Initialize the $idLabel's position $iMarquee = 0 $iScrollPos = 0 EndIf GUICtrlSetPos($idLabel, $iScrollPos, 0) EndFunc
    2 points
  4. FYI, I tested on other computers. Older computer reacts correctly as it should be expected. Faster (more recent) computer behave exactly as I am experiencing. So this is not related to my own computer. It seems to be another of those timing issues with AutoIt. Sadly not the first, not the last... For those who face the same problem as I have, here a simple solution : #include <GUIConstants.au3> #include <Constants.au3> Example() Func Example() Local $hGUI = GUICreate("Main GUI", 300, 70) GUISetState() Sleep(100) Local $hGUI2 = GUICreate("", 280, 30, 10, 10, $WS_CHILD, -1, $hGUI) GUISetFont(11) Local $idLabel = GUICtrlCreateLabel("This is a test", 0, 0, 100, 30) GUISetState() MsgBox($MB_OK, "", "Test") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>Example Slow down the creation of child GUI by putting a Sleep in between. It is working on all computers correctly now.
    2 points
  5. Understand what you mean now. Here a new version with no flickers. It uses a similar approach of yours. #include <GUIConstants.au3> Local $hGUI = GUICreate("Main GUI", 300, 70) Local $sString = "This is a long string that scrolls smoothly and infinitely without flickers..." GUISetState() Global $iLen = StringLen($sString) * 6.5 ; <<<<< adjust as needed or use M23 UDF StringSize for more precision Local $hGUI2 = GUICreate("", 280, 30, 10, 10, $WS_CHILD, $WS_EX_COMPOSITED, $hGUI) GUISetFont(11) Global $idLabel1 = GUICtrlCreateLabel($sString, 0, 0, $iLen, 30, $SS_LEFTNOWORDWRAP) Global $idLabel2 = GUICtrlCreateLabel($sString, $iLen, 0, $iLen, 30, $SS_LEFTNOWORDWRAP) GUISetState() AdlibRegister(Scroll, 25) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func Scroll() Local Static $iPos = 0 $iPos -= 1 If -$iPos >= $iLen Then $iPos = 0 GUICtrlSetPos($idLabel1, $iPos) GUICtrlSetPos($idLabel2, $iLen + $iPos) EndFunc
    2 points
  6. Nice mate. its possible to reduce the flicker a bit by double buffering. So hope you don't mind - but here's another approach #include <GUIConstants.au3> #include <GDIPlus.au3> #include <WinAPI.au3> Global $iGUIWidth = 300 Global $hGUI = GUICreate("Main GUI", $iGUIWidth, 70) Global $sString = "This is a long string that scrolls smoothly and infinitely in a short label control." Global $iLabW = $iGUIWidth - 8, $iLabH = 30 ;The border style is here to mark the label boundry - for demo purposes! Global $hLabel = GUICtrlCreateLabel("", 4, 4, $iGUIWidth - 8, $iLabH, $WS_BORDER) GUISetState() Global $hLabGraphic, $hBuffGraphic, $hBuffBitMap Global $hBrush, $hFormat, $tLayout, $hFamily, $hFont, $iBkColour _GDIPlus_Startup() ;Graphic of the static control - its possible to draw directly to this, but we'll introduce flicker. $hLabGraphic = _GDIPlus_GraphicsCreateFromHWND(GUICtrlGetHandle($hLabel)) ;Create Buffer - Draw to this. Copy to the label once the image is complete. $hBuffBitMap = _GDIPlus_BitmapCreateFromGraphics($iLabW, $iLabH, $hLabGraphic) $hBuffGraphic = _GDIPlus_ImageGetGraphicsContext($hBuffBitMap) ;Create font etc.. $hBrush = _GDIPlus_BrushCreateSolid(0xFFAA0000) ;ARGB $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, 12, 3) ;Size, Italic + Bold $iBkColour = BitOR(0xFF000000, _WinAPI_GetSysColor($COLOR_3DFACE)) ;dialog background colour. ; ----- Find dims of the text. --------- Global $iMargin = 4 $tLayout = _GDIPlus_RectFCreate($iMargin, 0, 1, 1) ;Text rectangle. Margin of 4 from left Local $aStrMeasure[4] ;Expand height until we can fit 2 lines ;Sanity checks are required here! This'll break if there's < 2 printable characters in the string. Do $tLayout.Height += 1 $aStrMeasure = _GDIPlus_GraphicsMeasureString($hLabGraphic, $sString, $hFont, $tLayout, $hFormat) Until $aStrMeasure[2] = 2 $tLayout.Height -= 1 ; Gets us the max height of 1 line. ;Expand width until we can fit the entire string. Do $tLayout.Width += 1 $aStrMeasure = _GDIPlus_GraphicsMeasureString($hLabGraphic, $sString, $hFont, $tLayout, $hFormat) Until $aStrMeasure[1] = StringLen($sString) ;Center vertically in the label $tLayout.Y = Floor(($iLabH - $tLayout.Height)/2) ConsoleWrite(StringFormat("text dims: [%d, %d, %d, %d]\r\n", $tLayout.X, $tLayout.Y, $tLayout.Width, $tLayout.Height)) ;-------------------------------------- ;Initial write to label - cause I'm too lazy to fix scrolling logic! _GDIPlus_GraphicsDrawStringEx($hLabGraphic, $sString, $hFont, $tLayout, $hFormat, $hBrush) Local $hTimer = TimerInit(), $iShift = 3 ; $iShift = Pos shift on each iteration. While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop ;Pause at string start. If TimerDiff($hTimer) < 2000 Then ContinueLoop ;wipe buffer _GDIPlus_GraphicsClear($hBuffGraphic, $iBkColour) ;Redraw the string at new position. $tLayout.X -= $iShift If ($tLayout.X + $tLayout.Width) < 0 Then ;If we've fallen off the label.. $tLayout.X = $iMargin ;Start at our initial position $hTimer = TimerInit() EndIf _GDIPlus_GraphicsDrawStringEx($hBuffGraphic, $sString, $hFont, $tLayout, $hFormat, $hBrush) ;Copy the buffer to the label _GDIPlus_GraphicsDrawImageRect($hLabGraphic, $hBuffBitMap, 0, 0, $iLabW, $iLabH) Sleep(40) WEnd ;Cleanup _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hBuffGraphic) _GDIPlus_ImageDispose($hBuffBitMap) _GDIPlus_GraphicsDispose($hLabGraphic) _GDIPlus_Shutdown() GUIDelete($hGUI)
    2 points
  7. Current Beta should add Include files required by the Master script, ignoring when they are included through an Include file. This is cleaner and less dependent on possible changes in the Includes.
    2 points
  8. No issue, so we would want Tidy to respect that when not ran from SciTE. I have uploaded a Beta version that checks how the program is shelled and will Indent linecomments when not ran from SciTE.
    2 points
  9. WildByDesign

    ACL Viewer

    ACL Viewer (WildByDesign/ACLViewer: ACL Viewer for Windows) This would not have been possible without the amazing support from this forum. I received so much great help and I am thankful. I wanted to give back to the community by sharing what I have come up with. I overcame a lot of challenges. So I am hoping that this (or parts of this) may benefit others. I have other AutoIt-created programs on my GitHub also which I will likely share here in the forum when I have more time to get all the information together. Screenshot: Features: automatic dark mode / light mode depending on system theme settings treeview for selecting files/folders for viewing ACLs listview for displaying parsed ACEs custom ACCESS_MASK parser listviews for displaying permissions with checkboxes Includes: TreeListExplorer by @Kanashius DarkMode UDF originally by @NoNameCode, updated by @argumentum GUIFrame UDF by @Melba23 ACL Permissions UDF originally by @FredAI, updated by @AdamUL There are other functions within the code that I received incredible help on from the forum and I added credits and links within the code.
    2 points
  10. Generally respecting the indentation when commenting or un-commentating a line seems like the best approach in my opinion. Doing it like in SciTE, gives issues, when you want to indent a section containing an out-commented line of code, where with vscode the identation is no issue and un-commentating the line later, does not produce the same possible problems.
    2 points
  11. Well i am actually in favor of including the files required in the master itself and not depend on a possible include in the included file. There is no real clutter as the udf and constant file have a #include_once in them. I probably will change the default and can make it a choice like I've done in the dynamic lua stuff.
    2 points
  12. water

    Need some help with base32

    What do you expect when you encode AND decode at the same time?
    1 point
  13. Open just re-opens the current file at the moment, need to implement a good save and open function soon (work in progress) thanks btw!
    1 point
  14. I tested different delays, and 100 was working for all computers.
    1 point
  15. All, I see that there are multiple efforts to create/maintain an AutoIt3 Visual Studio Code extension, and I would like to open a discussion to see how that can be streamlined/merged/done more effectively so we can come up with the one that's preferred. I have been toying with the idea to stop the development of all the LUA extra's used by SciTE and start using VSCode for the more advanced way of developing AutoIt3 scripts, as many things a way after when the extension supports it, like running au3check on save so you just click the problems tab to see the warnings/errors of the currently opened scripts. So I have been working on making the utilities packaged with SciTE4AutoIt3 suitable to run stand-alone without the need for wrapping them with AutoIt3Wrapper, with the plan to be able to make them all more generic usable for any editor. They need to support UTF8 & ANSI encoded files, even when through includes the encoding is mixed. I have modified AutoIt3Wrapper to stop renaming and changing encoding of script/include files, and updated Tidy/Au3check/Au3stripper to support special characters in filenames and mixed ANSI/UTF8 file encoding and the generated console output is UTF8. I have been toying a bit with the VSCODE extension maintained by Damian (just picked one without looking at any others) and made some modifications locally for testing. Run au3check (Ctrl+F5), Tidy (Ctrl+t), Au3Stripper (Ctrl+Shift+o) without using AutoIt3Wrapper. Other already standardly available option (Run/Compile) still run via AutoIt3Wrapper as there is an added value doing it that way. I really like what I see and think this is a good way forward. So... I like to hear how you all think about this and possibly your preferred VSCode autoIt3 extension with reasons why. Also feels as a waste of effort when so many are making their own version of an extension instead of bundling the effort making one really nice one with all required features. Thoughts/Opinions?
    1 point
  16. @WildByDesign Thank you very much for the praise, I am glad you like it :). And thanks for finding the bug, I fixed it. It was a missing check for $sPath="" in __TreeListExplorer__OpenPath when checking if the path is a file (and then splitting it), that did overwrite the $sSelect to empty. I also checked, if it is possible to select multiple files/folders, which is working with ListViews and not causing any problems. So I added that to the example. (It looks like it is not possible to enable multiselection for TreeViews, if I did not overlook something... Only thing I saw was enabling checkboxes).
    1 point
  17. Thanks I would test that.
    1 point
  18. @WildByDesign I made up my mind and removed the single click expand/collapse. It is now done with a double click. This makes the managing of the selection a lot easier. It is now possible to select folders in the TreeView :). I used the change to adjust the callback parameters to include the selection and added some additional information that was missing (selected index/item handle for clicks; The current path when loading).
    1 point
  19. $WS_EX_COMPOSITED seems to help reduce flickers when the adlib time is set to 25. When the time is set to 40, it doesn't seem to help. Maybe it's due to my bad eye sights. Thanks for the hint anyway. As to the string size, creating a temporary label with width set to -1 seems to give precise width. I tried it with diferrent languages and different font weights, and so far, I am happy with the results. According to my observations, the label width is always 9 pixels longer than the actual string size.
    1 point
  20. I have not checked Logan's extension, but in mine i have not yet implemented any folding information provider 😉
    1 point
  21. Here my take on it : #include <GUIConstants.au3> Local $hGUI = GUICreate("Main GUI", 300, 70, -1, -1, -1, $WS_EX_COMPOSITED) Global $sString = "This is a long string that scrolls smoothly and infinitely in a short label control." Global $idLabel = GUICtrlCreateLabel("", 10, 10, 280, 30, $SS_LEFTNOWORDWRAP) GUICtrlSetFont(-1, 11) $sString &= " " ; pad with space GUICtrlSetData($idLabel, $sString) GUISetState() AdlibRegister(Scroll, 150) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func Scroll() Local Static $iPos = 0, $sScroll = $sString, $iLen = StringLen($sString) $iPos = Mod($iPos, $iLen) + 1 $sScroll = StringTrimLeft($sScroll, 1) & StringMid($sString, Mod($iPos - 1, $iLen) + 1, 1) GUICtrlSetData($idLabel, $sScroll) EndFunc No flicker on my side...
    1 point
  22. Not sure I understand what you are asking. \fs17 means a font size. \par is for paragraph. (notice it is a back slash, not a slash) The code I suggested simply remove the last \par. There is no harm to have a font size at the end. If you want to learn about rtf encoding, you can refer to this.
    1 point
  23. Uploaded an Updated SciTE4AutoIt3_vsc.exe installer with the changes made since the previous version: 10-3-2025 *** Merged the SciTE v 5.5.5 by Neil Hodgson with our own version of SciTE. (Jos) *** Updated Au3Stripper v25.205.1420.x (Jos) - 25.205.1420.1 Fixed: / changed ANSI & UTF8 detection and convert all to utf8 in the outputfile (8/03/2025) - 25.205.1420.3 Added: /AS /Aut2exeSource option which will generate a sourcefile as included at compilation time (9/03/2025) *** Updated AutoIt3Wrapper v25.205.1420.x (Jos) - 25.205.1420.1 Disable HotKey Error when defined as "" in INI (10/02/2025) - 25.205.1420.7 Update addinclude function (4/03/2025) - 25.205.1420.8 Will now add any required UDF or Var includefile required by the Master, ignoring lower recursive level checking (9/03/2025) *** Updated SciTE/Lua/ (Jos) - Merged Header changes from donnyh13 back into AutoIttools.lua (10/02/2025) - Changed: Dir command so it will also list filenames with special characters. (10/02/2025) *** Updated SciTEConfig v25.205.1420.x (Jos) - 25.205.1420.1 Added: Toggle between SciTE & VSCode (7/02/2025) *** Updated Tidy v25.205.1420.x (Jos) - 25.205.1420.1 Change Indentation of linecomments to indent the same as the other lines, when not ran from SciTE.
    1 point
  24. I update SciTE w/newer beta files with this script so otherwise it brakes my automation 😅
    1 point
  25. Thanks... fixed in Beta downloads, but is really not needed to download as the installer only updates au3check.exe to support the mixed encoding, but will use the available au3check.dat.
    1 point
  26. The new Au3Check.dat is missing data ( Maps, SetExitCode, etc. ) Fixed
    1 point
  27. I'm a dummy, I thought I was using your extension! I am now though .. I'll let you know how it goes!
    1 point
  28. argumentum

    ACL Viewer

    ... today I was telling a neighbor about a project her husband was doing and told her about material aging and fatigue but that I don't correct people that much anymore because with time they end up learning and doing, one failure at the time The WiKi as this "Best coding practices" and is a good read. The way that I lean a lot is reading and messing with the UDFs that come with AutoIt. Still I read old code of mine and ask myself "why ?, why this way !" because with time I learned to better structure code. The kind of thing that people like @Nine say. Your current version is functional and that is good. If you code it as if it was to be a UDF that you later add a GUI to, better
    1 point
  29. Nine

    ACL Viewer

    Personally I dislike declaring variables between includes. It should be declared inside the included file. All UDF should be auto-sufficient. No offense. edit : if you need to share a global variable between UDF, the source UDF should provide a function to retrieve that variable instead of relying on the knowledge of a variable name...
    1 point
  30. Uploaded a new beta version with several changes to how special ANSI characters are detected and any master or include file containing ANSI characters will be converted to UTF8.
    1 point
  31. argumentum

    ACL Viewer

    ... #include <Misc.au3> Global $isDarkMode = False Global $sRet, $aRet, $newItem, $oldItem, $isFolder, $aUniques, $TV_Icons #include "include\GUIFrame.au3" ... would solve that. But also: ;~ isDarkMode() ;~ Func isDarkMode() ;~ Global $isDarkMode = _WinAPI_ShouldAppsUseDarkMode() ;~ EndFunc ;==>isDarkModeisDarkMode() ;------------------------------------------------------------- ;~ Global $isDarkMode = isDarkMode() ;~ Func isDarkMode() ;~ Return _WinAPI_ShouldAppsUseDarkMode() ;~ EndFunc ;==>isDarkMode ;------------------------------------------------------------- Global $isDarkMode = _WinAPI_ShouldAppsUseDarkMode() ;------------------------------------------------------------- this could be simplified. Using #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 would force you to confront these things. At one year old ( you joined less than a year ago ), your script is better than I ever did at 1 year old. Thanks for sharing @WildByDesign
    1 point
  32. Nine

    ACL Viewer

    Got this error in GUIFrame :
    1 point
  33. The _arraydisplay shouldn't happen and is there for my debugging during development, fixed that in the current version of the preview. Does au3check tell you all is fine, or do you get an error? Reason for the question is that currently, in case the #include file is already included through another include, it will not be added to the master. This is a different behavior than the default Dynamic Includes does and equals: #SciTE4AutoIt3_Dynamic_Include_recursive_check=y It can be changed to work the same as Dynamic includes version and include all in the master, ignoring the recursive includes.
    1 point
  34. It works good Jos! Thank you! I tested it briefly using this in the LibreOffice development folder: _LOCalc_CellFontColor() MsgBox($MB_OK, "", "") _Word_Create() and it took ~7 seconds before the ArrayDisplay came up. Which is pretty quick I would say! And then some weird output message in the Terminal (This could be my own problem, as I occasionally have display issues with VSC.). But I can't reproduce this after the first two times. But the ArrayDisplay sometimes comes up with this script. I then tested with this: _LOCalc_CellFontColor() MsgBox($MB_OK, "", "") _Word_Create() _LOWriter_VersionGet() And it took ~8 seconds, but missed the MsgBox Constants. However no array display, and only normal messages in the terminal. Edit: Tried it again and it took 5 seconds. Msg Box constants still don't get added with the lower script.
    1 point
  35. @Nine and @HezzelQuartz , please relax, no worries. I understand your point Nine, but I also believe there is information had been lost through the different threads which are partly depend on each other. I thought HezzelQuartz needs some time to review different approaches/solutions and have to learn. As a recommendation HezzelQuartz, if you share your tryouts or just your planed next steps, it helps the community members to understand and avoid misunderstandings like this. I don't want to speak in your behave @HezzelQuartz and also not in yours @Nine. I believe it's just a misunderstanding and I wanted to point this out 😇 . Best regards Sven
    1 point
  36. Anything is possible when you put your mind to it and have some time to burn. 🙂 preview version: https://www.autoitscript.com/autoit3/scite/download/beta_SciTE4AutoIt3/addincludes/AutoIt3Wrapper.au3 It scans for any potential Include files *.au3 file that contain a Func names with format _*.au3 and *Constants*.au3 files for Global Const $vars defined in these paths: @Scriptpath @Scriptpath\include @AutoIt3Dir\include Any defined private include directories in RegRead("HKCU\Software\AutoIt v3\Autoit", "Include") It takes a couple of seconds for me to read all include files for UDFs & Vars and then depending on the script size again a few seconds to check if any #include is required and found/known. Maybe some can try it to see how it performs on their systems.
    1 point
  37. Kanashius

    ToString UDF

    This is an UDF to print the content and type of any variable. This includes basic datatypes, as well as all data in multidimensional arrays, DllStructs, Maps, some Objects like Dictionaries,... Basically any datatype I could think of. By Default, the datatype is given, this can be turned of. Additionally the spacing can be tuned to ones liking. I hope you like it and feel free to provide some feedback for improvement. Example: Output: ToString.au3 ToString Example.au3
    1 point
  38. Just for the heck of it: I've modified my forked repo extension code to include these standard shortcuts/tasks : Tidy (Ctrl+t) Au3Stripper (Ctrl+Shift+x) AddIncludes (Ctrl+Shift+m) .. and think this works nicer than defining the tasks.json. Also added a fix to be able to cope with the -1 returncode from Tidy.
    1 point
  39. THE TITLE SAY'S ALL. Image SearchAllVersion.zip
    1 point
  40. 10-15-2024 In Development The creative hiatus had ended and development in motion, see recent posts for updates. From 4-15-2024: I've severely pumped the brakes and come to a creative hiatus on the project and have returned to the drawing board on many aspects of RPGenerator, including, foremost, the graphics as well as the over all code used. The autoit concept demo that's currently available here is being discontinued due to many reasons that have led to this decision, based on various difficulties or my own dissatisfaction/frustrations with aspects of the project and where it stands. What's in the plans? Right now I'm developing a scriptable and modular IRC core software with Python, with this core software I plan to make the RPGenerator hub IRC bot (as mentioned previously, this part is still happening, but instead will be developed purely in python.) Autoit comes in with client programs for windows users which will be a user side chat client that features some completely redesigned graphics and is built to connect and interact with game hubs being hosted by the python bot. As far as the autoit side of this project is concerned, it has been scrapped and slated for a complete start over with autoit. Official production continuation of RPGenerator is planned to begin October 2024 I'm also migrating stuff and remodeling my 'brand' thru GitHub and Patreon, which will include software, other digital products/media, and maybe one day merch. Who knows. Do not worry, RPGenerator will be back and better than ever! Mode60 Official Website (m0de-60.github.io) Version 0.01 Concept (STILL AVAILABLE) DOWNLOAD: RPGenerator/windows-concept-game at main · m0de-60/RPGenerator (github.com)
    1 point
  41. Dears, i am trying to come up with my own c/++ dll to connect autoit with mongodb or similar (without ADO). The goal is to exchange "unmodified" strings between autoit and my dll, we want to migrate a very large autoit application from using the filesystem as a database to a real database (potentially hundreds of thousands files are written and listed/read...), not yet sure if it really pays off to go the dll approach is worth it. One very simple alternative would be to use some http rest api bridge to talk with the database but this adds a little overhead because of the http protocol. The result of my tests below is as you see in the .au3 comments, the "Add" function call works including parameters and return int but the "Echo" functions parameter wchar_t* is always 0. Any clues be greatly appreciated! Besides some old forum posts i did not really find any examples how to pass string or binary data unmodified between dlls and autoit... test.au3: #AutoIt3Wrapper_UseX64=Y Global Const $g_sFileDll      = 'C:\dev\FileBridge++\FileBridge++\x64\Debug\FileBridge.dll' $hdll = DllOpen($g_sFileDll) #this works, $test is 5 $test = DllCall($hdll, "int:cdecl", "Add", "int", 2, "int", 3) #this works, we get a console print in scite and the messagebox initiated by dll pops up $test = DllCall($hdll, "int:cdecl", "Function", "int", 2, "int", 3) #this does not work, we only get 0 pointer int the dll $utf16String = "Hello, World" $ptr = DllStructCreate("wchar_t [" & StringLen($utf16String) + 1 & "]") ; +1 for null terminator DllStructSetData($ptr, 1, $utf16String) DllCall($hdll, "int", "Echo", "ptr", DllStructGetPtr($ptr)) DllClose($hdll) C++ Part: FileBridge++.h: #include <wchar.h> #define DLL_EXPORT #if defined DLL_EXPORT #define DECLDIR __declspec(dllexport) #else #define DECLDIR __declspec(dllimport) #endif int CppAdd(int a, int b); extern "C" {     // Declare all functions here     DECLDIR void Function(void);     DECLDIR int Add(int a, int b);     DECLDIR void Echo( wchar_t* utf16String);  // Function takes a pointer to MyStructure } FileBridge++.cpp: #include "pch.h" #include <iostream> #include <Windows.h>  #include "FileBridge++.h" using namespace std; extern "C" {     DECLDIR int Add(int a, int b)     {         return CppAdd(a, b);     }     DECLDIR void Function(void)     {         std::cout << "DLL Called! Hello AutoIt!" << std::endl;         MessageBox(0, TEXT("This MsgBox is created by the dll"), TEXT("Simple Dll..."), 0);     }     DECLDIR void Echo(wchar_t* utf16String)     {         if (utf16String == nullptr) {             std::wcout << L"Received NULL pointer!" << std::endl;             return;         }         std::wcout << L"You wrote: [" << utf16String << L"]" << std::endl;              } } int CppAdd(int a, int b) {     return(a + b); }
    1 point
  42. p4sCh

    SSH UDF

    Hello everyone, I've created a UDF for basic communication with SSH servers. I know there is already such a UDF, but I wasn't satisfied with it for my purpose, so I created a new one. This UDF also acts as a wrapper for the plink executable. Its essential functions are _SSHConnect, _SSHSend, _SSHRecv and _SSHCloseSocket. It does support multiple simultaneous connections and aims to be pretty robust. Feel free to share your opinions Two of the included examples use a slightly modified version of Vintage Terminal by @Chimp Download The download includes ssh.au3 (UDF), plink.exe (necessary), vintage terminal and code examples: Version 1.0.1 - fixed rare _SSHConnect bug where "ssh-host-key prompt" was not answered SSH UDF 1.0.1.zip
    1 point
  43. TL;DR: Create_Process calls cmd.exe if passed a .bat or .cmd file, however the non-standard character escaping of cmd.exe allows arbitrary code execution. NVD - CVE-2024-24576 (nist.gov) https://flatt.tech/research/posts/batbadbut-you-cant-securely-execute-commands-on-windows
    1 point
  44. Hey Guys! I am currently trying to automate making icons for my small fan made game. Basically i just take a screenshot of a 3D Model in 32x32 and remove the BG color via Photoshop, then saving it as .png. Atm my script creates a rectangle to visually show me the area of the screenshot and hides the rectangle once it takes a screenshot: $Rectangle = GUICreate("Test", 32, 32, 1358, 438,$WS_POPUP,$WS_EX_TOPMOST) GUISetState(@SW_SHOW) WinSetTrans($Rectangle, "", 150) HotKeySet("{DOWN}" , "close") HotKeySet("{UP}" , "TakeScreenshot") Global $funcs = False While 1 If $funcs = True Then ToolTip("Cheeeseee" , 0 , 30) Sleep(10) GUISetState(@SW_HIDE, $Rectangle);Hide rectangle _ScreenCapture_Capture("C:\Users\PAT\Pictures\Item" & "\Test.jpg", 1358, 438, 1390, 470);Take Screenshot and save the Picture GUISetState(@SW_SHOW, $Rectangle);Unhide rectangle $funcs = False EndIf WEnd Func close() ToolTip("Closing..." , 0 , 30) Sleep(200) Exit EndFunc Func TakeScreenshot() If $funcs = False Then $funcs = True Else $funcs = False ToolTip("Ready!" , 0 , 30) EndIf EndFunc The Screenshot it takes looks like this: But i want it to look like this(transparent background): How would you guys do it? I'm pretty new to GDI and graphics related stuff in AutoIT so i have no clue what to do 😕 Any help would be really appreciated! Edit: Alright i found a solution! I've used this script from @UEZ to make it work like intended. Thanks to UEZ! ♥ ;benötigt 3.3.12.0 #include <ScreenCapture.au3> _GDIPlus_Startup() Global $iWidth = 400, $iHeight = 400 Global $hBitmap_GDI = _ScreenCapture_Capture("", 0, 0, $iWidth - 1, $iHeight - 1, 0) Global $hBitmap_GDIPlus = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap_GDI) Global $hBitmap_Result = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) Global $hBitmap_Result_Ctxt = _GDIPlus_ImageGetGraphicsContext($hBitmap_Result) Global $aRemapTable[2][2] $aRemapTable[0][0] = 1 $aRemapTable[1][0] = 0xFFFFFFFF ;Farbe, die Transparent gemacht werden soll $aRemapTable[1][1] = 0x08000000 ;Semi Transparenz - Format 0xAARRGGBB Global $hIA = _GDIPlus_ImageAttributesCreate() _GDIPlus_ImageAttributesSetRemapTable($hIA, 1, True, $aRemapTable) _GDIPlus_GraphicsDrawImageRectRect($hBitmap_Result_Ctxt, $hBitmap_GDIPlus, 0, 0, $iWidth, $iHeight, 0, 0, $iWidth, $iHeight, $hIA) _GDIPlus_ImageSaveToFile($hBitmap_Result, @ScriptDir & "\Result.png") _GDIPlus_GraphicsDispose($hBitmap_Result_Ctxt) _GDIPlus_BitmapDispose($hBitmap_GDIPlus) _GDIPlus_BitmapDispose($hBitmap_Result) _WinAPI_DeleteObject($hBitmap_GDI) _GDIPlus_ImageAttributesDispose($hIA) _GDIPlus_Shutdown() ShellExecute(@ScriptDir & "\Result.png") Func _GDIPlus_ImageAttributesSetRemapTable($hImageAttributes, $iColorAdjustType = 0, $fEnable = False, $aColorMap = 0) Local $iI, $iCount, $tColorMap, $aResult If IsArray($aColorMap) And UBound($aColorMap) > 1 Then $iCount = $aColorMap[0][0] $tColorMap = DllStructCreate("uint ColorMap[" & $iCount * 2 & "]") For $iI = 1 To $iCount $tColorMap.ColorMap((2 * $iI - 1)) = $aColorMap[$iI][0] $tColorMap.ColorMap((2 * $iI)) = $aColorMap[$iI][1] Next $aResult = DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesRemapTable", "handle", $hImageAttributes, "int", $iColorAdjustType, "int", $fEnable, "int", $iCount, "struct*", $tColorMap) If @error Then Return SetError(@error, @extended, False) If $aResult[0] Then Return SetError(10, $aResult[0], False) Return True EndIf Return SetError(11, 0, False) EndFunc ;==>_GDIPlus_ImageAttributesSetRemapTable
    1 point
  45. Hello. Do it like this. (Start-Process App.exe -PassThru -Wait).ExitCode Saludos
    1 point
  46. Unfortunately the OSVersion info doesn't provide enough information especially when dealing with multiple build versions of Windows 10 in our environment, as some of our software doesn't work across all builds (usually because some features are only available on specific builds): OS Versions: 7, 10, 2008 R2, 2012 R2, 2016, 2019 OS Editions: Home, Professional or Enterprise OS Builds: 1709, 1803, 1809, 1903, 1909 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion can usually be used to determine most of this info, however WMI is generally more consistent when running across multiple OS versions. Global $g_sOSCaption, $g_sOSVersion _GetOSInfo() ConsoleWrite("OS Caption : " & $g_sOSCaption & @CRLF & "OS Version : " & $g_sOSVersion & @CRLF) Func _GetOSInfo() Local $oSystemSet = ObjGet("winmgmts:").InstancesOf ("Win32_OperatingSystem") If IsObj($oSystemSet) Then For $oSystem In $oSystemSet $g_sOSCaption = $oSystem.Caption $g_sOSVersion = $oSystem.Version Next EndIf EndFunc
    1 point
  47. ptrex

    PDFCreator - Print2PDF

    PDFCreator in AutoIT 0=PDF, 1=PNG, 2=JPG, 3=BMP, 4=PCX, 5=TIFF, 6=PS, 7= EPS, 8=ASCII Someone in the help forum was wondering how to use the PDFCreator in AutoIT. When reading this, I was surprised to find that PDFCreator had a COM object in it's latest version. I have been using PDFCreator since years, but never know this :"> Anyhow here is the example on how to create a PDF Test page. ;; Testpage2PDF script ; Part of $PDFCreator ; License: GPL ; Homepage: http://www.sf.net/projects/pdfcreator ; Version: 1.0.0.0 ; Date: September, 1. 2005 ; Author: Frank Heindörfer ; Comments: Save the test page as pdf-file using the com interface of $PDFCreator. ; Translated by ptrex AutoItSetOption("MustDeclareVars", 1) Const $maxTime = 10 ; in seconds Const $sleepTime = 250 ; in milliseconds Dim $fso, $WshShell, $PDFCreator, $DefaultPrinter, $ReadyState, $c, _ $Scriptname, $Scriptbasename $fso = ObjCreate("Scripting.FileSystemObject") $Scriptbasename = $fso.GetBaseName(@ScriptFullPath) $WshShell = ObjCreate("WScript.Shell") $PDFCreator = ObjCreate("PDFCreator.clsPDFCreator") $PDFCreator.cStart ("/NoProcessingAtStartup") $ReadyState = 0 With $PDFCreator .cOption("UseAutosave") = 1 .cOption("UseAutosaveDirectory") = 1 .cOption("AutosaveDirectory") = $fso.GetParentFolderName(@ScriptFullPath) .cOption("AutosaveFilename") = "Testpage - PDFCreator" .cOption("AutosaveFormat") = 0 ; 0=PDF, 1=PNG, 2=JPG, 3=BMP, 4=PCX, 5=TIFF, 6=PS, 7= EPS, 8=ASCII $DefaultPrinter = .cDefaultprinter .cDefaultprinter = "PDFCreator" .cClearcache() .cPrintPDFCreatorTestpage() .cPrinterStop = 0 EndWith $c = 0 Do $c = $c + 1 Sleep ($sleepTime) Until ($ReadyState = 0) and ($c < ($maxTime * 1000 / $sleepTime)) With $PDFCreator .cDefaultprinter = $DefaultPrinter Sleep( 200) .cClose() EndWith If $ReadyState = 0 then Consolewrite ("Creating test page as pdf." & @CRLF & @CRLF & "An error is occured: Time is up!"& @CR) ProcessClose("PDFCreator.exe") EndIf ;--- $PDFCreator events --- Func PDFCreator_eReady() $ReadyState = 1 EndFunc Func PDFCreator_eError() Consolewrite ("An error is occured!" & @CRLF & @CRLF & _ "Error [" & $PDFCreator.cErrorDetail("Number") & "]: " & $PDFCreator.cErrorDetail("Description")& @CR) ;VA Wscript.Quit EndFunc ; Convert2PDF script ; Part of $PDFCreator ; License: GPL ; Homepage: http://www.sf.net/projects/pdfcreator ; Version: 1.0.0.0 ; Date: September, 1. 2005 ; Author: Frank Heindörfer ; Comments: This script convert a printable file in a pdf-file using the com interface of $PDFCreator. ; Translated by ptrex AutoItSetOption("MustDeclareVars", 1) Const $maxTime = 30 ; in seconds Const $sleepTime = 250 ; in milliseconds Dim $objArgs, $ifname, $fso, $PDFCreator, $DefaultPrinter, $ReadyState, _ $i, $c, $AppTitle, $Scriptname, $ScriptBasename, $File $fso = ObjCreate("Scripting.FileSystemObject") $Scriptname = $fso.GetFileName(@ScriptFullPath) $ScriptBasename = $fso.GetFileName(@ScriptFullPath) $AppTitle = "PDFCreator - " & $ScriptBasename $File = InputBox("FileName","Fill in the Path and filename","C:_AppsAutoIT3COMPDFCreatorVBScriptsGUI.vbs") $PDFCreator = ObjCreate("PDFCreator.clsPDFCreator") $PDFCreator.cStart ("/NoProcessingAtStartup") With $PDFCreator .cOption("UseAutosave") = 1 .cOption("UseAutosaveDirectory") = 1 .cOption("AutosaveFormat") = 1 ; 0=PDF, 1=PNG, 2=JPG, 3=BMP, 4=PCX, 5=TIFF, 6=PS, 7= EPS, 8=ASCII $DefaultPrinter = .cDefaultprinter .cDefaultprinter = "PDFCreator" .cClearcache() EndWith ; For $i = 0 to $objArgs.Count - 1 With $PDFCreator $ifname = $File ;"C:TmpTest.xls" ;$objArgs($i) If Not $fso.FileExists($ifname) Then MsgBox (0,"Error","Can't find the file: " & $ifname & @CR & $AppTitle) Exit EndIf If Not .cIsPrintable(String($ifname)) Then ConsoleWrite("Converting: " & $ifname & @CRLF & @CRLF & _ "An error is occured: File is not printable!" & @CRLF & $AppTitle & @CR) EndIf $ReadyState = 0 .cOption("AutosaveDirectory") = $fso.GetParentFolderName($ifname) .cOption("AutosaveFilename") = $fso.GetBaseName($ifname) .cPrintfile (String($ifname)) .cPrinterStop = 0 $c = 0 Do $c = $c + 1 Sleep ($sleepTime) Until ($ReadyState = 0) and ($c < ($maxTime * 1000 / $sleepTime)) If $ReadyState = 0 then ConsoleWrite("Converting: " & $ifname & @CRLF & @CRLF & _ "An error is occured: File is not printable!" & @CRLF & $AppTitle & @CR) Exit EndIf EndWith ;Next With $PDFCreator .cDefaultprinter = $DefaultPrinter .cClearcache() Sleep (200) .cClose() EndWith ProcessClose("PDFCreator.exe") ;--- $PDFCreator events --- Func PDFCreator_eReady() $ReadyState = 1 EndFunc Func PDFCreator_eError() MsgBox(0, "An error is occured!" , "Error [" & $PDFCreator.cErrorDetail("Number") & "]: " & $PDFCreator.cErrorDetail("Description")& @CR) EndFunc There are lot's of VBScript Examples distributed with the installation. As well as for other Scripting or Programming languages. Even for MS Office VBA So let's go and add your scripts to it. Enjoy !! ptrex
    1 point
  48. Basically, here's how I (KaFu and jchd) solved my problem using the Main Script: $struct = "wchar ins[260]" $Structure=DllStructCreate($struct) If @error Then MsgBox(0,"","Error in DllStructCreate " & @error); Exit Endif ; Get the pointer $Pointer1 = DllStructGetPtr($Structure,"ins") ; Returns the pointer ; Initialize default value Write_Memory(@AutoItPID, $Pointer1, "null", "wchar var4[260]") ; Build a list of the test to be executed $aTestList = _FileListToArray("C:\TestCases\Execution\") ; Loop through the test list For $i = 1 To $aTestList[0] Run("C:\Program Files\AutoIt3\AutoIt3.exe C:\TestCases\Execution\" & $aTestList[$i] & " " & @AutoItPID & " " & $Pointer1, "C:\Program Files\AutoIt3\") ; Script waits while TestCase script modify the shared variable including all details about the testcase. While Read_Memory(@AutoItPID, $Pointer1, "wchar var4[260]") = "null" Sleep(100) WEnd ; TestCase script return a result and Report_Format prepare the string for SQL INSERT. $aValues = Report_Format(Read_Memory(@AutoItPID, $Pointer1, "wchar var4[260]")) ; INSERT into Memory Database using value retrieved from the shared string variable. If Not _SQLite_Exec (-1, "INSERT INTO Tests VALUES ('" & $aValues[1] & "','" & $aValues[2] & "','" & $aValues[3] & "','" & $aValues[4] & "','" & $aValues[5] & "');") = $SQLITE_OK Then _ MsgBox(16, "SQLite Error", _SQLite_ErrMsg ()) ; Set shared variable's value back to "null" Write_Memory(@AutoItPID, $Pointer1, "null", "wchar var4[260]") Next TestCase call is made really simple using Report_Write(): Report_Write($CmdLine[1], $CmdLine[2], $aTD, "001", "Pass") Func Report_Write($PID, $Pointer, $aTD, $step, $status) Write_Memory($PID, $Pointer, _ $aTD[0] & "|" & _ ; Test Category $aTD[1] & "|" & _ ; Test ID $aTD[2] & "|" & _ ; Test Title $step & "|" & _ ; Test Step $status, _ ; Step Status "wchar var4[260]") EndFunc Main Script calls Report_Format, converting the shared string to array using StringSplit. (Depending on my future needs, I may change the workflow to use multiple pointer to different data type instead of a single string.) That's not much of an innovation but it might gives idea for using a "shared" SQLite database.
    1 point
×
×
  • Create New...