Leaderboard
Popular Content
Showing content with the highest reputation since 02/13/2025 in all areas
-
Another AutoIt extension for Visual Studio Code
seadoggie01 and 4 others reacted to genius257 for a topic
Version 1.8.2 has just been released! I should have been 1.8.0, but issues with deployment pipeline after bigger changes to how the parser code and types are generated (internally) meant that i had to increment patch version 2 times, to successfully be able to release to the extension marketplaces. Notable changes: Added au3 DocBlock `@link` tag support Added syntax highlighting for au3 DocBlock and legacy UDF headers 2 things i would like feedback on, if possible: About the new syntax highlighting: Let me know if and/or how you like or dislike it. Performance: small changes to how the parser worked with some parser rules, to better generate types. Smaller tests indicated it was same or faster, but it can very much depend how it traverses through the code. Let me know if you notice any slow down, so I can look into fixing it ASAP! Feedback can be here, via an issue or via the discussion for the release.5 points -
Smooth and infinite marquee style scroll of a long string in a short control
pixelsearch and 3 others reacted to Gianni for a topic
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 ;==>_Marquee4 points -
MessageBox higher than Desktop
Musashi and 3 others reacted to pixelsearch for a topic
Hi everybody This script displays a big MessageBox having a height higher than @DesktopHeight While the MessageBox is displayed, you can "navigate" inside it like this : * Mouse Left-click drag : to move the window up and down (displaying a new panel of lines) * Mouse Right-click : to display the window at its initial position * Up key * Down key * PageUp Key (Fn + up key on some laptops) * PageDown Key (Fn + down key on some laptops) * Home Key (Fn + left key on some laptops) * End Key (Fn + right key on some laptops) The 6 keyboard keys allow to navigate inside the window. Click on a button (placed at top of the window) to make your choice. All this could have been scripted more easily using a GUI, an Edit control containing the text to display, plus the buttons to choose from, but I just wanted to try it using a native MessageBox #include <APISysConstants.au3> ; $GCL_HCURSOR #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <Misc.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <WinAPIRes.au3> ; _WinAPI_LoadCursor() #include <WinAPISysWin.au3> ; _WinAPI_SetClassLongEx() #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declaration Opt("GUICloseOnESC", 0) ;1=ESC closes (default), 0=ESC won't close Global $g_hGUI, $g_hDLL = DllOpen("user32.dll") Global $g_aCaption, $g_sTitle Example() ;=========================================== Func Example() $g_hGUI = GUICreate("Big MsgBox example (7b)", 400, 200) GUICtrlCreateLabel("Number of lines in MsgBox (2 - 1588)", 10, 20, 180, 20, $SS_SUNKEN) Local $idNbLines = GUICtrlCreateInput("200", 200, 20, 35, 20, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)), $iNbLines GUICtrlSetLimit($idNbLines, 4) Local $idMsgBox = GUICtrlCreateButton("Big MsgBox", 10, 60, 100, 25, $BS_DEFPUSHBUTTON) Local $idExit = GUICtrlCreateButton("Exit", 10, 110, 100, 25) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idExit ExitLoop Case $idMsgBox Local $iRet = Prepare_MsgBox(GUICtrlRead($idNbLines)) If $iRet Then MsgBox($MB_TOPMOST, "Big MsgBox return value : " & $iRet, Retrieve_Caption($iRet), 0, $g_hGUI) GUICtrlSetState($idNbLines, $GUI_FOCUS) EndSwitch WEnd DllClose($g_hDLL) EndFunc ;==>Example ;=========================================== Func Prepare_MsgBox(Const $iNbLines) If $iNbLines < 2 Or $iNbLines > 1588 Then MsgBox($MB_TOPMOST, "Error", "Enter a number of lines between 2 and 1588", 0, $g_hGUI) Return ; 0 EndIf Local $sTxt = "Line 1 : first line" & @crlf For $i = 2 To $iNbLines - 1 $sTxt &= "Line " & $i & @crlf Next $sTxt &= "Line " & $iNbLines & " : last line" Dim $g_aCaption[3][3] = [ ["Cancel"], ["Try Again"], ["Continue"] ] ; 1st column = button caption, 2nd = button handle, 3rd = button ID $g_sTitle = "MsgBox with 3 buttons" Local $iChoice = _MsgBox(BitOr($MB_CANCELTRYCONTINUE, $MB_TOPMOST), $g_sTitle, $sTxt, 0, $g_hGUI) ;~ Dim $g_aCaption[2][3] = [ ["Yes"], ["No"] ] ;~ $g_sTitle = "MsgBox with 2 buttons" ;~ Local $iChoice = _MsgBox(BitOr($MB_YESNO, $MB_TOPMOST), $g_sTitle, $sTxt, 0, $g_hGUI) ;~ Dim $g_aCaption[1][3] = [ ["Hello"] ] ;~ $g_sTitle = "MsgBox with 1 button" ;~ Local $iChoice = _MsgBox(BitOr($MB_OK, $MB_TOPMOST), $g_sTitle, $sTxt, 0, $g_hGUI) Return $iChoice EndFunc ;==>Prepare_MsgBox ;=========================================== Func _MsgBox($iFlag, $g_sTitle, $sText, $iTimeOut = 0, $hWnd = 0) GUIRegisterMsg($WM_HELP , "WM_HELP") Local $hTimerProc = DllCallbackRegister('_MsgBoxTimerProc', 'none', 'hwnd;uint;uint_ptr;dword') Local $iTimerID = _WinAPI_SetTimer(0, 0, 10, DllCallbackGetPtr($hTimerProc)) Local $iChoice = MsgBox($iFlag, $g_sTitle, $sText, $iTimeOut, $hWnd) _WinAPI_KillTimer(0, $iTimerID) DllCallbackFree($hTimerProc) GUIRegisterMsg($WM_HELP, "") Return $iChoice EndFunc ;==>_MsgBox ;=========================================== Func _MsgBoxTimerProc($hWnd, $iMsg, $iTimerID, $iTime) If WinExists($g_sTitle) Then _WinAPI_KillTimer(0, $iTimerID) Local $hMsgBox = WinGetHandle($g_sTitle) For $i = 0 To Ubound($g_aCaption) - 1 ControlSetText($hMsgBox, "", "Button" & ($i + 1), $g_aCaption[$i][0]) $g_aCaption[$i][1] = ControlGetHandle($hMsgBox, "", "Button" & ($i + 1)) $g_aCaption[$i][2] = _WinAPI_GetDlgCtrlID($g_aCaption[$i][1]) ; remember OK button ID is 1 ($MB_OKCANCEL) or 2 ($MB_OK) ... ; ... msdn "If a message box has a Cancel button, the function returns the IDCANCEL value (2) if either the ESC key is pressed ; or the Cancel button is selected." ; "If the message box has no Cancel button, pressing ESC will no effect - unless an MB_OK button is present. ; If an MB_OK button is displayed and the user presses ESC, the return value will be IDOK (1)" [personal: only one case for this] Next Local $aPosMsgBox = WinGetPos($hMsgBox) Local $bTooHigh = ($aPosMsgBox[3] > @DesktopHeight + 15) ? True : False If $bTooHigh Then Local $aPosButton, $aPosStatic = ControlGetPos($hMsgBox, "", "Static1") ; the text area For $i = 0 To Ubound($g_aCaption) - 1 $aPosButton = ControlGetPos($hMsgBox, "", "Button" & ($i + 1)) WinMove($g_aCaption[$i][1], "", $aPosButton[0], $aPosStatic[1]) Next WinMove(ControlGetHandle($hMsgBox, "", "Static1"), "", $aPosStatic[0], $aPosStatic[1] + $aPosButton[3] + 10) _WinAPI_RedrawWindow($hMsgBox) ; +++ Send("{F1}") ; => Func WM_HELP EndIf EndIf EndFunc ;==>_MsgBoxTimerProc ;============================================== Func WM_HELP($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam If WinExists($g_sTitle) Then ; MessageBox window always exists at this stage Local $hMsgBox = WinGetHandle($g_sTitle) Local $aPosMsgBox = WinGetPos($hMsgBox), $aPosMsgBox_Init = $aPosMsgBox Local $aWinPos, $aMPos, $aMPosOld Local $hCursor = _WinAPI_LoadCursor(0, $OCR_SIZEALL) ; $OCR_SIZENS ok too Local $iPrev = _WinAPI_SetClassLongEx($hMsgBox, $GCL_HCURSOR, $hCursor) ; see "147c.au3" _ClearBuffer("0D") ; Enter key (in case pressed too long on button 'Big MsgBox' in main GUI, so it won't select a button in MsgBox) While 1 If WinActive($hMsgBox) Then Select Case _IsPressed("01", $g_hDLL) ; "01" = Left mouse button $aMPosOld = MouseGetPos() While _IsPressed("01", $g_hDLL) $aMPos = MouseGetPos() If $aMPos[1] <> $aMPosOld[1] Then $aWinpos = WinGetPos($hMsgBox) If ($aMPos[0] - 1 > $aWinpos[0]) And ($aMPos[0] + 1 < $aWinpos[0] + $aWinpos[2]) Then WinMove($hMsgBox, "", Default, $aWinpos[1] + ($aMPos[1] - $aMPosOld[1])) $aMPosOld = $aMPos EndIf EndIf Sleep(10) Wend Case _IsPressed("02", $g_hDLL) ; Right mouse button WinMove($hMsgBox, "", $aPosMsgBox_Init[0], $aPosMsgBox_Init[1]) Case _IsPressed("09", $g_hDLL) ; Tab key _ClearBuffer("09") _ChangeFocus($hMsgBox, "09") Case _IsPressed("0D", $g_hDLL) ; Enter key _ClearBuffer("0D") ControlClick($hMsgBox, "", ControlGetFocus($hMsgBox)) Case _IsPressed("1B", $g_hDLL) ; Esc key _ClearBuffer("1B") For $i = 0 To Ubound($g_aCaption) - 1 If $g_aCaption[$i][2] = 2 Then ; Cancel button (or OK button when alone : see msdn notes above) ControlClick($hMsgBox, "", $g_aCaption[$i][2]) EndIf Next Case _IsPressed("21", $g_hDLL) ; PageUp Key (Fn + up key on most laptops) _ClearBuffer("21") $aPosMsgBox = WinGetPos($hMsgBox) WinMove( $hMsgBox, "", Default, ($aPosMsgBox[1] + @DesktopHeight > 0) ? 0 : $aPosMsgBox[1] + @DesktopHeight ) Case _IsPressed("22", $g_hDLL) ; PageDown Key (Fn + down key on most laptops) _ClearBuffer("22") $aPosMsgBox = WinGetPos($hMsgBox) WinMove( $hMsgBox, "", Default, _ ($aPosMsgBox[3] + $aPosMsgBox[1] - @DesktopHeight < @DesktopHeight + 15) ? @DesktopHeight - $aPosMsgBox[3] : $aPosMsgBox[1] - @DesktopHeight ) Case _IsPressed("23", $g_hDLL) ; End Key (Fn + right key on most laptops) $aPosMsgBox = WinGetPos($hMsgBox) WinMove($hMsgBox, "", Default, @DesktopHeight - $aPosMsgBox[3]) Case _IsPressed("24", $g_hDLL) ; Home Key (Fn + left key on most laptops) WinMove($hMsgBox, "", Default, 0) Case _IsPressed("25", $g_hDLL) ; Left key _ClearBuffer("25") _ChangeFocus($hMsgBox, "25") Case _IsPressed("26", $g_hDLL) ; Up Key $aPosMsgBox = WinGetPos($hMsgBox) WinMove($hMsgBox, "", Default, ($aPosMsgBox[1] + 12 > 0) ? 0 : $aPosMsgBox[1] + 12) Case _IsPressed("27", $g_hDLL) ; Right key _ClearBuffer("27") _ChangeFocus($hMsgBox, "27") Case _IsPressed("28", $g_hDLL) ; Down Key $aPosMsgBox = WinGetPos($hMsgBox) WinMove( $hMsgBox, "", Default, _ ($aPosMsgBox[3] + $aPosMsgBox[1] - 12 < @DesktopHeight) ? @DesktopHeight - $aPosMsgBox[3] : $aPosMsgBox[1] - 12 ) EndSelect EndIf If Not BitAND(WinGetState($hMsgBox), $WIN_STATE_VISIBLE) Then ; one of MsgBox buttons was chosen by user ExitLoop EndIf Sleep(10) WEnd _WinAPI_SetClassLongEx($hMsgBox, $GCL_HCURSOR, $iPrev) ; needed, or cursor $OCR_SIZEALL will show... in final MsgBox from main loop EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_HELP ;============================================== Func _ClearBuffer($sKey) While _IsPressed($sKey, $g_hDLL) Sleep(10) Wend EndFunc ;==>_ClearBuffer ;============================================== Func _ChangeFocus($hMsgBox, $sKey) Local $iCtrlGetFocus, $iCtrlSetFocus, $iStyle $iCtrlGetFocus = StringRight(ControlGetFocus($hMsgBox), 1) ; 1/2/3 (last char of "Button1"/"Button2"/"Button3") If $sKey = "27" Or $sKey = "09" Then ; Right key (27) or Tab (09) $iCtrlSetFocus = $iCtrlGetFocus < Ubound($g_aCaption) ? $iCtrlGetFocus + 1 : 1 Else ; Left key (25) $iCtrlSetFocus = $iCtrlGetFocus > 1 ? $iCtrlGetFocus - 1 : Ubound($g_aCaption) EndIf ControlFocus($hMsgBox, "", "Button" & $iCtrlSetFocus) $iStyle = _WinAPI_GetWindowLong($g_aCaption[$iCtrlGetFocus - 1][1], $GWL_STYLE) _WinAPI_SetWindowLong($g_aCaption[$iCtrlGetFocus - 1][1], $GWL_STYLE, BitXOR($iStyle, $BS_DEFPUSHBUTTON)) $iStyle = _WinAPI_GetWindowLong($g_aCaption[$iCtrlSetFocus - 1][1], $GWL_STYLE) _WinAPI_SetWindowLong($g_aCaption[$iCtrlSetFocus - 1][1], $GWL_STYLE, BitOR($iStyle, $BS_DEFPUSHBUTTON)) EndFunc ;==>_ChangeFocus ;=========================================== Func Retrieve_Caption($iRet) If Ubound($g_aCaption) = 1 Then ; $MB_OK Return $g_aCaption[0][0] Else For $i = 0 To Ubound($g_aCaption) - 1 If $g_aCaption[$i][2] = $iRet Then Return $g_aCaption[$i][0] ; button ID always = $iRet (except for $MB_OK, see note msdn above) Next EndIf MsgBox($MB_TOPMOST, "Warning", "This message should never be displayed", 0, $g_hGUI) EndFunc ;==>Retrieve_Caption Update Feb 24, 2025 : Left key, Right key, Tab, Enter, Spacebar, Esc These 6 keys react now like they do in any MsgBox Feb 27, 2025 : minor correction4 points -
I guess I'm mixing too many different program languages these days, so goofed up pretty much with that last version. Anyway, it should be fixed with the latest Beta installer containing an update for AutoIt3Wrapper v25.205.1420.2 ... and did test properly this time.4 points
-
I will check deeply next few days ... don't call the wolf out of the forest3 points
-
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.3 points
-
GUIDelete()
SOLVE-SMART and 2 others reacted to water for a topic
When you learn to ride a bike, you don't ask your parents every 100 metres whether you're doing it right. As long as you don't fall, you're doing it right. It's the same with programming. If it works, then you've done a lot of things right. Maybe not efficiently or according to all the rules of programming, but it works. You've been working with AutoIt long enough that you should have this confidence in your own abilities and not have to ask after every 5 lines of code. Have more confidence! If it works, then it's good. If you get wrong results or error messages, that's the time to ask. Just my 2 cents worth! Written with the help of DeepL.com translator3 points -
First, SQLite is a simple library, not a client-server design. SQLite can only proceed with ONE SQL transaction at any given time. Also SQLite locks the entire DB file, not a specific table or row. When SQLite detects a BUSY situation when transaction A enters execution (another SQL transaction B in being processed, plus possible other transactions C, D, ... in BUSY state as well) and a non-zero timeout is in place for A, it continues processing B and repeatedly checks if A, C, D, ... are still in BUSY state until their respective timeout value exipres or B terminates and clears the way for others. SQLite doesn't queue BUSY transactions waiting for clearance in a FIFO or like. It randomly selects one of the waiting transaction and gives it a chance to process. That means that with the previous enumeration, when B terminates, SQLite is free to randomly select D to run, then F, then C, then E, until it selects A. That's why I mean "the longest possible sequence of transactions issued by all users of the library", because you may be unlucky and have your thing clear to run way after what you'd expect. That's also why it should be forbiden to group in a single transaction something like: select for change a number of rows, wait for user to chose the ones they need change, take the lunch break, update some data and finish the transaction. Some client-server designs can cope with this but at the expense of serious internal complexity to deal with parallel updates. About autoincrement: you ever need this except if your application can't cope with duplicate use of rowid over time. Example without autoincrement: create table T (id integer primary key, name text); insert into T (name) values ('Alice'), ('Bob'), ('Charlie'), ('Dom'), ('Elon'); delete from T where name glob '*o*'; insert into T (name) values ('Eve'); You obtain: id name 1 Alice 3 Charlie 4 Eve Instead, with this: create table T (id integer primary key autoincrement, name text); insert into T (name) values ('Alice'), ('Bob'), ('Charlie'), ('Dom'), ('Elon'); delete from T where name glob '*o*'; insert into T (name) values ('Eve'); You get: id name 1 Alice 3 Charlie 6 Eve With autoincrement, once a given rowid has been used, you're sure it won't be reused ever. This a very rare use case and forces SQLite to maintain sqlite_sequence for this table.3 points
-
Here's the pic from the first thread.... Imagine the first column of each number is a BYTE, with Most Significant Bit being 128, then 64, 32 16 8 4 2 1, we dont need the 128 as each number is only 7 imaginary bits tall, then the loop starts at the top left corner and reads the first bit, if it's lit it adds $value=64 to $code[0], if unlit nothing is added, then the next DllStructGetData reads the next number, and so on, when it gets to the end (last number) then $value is divided by 2 so it's 32 which is the next significant bit and the STEP in the loop goes to next line/bit, if it finds any lit bits it adds $value to $code, and so on.... The $code's now have values, which we then look up in the lookup table, like 114 is 5, the last in the lookup as it's the largest number, while 4 is located at 12'th place.3 points
-
Smooth and infinite marquee style scroll of a long string in a short control
pixelsearch and one other reacted to CYCho for a topic
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) EndFunc2 points -
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) EndFunc2 points
-
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
-
BETA: SciTE v5x & lua Dynamic_include and "Smart" AutoComplete for Vars/UDFs/Abbrevs
SOLVE-SMART and one other reacted to Jos for a topic
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 -
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
-
ACL Viewer
argumentum and one other reacted to WildByDesign for a topic
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 -
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
-
[Completed] Volunteers wanted 👀 to test an AutoIt + SQLite project
ValentinM and one other reacted to SOLVE-SMART for a topic
Hi everyone 👋 , thank you in advance for looking at the little project and for thinking about supporting it (me) 😀 . Introduction I have a small AutoIt + SQLite GitHub project (sqlite-showcase). This serves at 1️⃣. glance to demonstrate how to use SQLite using concrete examples. If questions arise in the English or German forum about SQLite, I can provide direct assistance using the project and its example data. As 2️⃣. perspective, this project is intended as a module for a subsequent project that deals with something more than "just" AutoIt + SQLite - but more on that another time. I deliberately refrain from writing and explaining too many details here, because it is important to me, among other things, that the explanation on GitHub, in the form of a README file, can be handled or whether I need to make improvements there. Testing So far I have been able to test the project under Windows 10 (x64), with AutoIt v3.3.16.1 and with SQLite v3.49.0. Due to the support of the german AutoIt forum member(s), I could also test with Windows 11. Now I would be very happy if someone among you (several people are welcome) 🤗 would test other system configurations. See the following table: The test consists of the following parts: Read the README, understand what to do ==> If there are already problems understanding this, then I have to make improvements. Setting up the project (getting started) ==> Is the explanation in the README sufficient? You can test it on Windows 10 x86? Then please, great. Do you have an old version of AutoIt that you can test with? That's exactly what I need ==> Thanks. You want to try a different SQLite version? Why not, I appreciate it. Are the few SQLite functions running correctly or are there any errors? They shouldn't, but if they do, please let me know. Preconditions You don't need Git or GitHub, although Git is an advantage. A simple download of the project (zip) is completely sufficient (see README). Just a little time, curiosity, interest in learning something new or putting my approach to the test 😅 . 🔥 CHANGELOG can be found here. --------------------------------- Thank you very much for your interest and for your support. If you have any questions, please let me know. Thanks. Best regards Sven Update: Testing complete.2 points -
FileExplorer Treeview and Listview (TreeListExplorer)
SOLVE-SMART and one other reacted to Kanashius for a topic
Hi @WildByDesign, thanks for providing so much feedback, thats really helpful. I was going one directory deeper, then was shown. So if you open the Windows folder, the content of all direct child directories in that folder were loaded, basically C:\Windows\* was loaded, but NOT deeper, e.g. C:\Windows\System32\*. So the depth would be current+1. I solved that now, by only looking, if there is any folder/file in that sub directory, without actually loading and adding all folders/files to the TreeView. Instead I add a dummy child, so the Expand button is shown, but the complete content of that folder is only loaded, when expanding the item. So for every child, only FileFindFirstFile is called, instead of _FileListToArray (2x, once for folders, once for files) and there is always only one child added and not all folders/files. With the latest update (v2.2.0) the opening of a folder (Tested with C:\Windows) is pretty much instant for me.2 points -
BETA: SciTE v5x & lua Dynamic_include and "Smart" AutoComplete for Vars/UDFs/Abbrevs
SOLVE-SMART and one other reacted to Jos for a topic
Uploaded an updated installer that contains the fix for dynamic includes not reading the standard includes correctly. Thank you for the support @donnyh132 points -
BETA: SciTE v5x & lua Dynamic_include and "Smart" AutoComplete for Vars/UDFs/Abbrevs
SOLVE-SMART and one other reacted to Jos for a topic
Indeed still a small bug in there... Last tests I did was with multiple variables and that worked, but forgotten to test with a single one. Fixed that in the latest beta version v25.205.1420.6 Thanks for testing and reporting it! 🙂2 points -
Thanks for the feedback @SOLVE-SMART and @ValentinM! Both reference-peek and goto reference, via CTRL+Click use the same output from my extension, and i don't think my extension can know the difference of request. I am doing some refactoring currently to improve readability for the server/src/main.ts file, but will start to look into multiple declarations after. I think i will make multiple declaration information the default, and i can make the previous implementation available via a setting The next couple of changes to the extension will be major internally. I plan to implement partial AST tree updates, to reduce CPU usage, when writing in a file. I found out how important this is, after working on my AutoIt parser in Autoit, where any change would take seconds to re-parse the entire file, making multiple changes stack, resulting in the extension being unresponsive. With the parsing being faster I will be able to add implement a better way of keeping references to declarations for faster lookup. Basically everything will be much faster When the above have been implemented, i will start looking into static analysis, giving type hinting and allowing me to slowly add general error checking Edit: I have also started the process to be verified as a publisher on the vscode marketplace, to try and get rid of the warning message users get when trying to install my extensions currently (something somewhat new to my knowledge).2 points
-
You guys were so close! I tried @MattyD's code as completed by @Nine and the first run through I got the same old error message. But then I adjusted the line that creates the BSTR being passed in (the filename) by changing wstr to str. With that change, the call to the decryption DLL succeeded and I actually got back 12,677 bytes -- the exact number of bytes of the decrypted file contents. However, that string was jibberish instead of being the actual text. My guess was that the DLL was returning an ANSI string rather than Unicode, so I changed the $tBstr definition to use char rather than wchar. And it worked! I got my entire decrypted file contents just as pretty as you please. So here's the modified version that worked: Local $hDLL = DllOpen("XYZDECRYPT.DLL") Local $sFilename = "C:\Test\MyTestFile.xyz" Local $aCall = DllCall("OleAut32.dll", "ptr", "SysAllocString", "str", $sFilename) Local $aCall2 = DllCall($hDLL, "ptr", "DECRYPTXYZFILE", "ptr", $aCall[0], "long*", 0) Local $tBstr = DllStructCreate(StringFormat("long len;char str[%d]", $aCall2[2] + 1), $aCall2[0] - 4) ConsoleWrite("Char count received = " & $aCall2[2] & @CRLF) ConsoleWrite("Byte count received = " & $tBstr.len & @CRLF) ConsoleWrite("String received = " & $tBstr.str & @CRLF) DllCall("OleAut32.dll", "none", "SysFreeString", "ptr", $aCall[0]) DllCall("OleAut32.dll", "none", "SysFreeString", "ptr", $aCall2[0]) DllClose($hDLL) Thanks for the help! And quite impressive work seeing as how you didn't have access to the actual DLL for testing.2 points
-
FileExplorer Treeview and Listview (TreeListExplorer)
WildByDesign and one other reacted to Kanashius for a topic
@WildByDesign Thanks, I'm glad you like it. I hope you will like the rework even more. With the Rework I did now, AutoItObject is not needed anymore. It only uses UDFs included with AutoIt now. The reworked UDF also makes it really easy to show Files in the TreeView as well. Just set $bShowFiles to true when adding a view. I would encourage you to switch to the new UDF, as the old one was a more early work from me. It had some bugs and was a lot less performant. @argumentum Yes, I saw that too and it also had some design mistakes and is completely redone now. It should not have these issues anymore. But feel free to tell me, if you find some anyway2 points -
Good job again @MattyD. Not taking any merits here, but for completeness : Local $hDLL = DllOpen("XYZDECRYPT.DLL") Local $sFilename = "C:\Test\MyTestFile.xyz" Local $aCall = DllCall("OleAut32.dll", "ptr", "SysAllocString", "wstr", $sFilename) Local $aCall2 = DllCall($hDLL, "ptr", "DECRYPTXYZFILE", "ptr", $aCall[0], "long*", 0) Local $tBstr = DllStructCreate(StringFormat("long len;wchar str[%d]", $aCall2[2] + 1), $aCall2[0] - 4) ConsoleWrite("Char count received = " & $aCall2[2] & @CRLF) ConsoleWrite("Byte count received = " & $tBstr.len & @CRLF) ConsoleWrite("String received = " & $tBstr.str & @CRLF) DllCall("OleAut32.dll", "none", "SysFreeString", "ptr", $aCall[0]) DllClose($hDLL) ps. if there is memory leak, you should also consider freeing $aCall2[0]2 points
-
Ok - May have jumped the gun before, the previous version will likely fail. When using SysAllocString to create the bstr, the returned pointer takes us to the character array. The "length" field is in memory before this... Local $sFilename = "C:\Test\MyTestFile.xyz" $aCall = DllCall("OleAut32.dll", "ptr", "SysAllocString", "wstr", $sFilename) ;Create Bstring Local $iFilenameLen = StringLen($sFilename) Local $tBstrFilename = DllStructCreate(StringFormat("long Len;wchar Filename[%d]", $iFilenameLen + 1), $aCall[0] - 4) ;$aCall[0] is a ptr to the wchar array! ConsoleWrite("Char count = " & $iFilenameLen & @CRLF) ConsoleWrite("Byte count = " & $tBstrFilename.Len & @CRLF) ;should be double $iFilenameLen, as its a wstr ConsoleWrite($tBstrFilename.Filename & @CRLF) So to correctly pass a bstr, I think its something like this for unicode... ;Unicode version Local $sFilename = "C:\Test\MyTestFile.xyz" $aBstrCall = DllCall("OleAut32.dll", "ptr", "SysAllocString", "wstr", $sFilename) $aCall = DllCall("XYZDECRYPT.DLL", "ptr", "DECRYPTXYZFILE", "ptr", $aBstrCall[0], "long*", 0) Or this for ANSI... ;ANSI Vesrion Local $sFilename = "C:\Test\MyTestFile.xyz" $aBstrCall = DllCall("OleAut32.dll", "ptr", "SysAllocString", "str", $sFilename) $aCall = DllCall("XYZDECRYPT.DLL", "ptr", "DECRYPTXYZFILE", "ptr", $aBstrCall[0], "long*", 0)2 points
-
Visual Studio Code Extension currently available and future plans for SciTE?
SOLVE-SMART and one other reacted to Jos for a topic
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.2 points -
This "only" happens when it is the first variable we search for in a script. Please try this AutoIt3Wrapper.au3, and that example should also work now. Sorry about me being slow to understand that was an issue and only focussing on the PS1 & TASKS issue. EDIT: spend some time today to make the adding of include files process faster and updated the beta to v25.205.1420.5. Please check if that works better/faster for you too.2 points
-
_FileListToArray returning error code when running as administrator
Musashi and one other reacted to anthonyjr2 for a topic
Everything I saw online was saying to not use a mapped drive, as UNC paths would be ideal for admin scripts. The share has access set to "Everyone" so I don't think it would have been a permissions issue. However, I did some further googling and turns out adding EnableLinkedConnections as a key to the registry in "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" and restarting the PC fixed the problem. Something to do with allowing access to network locations in elevated processes. Thanks for the tip though, I will try mapping drives in the future if I run into other problems.2 points -
Not sure why this is working for you and the other version isn't, but think that it needs a little cleanup, so changed it to: { "version": "2.0.0", "tasks": [ { "label": "Add AutoIt Includes", "type": "shell", "command": "${config:autoit.aiPath}/SciTE/AutoIt3Wrapper/run_autoit3wrapper.ps1", "args": [ "-AutoitPath", "${config:autoit.aiPath}", "-Options", "/addincludes", "-ScriptFile", "${file}" ], "presentation": { "reveal": "always", "panel": "shared", "echo": false, "showReuseMessage": false, "clear": true }, "problemMatcher": [], "detail": "Add missing includes to the AutoIt script", }, { "label": "Run Au3Stripper", "type": "shell", "command": "${config:autoit.aiPath}/SciTE/AutoIt3Wrapper/run_autoit3wrapper.ps1", "args": [ "-AutoitPath", "${config:autoit.aiPath}", "-Options", "/au3stripper", "-ScriptFile", "${file}" ], "presentation": { "reveal": "always", "panel": "shared", "echo": false, "showReuseMessage": false, "clear": true }, "problemMatcher": [], "detail": "Strip/Merge your script" } ] } This version is also working for me and looks a little more straightforward.2 points
-
GUIDelete()
mr-es335 and one other reacted to argumentum for a topic
Does sound better than "GUI destroy".2 points -
THE TITLE SAY'S ALL. Image SearchAllVersion.zip2 points
-
Hi Sven, thanks for your detailed explanations, I didn't know about this feature. Yes, I was talking about Ctrl+Shift+F (and Ctrl+F as well depending on context). Even if this feature is very useful, I still think it shouldn't be the default behaviour (still in my opinion) as when I "Ctrl+Click" a variable, I'm used to instantly reach its definition. But yes, this feature should be available. Regards !2 points
-
[Completed] Volunteers wanted 👀 to test an AutoIt + SQLite project
argumentum and one other reacted to genius257 for a topic
A lot of changes are missing from that version of the history, you need to check autoit_changelog_complete.txt. Earliest reference to Maps i can find is 3.3.13.6 (18th, 2014) (Beta), where it changed from being called Tables to Maps, but i cannot find any references to Tables earlier at a glance.2 points -
Simulated Title Bar
pixelsearch and one other reacted to CYCho for a topic
I simulated a title bar for my zPlayer in order to utilize the empty space in the title bar. That was necessary because I wanted to keep the size of the GUI to the minimum. In the case of zPlayer, the GUI was not resizable, so It did not not need the UpdateCoverPosition( ) function. I added it as an idea if it is necessary. Edit: One may ask why I did not use a popup window for the entire GUI. Because I liked the 3-D like effect and the drop shadow of GUIs created in Windows 11. and a popup window does not have these features. #include <GUIConstants.au3> #include <WinAPIGdi.au3> Global $guiWidth = 320, $guiHeight = 100, $barColor = 0x198CFF Global $hGUI, $borderWidth, $barHeight, $GUIPos, $ClientPos Global $hCover, $idMinimize, $ctrlClose, $hRgn, $aMsg, $sMsg $hGUI = GUICreate("", $guiWidth, $guiHeight, -1, -1, $WS_OVERLAPPEDWINDOW) $GUIPos = WinGetPos($hGUI) $ClientPos = WinGetClientSize($hGUI) $borderWidth = ($GUIPos[2] - $ClientPos[0])/2 $barHeight = $GUIPos[3] - $ClientPos[1] - $borderWidth $hCover = GUICreate("", $ClientPos[0]+1, $barHeight, $GUIPos[0]+$borderWidth, $GUIPos[1]+1, $WS_POPUP, -1, $hGUI) GUISetBkColor($barColor, $hCover) GUISetFont(12, 400, 0, "Arial") GUICtrlCreateIcon("user32.dll", 101, 5, 5, 20, 20) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKSIZE) GUICtrlCreateLabel("Colored Bar Example", 30, 7, 160, 20) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKSIZE) $ctrlClose = GUICtrlCreateLabel("X", $guiWidth-40, 1, 40, $barHeight, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, $barColor) GUICtrlSetColor(-1, 0x404040) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKSIZE) GUISetState(@SW_SHOW, $hCover) GUISetState(@SW_SHOW, $hGUI) If @OSVersion = "WIN_11" Then ; Create round corners for $hCover $hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $ClientPos[0]+1, $barHeight+10, 13, 13) _WinAPI_SetWindowRgn($hCover, $hRgn) _WinAPI_DeleteObject($hRgn) EndIf GUIRegisterMsg($WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED") AdlibRegister("_ColorButton", 100) While 1 $aMsg = GUIGetMsg(1) $sMsg = $aMsg[0] Switch $aMsg[1] Case $hCover Switch $sMsg Case $ctrlClose ExitLoop Case $GUI_EVENT_PRIMARYDOWN ; Click and drag $hCover DllCall("user32.dll", "int", "SendMessageW", "hwnd", $hCover, "uint", $WM_NCLBUTTONDOWN, "wparam", $HTCAPTION, "lparam", 0) EndSwitch EndSwitch WEnd Func WM_WINDOWPOSCHANGED($hWnd, $MsgID, $wParam, $lParam) ; Sync movement of $hGUI and $hCover #forceref $MsgID, $wParam, $lParam Switch $hWnd Case $hCover Local $aPos = WinGetPos($hCover) WinMove($hGUI, "", $aPos[0]-$borderWidth, $aPos[1]-1) Case $hGUI UpdateCoverPosition() EndSwitch Return $GUI_RUNDEFMSG EndFunc Func _ColorButton() ; Change background color of buttons when the mouse is over them Local $aArray = GUIGetCursorInfo($hCover) If $aArray[4] = $ctrlClose Then GUICtrlSetBkColor($ctrlClose, 0xC42B1C) GUICtrlSetColor(-1, 0xFFFFFF) Else GUICtrlSetBkColor($ctrlClose, $barColor) GUICtrlSetColor(-1, 0x404040) EndIf EndFunc Func UpdateCoverPosition() $GUIPos = WinGetPos($hGUI) $ClientPos = WinGetClientSize($hGUI) WinMove($hCover, "", $GUIPos[0]+$borderWidth, $GUIPos[1]+1, $ClientPos[0]+1, $barHeight) If @OSVersion = "WIN_11" Then ; Update round corners for $hCover $hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $ClientPos[0]+1, $barHeight+10, 13, 13) _WinAPI_SetWindowRgn($hCover, $hRgn) _WinAPI_DeleteObject($hRgn) EndIf EndFunc2 points -
@CYCho, testing on Windows 7, the resize does not function correctly - the title bar does not resize while the edge is dragged, only when the drag ends.2 points
-
Just uploaded SciTEx86.zip & SciTEx64.zip which contain the Latest SciTE 5.5.5 versions released 25 February 2025, for those that like to use the latest version of SciTE Full. This will also be part of the final update soon of SciTE4AutoIt3.2 points
-
[Completed] Volunteers wanted 👀 to test an AutoIt + SQLite project
genius257 and one other reacted to SOLVE-SMART for a topic
@argumentum Understood, well you're right and I will change the slashes. Important: of course I am the "sql sensei" - everybody knows that 🤣 - irony mode off. The project was not planned as a teaching tool. I wanted to have an easy starting point when it came to questions about SQLite usage. Then I could add concrete examples. The current ones are just tiny showcases, not more. That's why I have to think about how this can and should develop. Thank you too @genius257 for your statement🤝 . I am not sure yet. But as you can read few lines above, I try to figure out how this can and should develop. Exactly, this is intended for now. Please see this litte paragraph - I don't try to create another SQL(ite) UDF. I like that summary very much, thanks. I also have to think about it - but sounds very reasonable. All fine genius257, I appreciate every ideas, suggestions etc. so thanks again. Agreed, I will use "\" slashes and will be consistent throughout the project. 💡 At the moment, my intention was to test the current state. Test by different situations/systems/circumstances. It's a pretty early version of the project, so there will probably more changes soon. And I am very curious what you guys will say about the upcoming (bigger projects). Stay tuned 😀 . Best regards Sven2 points -
CryptoNG UDF - Cryptography API: Next Gen
Werty and one other reacted to argumentum for a topic
... Func __CryptoNG_BcryptImportKeyPair($hAlgorithmProvider, $sKeyBlobFile, $sKeyBlobType, $xKeyBlob = Binary("")) If $__gbDebugging Then _DebugOut(@CRLF & "Function: __CryptoNG_BcryptImportKeyPair()") Local $aResult[0] Local $iError = 0, _ $iStatusCode = 0 Local $tBuffer = "" Local $hFile = -1, _ $hKey = -1 ;~ Local $xKeyBlob = Binary("") If $xKeyBlob = Binary("") Then ;Make sure file exists If Not FileExists($sKeyBlobFile) Then Return SetError(3, 0, "") ;Read binary blob file $hFile = FileOpen($sKeyBlobFile, $FO_BINARY) If $hFile = -1 Then Return SetError(4, 0, "") $xKeyBlob = FileRead($hFile) FileClose($hFile) EndIf ... Placing $xKeyBlob as a parameter I think would work nicely2 points -
Here another approach to display large MsgBox (based only on mouse). I had this code for WMI when lots of properties need to be shown : #include <Constants.au3> #include <WinAPIProc.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <WinAPIConstants.au3> Opt("MustDeclareVars", True) Global Const $tagMOUSEHOOKSTRUCT = $tagPOINT & ";hwnd hwnd;uint wHitTestCode;ulong_ptr dwExtraInfo;dword mouseData;" Global $hHook Example() Func Example() Local $hStub = DllCallbackRegister(WH_MOUSE, "LRESULT", "int;wparam;lparam") $hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE, DllCallbackGetPtr($hStub), 0, _WinAPI_GetCurrentThreadId()) Local $sList = "First line here" & @CR For $i = 2 To 200 $sList &= "Line " & $i & @CR Next $sList &= "Last line here" Local $iRep = MsgBox($MB_OKCANCEL, "Example", $sList) _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hStub) EndFunc ;==>Example Func WH_MOUSE($iMsg, $wParam, $lParam) If $iMsg Then Return _WinAPI_CallNextHookEx($hHook, $iMsg, $wParam, $lParam) Local $tMouse = DllStructCreate($tagMOUSEHOOKSTRUCT, $lParam) Local $hWnd = _WinAPI_GetAncestor($tMouse.hwnd, $GA_ROOT) If $wParam = $WM_MOUSEWHEEL Then Local $iDir = _WinAPI_HiWord($tMouse.mouseData) WinMove($hWnd, "", WinGetPos($hWnd)[0], WinGetPos($hWnd)[1] + ($iDir / 3)) ElseIf $wParam = $WM_LBUTTONDOWN Then If $tMouse.hwnd = $hWnd Then WinMove($hWnd, "", WinGetPos($hWnd)[0], 0) ElseIf $wParam = $WM_RBUTTONDOWN Then WinMove($hWnd, "", WinGetPos($hWnd)[0], @DesktopHeight - WinGetPos($hWnd)[3] - 50) EndIf Return _WinAPI_CallNextHookEx($hHook, $iMsg, $wParam, $lParam) EndFunc ;==>WH_MOUSE Left click will bring you to top Right click will bring you to bottom Mouse wheel to scroll the MsgBox Enjoy !2 points
-
Ah yes, you're right. I forgot about that. You cannot import a LEGACY_RSAPUBLIC_BLOB using BCryptImportKeyPair. However, you can import a LEGACY_RSAPRIVATE_BLOB (if it is available). And from that LEGACY_RSAPRIVATE_BLOB, you can export an RSA public key blob and/or an RSA private key blob. The conversion of just a legacy public key blob or PEM to an RSA public key blob would be a little more difficult...but still doable. I'll put that on my list of feature requests for CryptoNG.2 points
-
@kroman82 I have uploaded a new version of CryptoNG. The new version includes a function (_CryptoNG_RSA_CreateKeyPairEx) that will export both types of blob files (RSA and MS/Legacy). The RSA blob files are needed by Microsoft's CryptoNG API's (which are what my UDF creates wrappers for). The MS blob files can be used to generate PEM or DER files that can be used with OpenSSL or any other crypto library that has RSA functions. Here is an updated CryptoNG example that uses the new function: Func rsa_public_private_key_encrypt_decrypt_data_example() Const $ALG_ID = $CNG_BCRYPT_RSA_ALGORITHM, _ $MESSAGE = "This is a super-secret message.", _ $RSA_PUBLIC_KEY_FILE = "rsa_publickey.blob", _ $RSA_PRIVATE_KEY_FILE = "rsa_privatekey.blob", _ $MS_PUBLIC_KEY_FILE = "ms_publickey.blob", _ $MS_PRIVATE_KEY_FILE = "ms_privatekey.blob" Local $sDecryptedMessage = "" Local $xEncryptedMessage = Binary("") ;Create RSA Public/Private Key Pair _CryptoNG_RSA_CreateKeyPairEx(1024, $RSA_PUBLIC_KEY_FILE, $RSA_PRIVATE_KEY_FILE, $MS_PUBLIC_KEY_FILE, $MS_PRIVATE_KEY_FILE) If @error Then write_to_log("ERROR: " & _CryptoNG_LastErrorMessage() & @CRLF) Return False EndIf ;Encrypt plain text message $xEncryptedMessage = _CryptoNG_RSA_EncryptData($MESSAGE, $RSA_PUBLIC_KEY_FILE) If @error Then write_to_log("ERROR: " & _CryptoNG_LastErrorMessage() & @CRLF) Return False EndIf ;Decrypt encrypted message $sDecryptedMessage = _CryptoNG_RSA_DecryptData($xEncryptedMessage, $RSA_PRIVATE_KEY_FILE) If @error Then write_to_log("ERROR: " & _CryptoNG_LastErrorMessage() & @CRLF) Return False EndIf ;Display results write_to_log(@CRLF) write_to_log("CryptoNG Asymmetric Public/Private Key Encrypt/Decrypt Example" & @CRLF) write_to_log(StringFormat("%s Public key file = %s", $ALG_ID, $RSA_PUBLIC_KEY_FILE) & @CRLF) write_to_log(StringFormat("%s Private key file = %s", $ALG_ID, $RSA_PRIVATE_KEY_FILE) & @CRLF) write_to_log(StringFormat("%s Plain text message = %s", $ALG_ID, $MESSAGE) & @CRLF) write_to_log(StringFormat("%s Encrypted Message = %s", $ALG_ID, $xEncryptedMessage) & @CRLF) write_to_log(StringFormat("%s Decrypted Message = %s", $ALG_ID, $sDecryptedMessage) & @CRLF) EndFunc Result: CryptoNG UDF v2.3.0 CryptoNG Asymmetric Public/Private Key Encrypt/Decrypt Example RSA Public key file = rsa_publickey.blob RSA Private key file = rsa_privatekey.blob RSA Plain text message = This is a super-secret message. RSA Encrypted Message = 0x09240F7929B217338E10B94C6B481027C61B1C41080A806C02019A724B06991190BEFF5A27FBF17E0E6550067FAEAAB504936B2F4A55C0C2CC37F788B18C276CC31DCD339A5084FFF66A12E9598EF79432975EEE7A347F899AA38661B2FF3330418882F29A8B52012D8B57B85CF4DBD9924D7C606BE3A056FD66295B2D139B32 RSA Decrypted Message = This is a super-secret message. Done Upon successful execution of _CryptoNG_RSA_CreateKeyPairEx(), you should see the 4 blob files. To create PEM public/private key files for use by your server or other RSA crypto library functions, you can use OpenSSL to create PEM files like this. You can also create DER files by changing the -outform parameter. OpenSSL commands to convert MS KEYBLOB files to PEM files ---------------------------------------------------------- openssl rsa -pubin -inform "MS PUBLICKEYBLOB" -in ms_publickey.blob -outform PEM -out ms_publickey.pem openssl rsa -inform "MS PRIVATEKEYBLOB" -in ms_privatekey.blob -outform PEM -out ms_privatekey.pem2 points
-
I see now. I believe OP can manage to change the links in the loop the way he wants it to. I know it is a very difficult task but it is feasible2 points
-
There is numerous converting functions inside ntdll.dll and msvcrt.dll (you can search for it). Here what you want to achieve very easily : ConsoleWrite(_Ui32ToString(0x87654321, 2) & @CRLF) ConsoleWrite(_Ui32ToString(2684354560, 2) & @CRLF) Func _Ui32ToString($i, $base) Return DllCall("ntdll.dll", "str:cdecl", "_ultoa", "ulong", $i, "str", "", "int", $base)[0] EndFunc2 points
-
HAHA, major speed increase, we've been doing it wrong, we've been using _WinAPI_GetDC(0) all the time which is the whole desktop, when we should have been using _WinAPI_GetWindowDC() instead, it's now like 5 times faster for me as it went from the whole desktop @3440x1440 to the test gui I've been using @640x480, and speed increased dramatically. Changes to make... $hDDC = _WinAPI_GetDC(0) ;should be $hDDC = _WinAPI_GetWindowDC($tool) ;Change $posx and $posy to point at the correct spot, this is now not from the desktop 0,0 but from the tools.exe windows start position. So speed increase depends on the size of the tools.exe window, maybe you can even resize it to be smaller. Times i get now for full cycle with bitblt and all... 0.5085 0.5136 1.3745 0.5044 0.4402 0.4155 0.9733 Try it and report back with times, it's awesome.2 points
-
Regarding speed maybe it makes a difference with stretchblt directly going to a smaller size instead of bitblt Example for screenshot in a smaller size. #include <GDIPlus.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Func CaptureAndResize($savePath, $newWidth, $newHeight) ; GDI+ initialiseren _GDIPlus_Startup() ; Schermresolutie ophalen Local $iScreenWidth = @DesktopWidth Local $iScreenHeight = @DesktopHeight ; HDC's ophalen Local $hDC = _WinAPI_GetDC(0) Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC) ; Bitmap maken Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iScreenWidth, $iScreenHeight) Local $hOldObj = _WinAPI_SelectObject($hMemDC, $hBitmap) ; Scherminhoud kopiëren met StretchBlt (resize mogelijk) _WinAPI_StretchBlt($hMemDC, 0, 0, $newWidth, $newHeight, $hDC, 0, 0, $iScreenWidth, $iScreenHeight, $SRCCOPY) ; Screenshot opslaan als bestand _ScreenCapture_SaveImage($savePath, $hBitmap) ; Opruimen _WinAPI_SelectObject($hMemDC, $hOldObj) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) _WinAPI_ReleaseDC(0, $hDC) _GDIPlus_Shutdown() EndFunc ; Gebruik de functie om een screenshot te maken en te resizen naar 800x600 CaptureAndResize(@UserProfileDir & "\downloads\examples\" & "screenshot_resized.jpg", 800, 600)2 points
-
Interesting usage of Security Descriptor/Attribute. I wouldn't have thought of using it this way. I need to dig a bit more to fully understand the intrinsic. But in any case, at first glance, there is no need to have a DLL or C++ to perform the task. All I have seen is simple calls to WinAPI. Everything could be performed inside AutoIt (like I said at first glance). I will look into this later today and come back.2 points
-
I can't divulge everything of the meeting with the department of child safety, and will not over the internet, but let's just say today was the first big day of more to come, and tilted greatly in my favor. 😁2 points
-
Visual Studio Code Extension currently available and future plans for SciTE?
WildByDesign and one other reacted to ValentinM for a topic
FYI, this feature doesn't come from VSCode itself but from GitHub Copilot, which is an AI helper using GPT-4 that predicts code based on your files (I can't remember if it sticks to the current file or more, but it was originally supposed to only read the current one). It not only predicts the right includes but is also excellent at making loops, filling arrays, etc. However, it can be quite bad at other tasks. It learns from your code and can read your comments, so you can implicitly give it directives. For example: So keep in mind that it could mess with the includes as well. But I use it daily, and it helps me more than it hurts my brain 😀 In the past, you had to be a student, teacher, or pay for access to Copilot, but I can see on their website that it has become free. To use it, you have to install this extension and probably sign in or sign up for a GitHub account. EDIT : Autocompletion is made by pressing TAB.2 points -
Visual Studio Code Extension currently available and future plans for SciTE?
WildByDesign and one other reacted to Jos for a topic
But you could still use the initial version I made with AutoIt3Wrapper, which is implemented in AutoIt3Wrapper and still there: I am not fully up-to-speed on the best way to add own stuff to VSCode but this works fine for me: // filepath: vscode-userdata:/c%3A/Users/.../AppData/Roaming/Code/User/tasks.json { "version": "2.0.0", "tasks": [ { "label": "Add AutoIt Includes", "type": "shell", "command": "${config:autoit.aiPath}\\Autoit3.exe", "args": [ "${config:autoit.aiPath}\\SciTE\\AutoIt3Wrapper\\AutoIt3Wrapper.au3", "/addincludes", "/in", "${file}" ], "group": { "kind": "build", "isDefault": true }, "problemMatcher": [], "detail": "Add missing includes to the AutoIt script" } ] } // keybindings.json [{ "key": "ctrl+shift+z", "command": "workbench.action.tasks.runTask", "args": "Add AutoIt Includes", "when": "editorTextFocus && editorLangId == 'autoit'" }]2 points