Leaderboard
Popular Content
Showing content with the highest reputation since 09/10/2025 in all areas
-
I compiled Zint v2.15.09 source and it has 30 functions! ZBarcode_BarcodeName|0x0001CBA0 ZBarcode_Buffer|0x0001CC20 ZBarcode_Buffer_Vector|0x0001CC60 ZBarcode_Cap|0x0001CCA0 ZBarcode_Clear|0x0001D270 ZBarcode_Create|0x0001D390 ZBarcode_Default_Xdim|0x0001D3C0 ZBarcode_Delete|0x0001D5D0 ZBarcode_Dest_Len_ECI|0x0001D630 ZBarcode_Encode|0x0001D6D0 ZBarcode_Encode_File|0x0001D710 ZBarcode_Encode_File_and_Buffer|0x0001DB00 ZBarcode_Encode_File_and_Buffer_Vector|0x0001DB50 ZBarcode_Encode_File_and_Print|0x0001DBA0 ZBarcode_Encode_Segs|0x0001DBE0 ZBarcode_Encode_Segs_and_Buffer|0x0001E890 ZBarcode_Encode_Segs_and_Buffer_Vector|0x0001E8F0 ZBarcode_Encode_Segs_and_Print|0x0001E950 ZBarcode_Encode_and_Buffer|0x0001E990 ZBarcode_Encode_and_Buffer_Vector|0x0001EA10 ZBarcode_Encode_and_Print|0x0001EA90 ZBarcode_HaveGS1SyntaxEngine|0x0001EAF0 ZBarcode_NoPng|0x0001EB00 ZBarcode_Print|0x0001EB10 ZBarcode_Reset|0x0001EC30 ZBarcode_Scale_From_XdimDp|0x0001ECA0 ZBarcode_UTF8_To_ECI|0x0001EE80 ZBarcode_ValidID|0x0001EF40 ZBarcode_Version|0x0001EF80 ZBarcode_XdimDp_From_Scale|0x0001EF90 I will update the code in the next days. I compiled also a x64 Zint DLL but I don't know if it is working yet...4 points
-
💡 Did You Know AutoIt’s Truthiness Rules Can Surprise You? Or that empty strings are False but "0" (as a string) is True? Or that Not $variable doesn’t work the way you might think? 🔍 Understanding Logical Expression Evaluation in AutoIt When working with AutoIt, one of the subtle but important differences compared to languages like C, JavaScript, or Python is how logical expressions are evaluated. 👉 AutoIt does not have a dedicated Boolean type. Instead, it uses other values (strings, numbers, etc.) and interprets them as True or False. This article breaks down AutoIt’s “truthiness rules” and explains what Not $variable really means. 1️⃣ No Boolean Type in AutoIt Unlike many languages, AutoIt does not define a bool type. Instead: Strings and numbers are interpreted as logical values. A function or expression that “returns True/False” is really returning an integer (1 or 0). 2️⃣ Truthiness Rules When AutoIt evaluates a value in a conditional (If, While, etc.): "" (empty string) → False 0 (number) → False Any non-empty string → True Any non-zero number → True ✅ Examples: If "" Then MsgBox(0, "Test", "This will NOT show") ; False If "hello" Then MsgBox(0, "Test", "This WILL show") ; True If 0 Then MsgBox(0, "Test", "This will NOT show") ; False If -1 Then MsgBox(0, "Test", "This WILL show") ; True 3️⃣ What Does Not $variable Do? The Not operator simply inverts the truthiness of a value. ConsoleWrite(Not "" & @CRLF) ; 1 (True) ConsoleWrite(Not "abc" & @CRLF) ; 0 (False) ConsoleWrite(Not 0 & @CRLF) ; 1 (True) ConsoleWrite(Not 123 & @CRLF) ; 0 (False) 👉 In plain: Not $variable is like asking “is this variable empty or zero?” 4️⃣ Real Example: _PathFull UDF In the standard UDF File.au3, the function _PathFull has this line: If Not $sRelativePath Or $sRelativePath = "." Then Return $sBasePath This handles two cases: $sRelativePath is "" → return the base path. $sRelativePath is "." → return the base path (current directory). 💡 This works because AutoIt treats an empty string as False. 5️⃣ Common Pitfalls ❌ Pitfall 1: Expecting False to exist Local $x = False If $x Then MsgBox(0, "Result", "Will this show?") ; False is just 0, there’s no real Boolean type. ❌ Pitfall 2: Forgetting that "0" (string) is True If "0" Then MsgBox(0, "Result", "This WILL show!") ; Non-empty string = True ; But numeric 0 would be False. ❌ Pitfall 3: Misunderstanding Not Local $val = "hello" If Not $val Then MsgBox(0, "Result", "Will this show?") ; Never runs because "hello" = True EndIf ✅ Key Takeaways AutoIt has no Boolean type — just numbers and strings used as truth values. "" (empty string) and 0 (numeric) = False. Everything else = True. "0" (string) = True, but 0 (number) = False. Not $var = “is this variable empty or zero?”. 📝 Conclusion Understanding AutoIt’s truthiness rules is essential for writing reliable conditions. They make scripts concise, but can be surprising if you expect strict Boolean behavior. 👉 Pro Tip: Use AutoIt’s implicit truthiness for quick checks, but when clarity matters, be explicit: Use StringLen() to check if a string is empty. Don't use IsNumber() if you don't understand it, read more here. Use comparisons (=, <>) for precise logic. That way, your intent is clear, and you avoid bugs caused by AutoIt’s flexible but tricky truth rules. 💬 Final Note: If I’ve misunderstood or explained something incorrectly, please share your thoughts — I’d be happy to update and improve this article!3 points
-
Did You Know How AutoIt Evaluates Logical Expressions?
SOLVE-SMART and 2 others reacted to AspirinJunkie for a topic
What exactly leads you to this conclusion? This cannot be deduced from your following text. All of this can be explained perfectly by the fact that there are specific rules for converting other data types to the Boolean data type. There is nothing explicitly against the existence of a corresponding dedicated Boolean data type. Nope - if that were the case, they would behave exactly the same way - but they don't: ConsoleWrite("compare with int type: " & ("0" = retInt() ? True : False) & @CRLF) ConsoleWrite("compare with bool type: " & ("0" = retBool() ? True : False) & @CRLF) Func retInt() Return 1 EndFunc Func retBool() Return True EndFunc The following are also converted to False during conversion to Boolean: Global $aArray[1] Global $mMap[] If $aArray Then MsgBox(0, "", "Array = True") If $mMap Then MsgBox(0, "", "Map = True") If ObjCreate("Scripting.Dictionary") Then MsgBox(0, "", "Object = True") If Default Then MsgBox(0, "", "Default = True") If Ptr(0x0) Then MsgBox(0, "", "Ptr(0) = True") If DllStructCreate("CHAR[1]") Then MsgBox(0, "", "DllStruct = True") If ConsoleWrite Then MsgBox(0, "", "Function pointer = True") Basically, this discussion only touches superficially on logical expressions in AutoIt. In fact, the behavior is only a consequence of the real topic: Implicit data type conversions in AutoIt: AutoIt (like many other languages) is a dynamically typed language. In other words, variables do not have a fixed data type; instead, this can be changed at will during the lifetime of the variable. Nevertheless, variables can be linked together as desired using operators. But internally, at the machine level, only identical data types can be linked together. For example, addition is only possible between two Int32s and not between a Double and an Int32, etc. Therefore, one task of the AutoIt interpreter in operations with multiple operands or when the operation requires a specific target data type is to align the different data types with each other. AutoIt defines fixed rules for how certain data types are converted into others. Integers, for example, are converted to floats by considering the value as the integer part of the resulting float. How exactly certain data types are converted to the Boolean data type (yes, Boolean is explicitly listed as a separate data type) is described in part in the >>AutoIt help<<. Specifically, it says the following, for example: This explains exactly the behavior you described above. And we're not even talking about logical expressions yet - it's just about implicit data type conversion. If you keep in mind that logical operators and the if branch must have the expression as a Boolean, it quickly becomes clear that this is not actually about the behavior of logical expressions, but rather that they are only a consequence of the implicit data type conversion of other data types to the Boolean data type. In summary: The behavior described above describes the effects of implicit conversion of other data types to the Boolean data type. Everything described can be explained completely by this. However, I do not see the slightest indication in the description that AutoIt should not have a dedicated boolean data type.3 points -
AutoIt v3.3.18.0 has been released - mainly a UDF release. Thanks to @jpm and the MVPs who were responsible for the majority of code in this version. Download it here. Complete list of changes: History3 points
-
New version available.2 points
-
UDF and DLL updated! See post#1. The DLLs are too big to post it here. You can find it on my 1Drv! Feel free to post examples here!2 points
-
Disable combobox selection frame
WildByDesign and one other reacted to argumentum for a topic
#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <ComboConstants.au3> Local $hGUI = GUICreate("COMBOBOX", 500, 500) GUISetBkColor(0xE9E6DF) Local $idBttnFocus = GUICtrlCreateButton("=P", -20, -20, 5, 5) ; my trick Local $idComboBox = GUICtrlCreateCombo("Item 1", 100, 200, 260, 20, $CBS_DROPDOWNLIST) GUICtrlSetFont(-1, 18, 700, 0, "Segoe UI", 4) GUICtrlSetData($idComboBox, "COMBOBOX|COMBOBOX1|COMBOBOX2|COMBOBOX3", "COMBOBOX") ; WildByDesign ;~ Global Const $WM_CHANGEUISTATE = 0x0127 ;~ GUICtrlSendMsg($idComboBox, $WM_CHANGEUISTATE, 65537, 0) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) ..am a bit late but, this is what I use.2 points -
Disable combobox selection frame
argumentum and one other reacted to WildByDesign for a topic
GUICtrlSendMsg($idComboBox, $WM_CHANGEUISTATE, 65537, 0) Try this.2 points -
I just came across some odd behavior when automating a third party software app. On this third party app, there's a dialog with an edit control where you can enter an ID number that's 9 digits long. As soon as you enter the 9th digit the app immediately checks to see if it recognizes the ID as being an existing customer and if it does, it pops up a modal Yes/No window asking if you want to autofill the customer's information on the rest of the dialog. This popup correctly occurs whether my AutoIt app fills the edit control with 9 digits using ControlSetText or ControlSend. My AutoIt app needs to know whether the popup happens in order to determine its next action, so I follow the ControlSetText or ControlSend with a WinWait call looking for the popup, with a 2 second timeout. Here's where the odd behavior comes. If I fill the edit control using ControlSetText and the popup window appears, my WinWait doesn't start looking for the popup window until after the user has clicked Yes or No on it (and thereby dismissed the window). The AutoIt app just sits there idle the entire time that the Yes/No window is visible. Then as soon as the user clicks Yes or No (and dismisses the modal window), the WinWait immediately begins looking for that (now dismissed) window and of course never finds it. If I instead fill the edit control with ControlSend, AutoIt doesn't hang while the Yes/No window is visible, and WinWait immediately finds the window as expected. My guess is that the 3rd party app is popping up the modal Yes/No window before the original dialog can provide the return code from ControlSetText's underlying SendMessage command (probably due to some improper subclassing in the 3rd party app that shows the popup dialog before allowing the WndProc function to complete its operation and return a value). As a result, AutoIt is left sitting there waiting for that message before the ControlSetText function completes and it can move on to the next line of the script. Once the user dismisses the modal Yes/No window and the original dialog can continue, the return code gets received by AutoIt, the ControlSetText command finishes, and the script continues. With the ControlSend command, AutoIt apparently doesn't get stuck waiting for a return message, and can proceed with finding the window and acting accordingly. So I'm not looking for a solution, since using ControlSend is the workaround. Just posting here in case someone else comes across something similar and is banging their head on the keyboard as I was.2 points
-
Thank you very much ioa747 , that's exactly what I was looking for 🙂 Have a great weekend, both of you. Reggards2 points
-
Microsoft Edge - WebView2, embed web code in your native application
SOLVE-SMART and one other reacted to mLipok for a topic
May you release it on github.com ? Then we be able to look over enttire udf and have a better look2 points -
MustReturnArray()
Danyfirex and one other reacted to argumentum for a topic
#include <WinAPIProc.au3> ; for the example Func MustReturnArray($aArray, $iColumns = 0, $iErr = @error, $iExt = @extended) If UBound($aArray) Then Return SetError($iErr, $iExt, $aArray) If $iColumns Then Dim $aArray[1][$iColumns] = [[0]] Else Dim $aArray[1] = [0] EndIf Return SetError($iErr, $iExt, $aArray) EndFunc ;==>MustReturnArray Exit MustReturnArray_Example() Func MustReturnArray_Example() ; worry free return Local $aWinList = WinList("nah, is not there") For $n = 1 To $aWinList[0][0] ConsoleWrite($aWinList[$n][1] & @TAB & $aWinList[$n][0] & @CRLF) Next ; worry free return Local $aProcessList = ProcessList("nah, is not there") For $n = 1 To $aProcessList[0][0] ConsoleWrite($aProcessList[$n][1] & @TAB & $aProcessList[$n][0] & @CRLF) Next ; solution ; create a "worry free return" Local $aArray = MustReturnArray(_WinAPI_EnumProcessWindows(4), 2) For $n = 1 To $aArray[0][0] ConsoleWrite($aArray[$n][1] & @TAB & $aArray[$n][0] & @CRLF) Next ; problem ; not a "worry free return" Local $aArray = _WinAPI_EnumProcessWindows(4) For $n = 1 To $aArray[0][0] ConsoleWrite($aArray[$n][1] & @TAB & $aArray[$n][0] & @CRLF) Next EndFunc ;==>MustReturnArray_Example Before I start with my problem ( and solution ), a big thank you to everyone coding these UDFs. AutoIt would not be what it is without them. ... a coder should always check @error, but is a pain, or not. In any case, the internal AutoIt functions return an array even if nothing there when an array is what it returns on success. Am so used to it, that when I use a UDF function I have to RTFM and I don't like reading ( nor writing but here we are 🤷♂️ ) How should I solve this problem given my coding style that does not include a failing function returning a zero stead of the array I was expecting. AutoIt does it, why does the UDFs not do it ?, ... must be a professional coders thing but, am a scripter. I write scripts. So, if it should return an array, then MustReturnArray() !. I hope this idea/function helps you avoid the " ==> Subscript used on non-accessible variable. " and/or simplify your code2 points -
Help File/Documentation Issues. (Discussion Only)
Musashi and one other reacted to pixelsearch for a topic
@donnyh13 Hi When we discussed this with @jchd and @jpm in Trac Ticket #3945 then the last table at the end of the web page showed the results with a better alignment, I'm pasting it below : Row Unicode CharacterName \h \v \s [[:space:]] [[:blank:]] -------------------------------------------------------------------------------- # 1 0x0009 HT xX xX xX xX # 2 0x000A LF xX xX xX # 3 0x000B VT xX xX xX # 4 0x000C FF xX xX xX # 5 0x000D CR xX xX xX # 6 0x0020 SPACE xX xX xX xX # 7 0x0085 NEL xX X X # 8 0x00A0 NO-BREAK SPACE xX X X X # 9 0x1680 OGHAM SPACE MARK xX X X X # 10 0x180E MONGOLIAN VOWEL SEPARATOR xX X X X # 11 0x2000 EN QUAD xX X X X # 12 0x2001 EM QUAD xX X X X # 13 0x2002 EN SPACE xX X X X # 14 0x2003 EM SPACE xX X X X # 15 0x2004 THREE-PER-EM SPACE xX X X X # 16 0x2005 FOUR-PER-EM SPACE xX X X X # 17 0x2006 SIX-PER-EM SPACE xX X X X # 18 0x2007 FIGURE SPACE xX X X X # 19 0x2008 PUNCTUATION SPACE xX X X X # 20 0x2009 THIN SPACE xX X X X # 21 0x200A HAIR SPACE xX X X X # 22 0x2028 LINE SEPARATOR xX X X # 23 0x2029 PARAGRAPH SEPARATOR xX X X # 24 0x202F NARROW NO-BREAK SPACE xX X X X # 25 0x205F MEDIUM MATHEMATICAL SPACE xX X X X # 26 0x3000 IDEOGRAPHIC SPACE xX X X X Legend : xX will match with or without (*UCP) in the pattern X alone will match ONLY if (*UCP) is present at the start of the pattern For example let's create a subject starting with "abc" followed by a no-break space (0x00A0) and ending with "def" , so the subject looks like this "abc def" (make sure there is a no-break space in the middle of the subject between abc and def) . Now let's test different patterns : ======================= 2 patterns searching for \h abc\hdef => 1 match (*UCP)abc\hdef => 1 match Both patterns match because xX is indicated for \h (concerning the no-break space) ======================= 2 patterns searching for \s abc\sdef => NO match (*UCP)abc\sdef => 1 match Only the pattern starting with (*UCP) matches because X is indicated for \s (concerning the no-break space) This example could be applied to any of the 26 characters found in the table above Hope it helps2 points -
ProcessExists ,ProcessClose, FileReadToArray high CPU consumption
ioa747 and one other reacted to AspirinJunkie for a topic
Then, as already mentioned, the most relevant starting point for reducing the load is to write FileReadToArray before the while loop – not within! And at the same time, increase the sleep time slightly. That alone should make a big difference. If there is still a need for further optimization, then a different approach would be required: Currently, your script queries the current status of the process list at regular intervals and processes it. This is commonly referred to as "polling". A better option would be to tell Windows: You know when new processes are created anyway, so just let me know when that happens. This way, the script can go to sleep and will be actively woken up by Windows when a new process appears. This approach is called event registration, for example. There are events for file system operations or window creation and so on. However, I am not aware of any event-based approach for process creation that does not require administrator privileges. But we can still find a workaround. WMI offers the option of periodically querying its tables internally and automatically reporting new records when changes are made. Technically speaking, this is still polling, but in WMI it is more cost-effective than implementing it directly in AutoIt. In addition, you can also specify which processes you are interested in and specify from the outset that only processes with a name from your list should be reported, e.g. This further reduces the effort required for the script. And yes, your concern is correct: this does make the script more complicated. But if further optimization is really necessary, there is no real way around it: HotKeySet("{F9}", "goout") ; Create WMI object and sink for events Global $oWMI = ObjGet("winmgmts:\\") Global $oSink = ObjCreate("WbemScripting.SWbemSink") ; say WMI that the script should be informed of new processes as they appear in test.dat. (See function definition) _registerProcessCreation() ; endless loop for keeping the script running Do Sleep(100) Until False ; Function that is automatically called when the __InstanceCreationEvent occurs Func SINK_OnObjectReady($oProcess) ProcessClose($oProcess.TargetInstance.ProcessID) EndFunc Func goout() Exit EndFunc ; Creates the query string that defines exactly which process settings should be responded to. ; This query is then linked to the user's own function as an event handler. Func _registerProcessCreation() Local $mProcNames[] ; build the query-string out of the "Test.dat" file ; Queries the __InstanceCreationEvent events on the WMI class Win32_Process every 100 ms. ; Also limit the query to the processes listed in Test.dat. Local $sQuery = "SELECT * FROM __InstanceCreationEvent WITHIN 0.1 WHERE TargetInstance ISA 'Win32_Process' AND (" For $sProcessName In FileReadToArray("Test.dat") If Not MapExists($mProcNames, $sProcessName) Then ; Prevent duplicate process names $sQuery &= "TargetInstance.name = '" & $sProcessName & "' OR " $mProcNames[$sProcessName] = "" EndIf Next $sQuery = StringTrimRight($sQuery, 4) & ")" ; Events with the prefix “SINK_” are linked to corresponding AutoIt functions (we only need SINK_OnObjectReady). ObjEvent($oSink, "SINK_") ; Queries the __InstanceCreationEvent events on the WMI class Win32_Process every 100 ms. $oWMI.ExecNotificationQueryAsync($oSink, $sQuery) EndFunc2 points -
New AD user accounts created with UDF _AD - (Moved)
argumentum reacted to water for a topic
automate the onboarding and termination of employee accounts in AD. That's exactly the reason why I started to brush up Wooltowns AD UDF in the first place. The UAC function will be added to the next release of the AD UDF1 point -
It's ok, its sorted! It was a mismatch between tree names and app names!1 point
-
Wrong, the Bool datatype is clearly part of the language. Untrue as well. Perseverare diabolicum.1 point
-
Zint UDF v0.60 build 2025-09-14 beta
argumentum reacted to UEZ for a topic
I compiled the Zint DLLs again and integrated the PNG static lib. You should be able to save the image now as PNG.1 point -
Thanks that solved my issue!😁1 point
-
I found that replacing "xA6" with "¦" in lines 265 and 296 of WinAPIDiag.au3 file in AutoIt Include folder fixed the problem. But I'm not certain whether this change has any impact on other workings of the file.1 point
-
Yes, IOCTL_DISK_GET_LENGTH_INFO is a non-destructive read-only operation without any buffers; it's just a harmless query.1 point
-
Disable combobox selection frame
argumentum reacted to mutleey for a topic
A very good trick too argumentum.1 point -
No problems And yep, _ArrayDisplay() works the same way as ioa's example 👍1 point
-
Hi everybody, I am completing webview2 udf, I have a problem and I hope everyone will help me For example: I am working with ICoreWebView2AcceleratorKeyPressedEventArgs2 interface, how can I declare it with ObjCreateInterface. Should I separate it into 2 Ivoke functions or one. This is my script : Global $oICoreWebView2AcceleratorKeyPressedEventArgs2, $pICoreWebView2AcceleratorKeyPressedEventArgs2 Global Const $sIID_ICoreWebView2AcceleratorKeyPressedEventArgs2 = "{03B2C8C8-7799-4E34-BD66-ED26AA85F2BF}" Global Const $dtag_ICoreWebView2AcceleratorKeyPressedEventArgs2 = _ "get_IsBrowserAcceleratorKeyEnabled HRESULT(BOOLEAN*);"& _ "put_IsBrowserAcceleratorKeyEnabled HRESULT(BOOLEAN);" Func ICoreWebView2AcceleratorKeyPressedEventHandler_Ivoke($pSelf, $pErrorCode, $pResult) $oICoreWebView2AcceleratorKeyPressedEventArgs = ObjCreateInterface( $pResult, $sIID_ICoreWebView2AcceleratorKeyPressedEventArgs, $dtag_ICoreWebView2AcceleratorKeyPressedEventArgs ) ;~ $oICoreWebView2AcceleratorKeyPressedEventArgs2 = ObjCreateInterface( $sIID_ICoreWebView2AcceleratorKeyPressedEventArgs, $sIID_ICoreWebView2AcceleratorKeyPressedEventArgs2, $dtag_ICoreWebView2AcceleratorKeyPressedEventArgs2 ) Return 0 #forceref $pSelf, $pErrorCode, $pResult EndFunc thanks for reading1 point
-
WebDriver UDF (W3C compliant version) - 2025/09/01
Danp2 reacted to SOLVE-SMART for a topic
Hi @MWIProd 👋 . Please set $_WD_DEBUG = $_WD_DEBUG_Full Run your browser automation Share the console output and *.log file with us Then we will have a better understanding of your capabilities setup and it's more likely that we can help you. Examples for using the _WD_CapabilitiesAdd() can be found here (autoit-webdriver-boilerplate) or here (au3WebDriver). Best regards Sven1 point -
myLogin - 🛡️ Secure lock screen Windows 🖥️
argumentum reacted to mlibre2 for a topic
myLogin 🛡️ Hey guys, I've been working lately on a project developed directly from my GitHub repo. I'm optimizing it as much as possible, minimizing false positives. Feel free to try it out with complete confidence 🤖 Simple open-source program to lock the Windows Desktop screen with advanced options: Disables the desktop while the lock window is active Prevents normal system use Only unlocks with a password set by the administrator1 point -
Check powercfg /requests. Things that don't require user input, but prevent the computer from sleeping are listed there.1 point
-
I am working to fix the double_ws1 point
-
Indeed, all these buggy @DOUBLE_WS make this table terribly hard to read. Even copy-pasting the table content to a text editor and replacing @DOUBLE_WS by a couple of spaces doesn't align the columns. I confess being responsible for going deep into (*UCP) details in StringRegEx help (beside having authored the bulk of that help topic) but since we DO have AutoIt users handling cyrillic, greek, asian languages and others, I found it useful to mention everything of value for all users.1 point
-
myLogin - 🛡️ Secure lock screen Windows 🖥️
argumentum reacted to mlibre2 for a topic
New release available v3.81 point -
Help File/Documentation Issues. (Discussion Only)
pixelsearch reacted to donnyh13 for a topic
Thanks @pixelsearch, That explains what i'm seeing very well. I thought initially that a table wasn't formatted right in the html. I really appreciate your example and time explaining it. Best regards,1 point -
myLogin - 🛡️ Secure lock screen Windows 🖥️
argumentum reacted to mlibre2 for a topic
If I tell you a curious fact... since I started testing the script on builds >= 22000 "windows 11", I get this problem: "unable to add resources", so I decided to remove that directive and insert the icon using the /icon parameter directly when compiling, but I made a typo in the workflow and the icon was not included. It should be corrected for future versions.1 point -
myLogin - 🛡️ Secure lock screen Windows 🖥️
mlibre2 reacted to argumentum for a topic
#pragma compile(Icon, C:\Program Files\AutoIt3\Icons\au3.ico) the portable exe does not show an icon1 point -
myLogin - 🛡️ Secure lock screen Windows 🖥️
argumentum reacted to mlibre2 for a topic
New release available v3.71 point -
Perfect my dear ioa747, Many thanks to you Accept my respect & my best wishes to you Such a great code from UEZ & ioa7471 point
-
Update to Version: 0.8 in the first post $iBgTrans - [optional] The transparency of background, a number in the range 0 - 255. (Default is 0)1 point
-
ProcessExists ,ProcessClose, FileReadToArray high CPU consumption
argumentum reacted to angel83 for a topic
Thanks for your argumentum, but it's a bit complex for me. The code I posted is small and simple. Thanks in advance.1 point -
EndIf "overhead"
Numeric1 reacted to WildByDesign for a topic
Thank you for your response. I appreciate that you've taken time to share some insight and suggestions as well. I personally have never used Ternary before. I'm still quite new to AutoIt and have a lot to learn. So to be perfectly honest, I don't really have a good understanding of how or when to use Ternary over the other options. This thread (and possibly another thread or two) was really about trying to get the most performance out of, or better efficiency, of the _WinEventProc (SetWinEventHook) function of my Immersive UX project. Since all running processes on the system filter through it, finding various ways to make it more efficient has been incredibly helpful. With the help of this community, it has been really beneficial. If you are curious if Ternary can fit in anywhere and if you have a few minutes, you can have a peak at the hook function (https://github.com/WildByDesign/ImmersiveUX/blob/main/ImmersiveEngine.au3#L587). It's got a lot of things that help make it more efficient, but I am always open to more. And most importantly, I am always interested in learning more.1 point -
_WinAPI_DwmEnableBlurBehindWindow in Windows 11
mlibre2 reacted to WildByDesign for a topic
This is a great idea. Although probably makes more sense to have it in a users’ script as opposed to having it in the main function.1 point -
I see that the 'trick' was the change of approach from _GDIPlus_GraphicsFillPie to _GDIPlus_GraphicsDrawArc, and the truth is that I tried it all afternoon yesterday, with _GDIPlus_GraphicsDrawArc, I didn't succeed (I didn't know) Thank you very much for the intervention, and the enlightenment Update to Version: 0.6 in the first post1 point
-
To use _WinAPI_BitmapDisplayTransparentInGUI() you must create a complete frame within the function. Example: ; https://www.autoitscript.com/forum/topic/213118-_circularprogress/ ;---------------------------------------------------------------------------------------- ; Title...........: _CircularProgress.au3 ; Description.....: Creates a customizable circular progress bar using GDI+ graphics. ; AutoIt Version..: 3.3.16.1 Author: ioa747 Script Version: 0.5 ; Note............: Testet in Win10 22H2 Date:08/09/2025 ; Based on post ..: https://www.autoitscript.com/forum/topic/213113-simple-circular-progressbar-with-smooth-edges-gradient-color/#findComment-1545755 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPISysWin.au3> #include <Constants.au3> #include <WindowsConstants.au3> #include <WinAPIConstants.au3> #include <Array.au3> _GDIPlus_Startup() Global $hGUI _Example() ; as demo _GDIPlus_Shutdown() Func _Example() $hGUI = GUICreate("RingProgressBar", 300, 300, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetState(@SW_SHOW) Local $aList[2000] Local $iCnt = UBound($aList) ConsoleWrite("$iCnt=" & $iCnt & @CRLF) Local $nProgress For $i = 1 To UBound($aList) $nProgress = Int($i / $iCnt * 100) ConsoleWrite($i & ") $nProgress=" & $nProgress & @CRLF) _CircularProgress($nProgress) Next Sleep(200) ; Give it some time to see the 100%. EndFunc ;==>_Example ; #FUNCTION# ==================================================================================================================== ; Name...........: _CircularProgress ; Description....: Creates a customizable circular progress bar using GDI+ graphics. ; Syntax.........: _CircularProgress($iPercent [, $iLeft = -1 [, $iTop = -1 [, $iSize = 300 [, $iThickness = 30 [, $TextCol = 0xFFFFFF [, $StartCol = 0xFF0000, $EndCol = 0xFFFF00]]]]]]) ; Parameters.....: $iPercent - The percentage complete for the progress bar (0 to 100). ; $iLeft - [optional] X-coordinate of the top-left corner. (Default is -1 for center) ; $iTop - [optional] Y-coordinate of the top-left corner. (Default is -1 for center) ; $iSize - [optional] width and height of the circular progress bar. (Default is 300) ; $iThickness - [optional] Thickness of the progress arc. (Default is 30) ; $TextCol - [optional] Color of the text within the progress bar. (Default is White) ; $StartCol - [optional] Start color of the progress arc gradient. (Default is Yellow) ; $EndCol - [optional] End color of the progress arc gradient. (Default is Red) ; Return values .: Success: create the progress bar GUI ; Author ........: ioa747 ; Modified ......: 08/09/2025 - v0.5 ; Remarks .......: Cleanup is handled automatically by passing an $iPercent > 100. ; Avoid using 0x050505 Color for $TextCol, $StartCol, or $EndCol, as it is used as a transparency color for the background. ; Related .......: _GDIPlus_Startup, _GDIPlus_GraphicsCreateFromHWND, etc. ; Link ..........: https://www.autoitscript.com/forum/topic/213113-simple-circular-progressbar-with-smooth-edges-gradient-color/#findComment-1545755 ; Example .......: _CircularProgress(50, -1, -1, 300, 20, 0x00FF00, 0xFF00FF, 0xFFFFFF) ; =============================================================================================================================== Func _CircularProgress($iPercent, $iSize = 300, $iThickness = 30, $TextCol = 0xFF404040, $StartCol = 0xFFFFFF00, $EndCol = 0xFFFF0000) Local $hBmp, $hBmpGraphics, $inSize, $iRadius, $iX, $iY $inSize = $iSize $iRadius = ($inSize - 4) / 2 $iX = $inSize / 2 $iY = $iX ; Create an off-screen bitmap for double-buffering $hBmp = _GDIPlus_BitmapCreateFromScan0($inSize, $inSize) $hBmpGraphics = _GDIPlus_ImageGetGraphicsContext($hBmp) _GDIPlus_GraphicsSetSmoothingMode($hBmpGraphics, 4) _GDIPlus_GraphicsSetTextRenderingHint($hBmpGraphics, 4) ; Draw progress arc as pie Local $angle = ($iPercent / 100) * 360 Local $hBrushProg = _GDIPlus_LineBrushCreate($iX - $iRadius, $iY, $iX + $iRadius, $iY, $EndCol, $StartCol, 1) Local $hPen = _GDIPlus_PenCreate2($hBrushProg, $iThickness) _GDIPlus_GraphicsDrawArc($hBmpGraphics, $iX - $iRadius + $iThickness / 2, $iY - $iRadius + $iThickness / 2, $iRadius * 2 - $iThickness, $iRadius * 2 - $iThickness, -90, $angle, $hPen) _GDIPlus_BrushDispose($hBrushProg) _GDIPlus_PenDispose($hPen) Local $hFontFamily = _GDIPlus_FontFamilyCreate("Times New Roman") Local $iFontSize = $iRadius * 0.3 Local $hFont = _GDIPlus_FontCreate($hFontFamily, $iFontSize, 1) Local $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 2) _GDIPlus_StringFormatSetLineAlign($hFormat, 2) Local $hBrushText = _GDIPlus_BrushCreateSolid($TextCol) ; Draw percentage text Local $rect = _GDIPlus_RectFCreate(($inSize - ($iFontSize * 4)) / 2, ($inSize - ($iFontSize * 2)) / 2, $iFontSize * 4, $iFontSize * 2) _GDIPlus_GraphicsDrawStringEx($hBmpGraphics, $iPercent & "%", $hFont, $rect, $hFormat, $hBrushText) _GDIPlus_FontFamilyDispose($hFontFamily) _GDIPlus_FontDispose($hFont) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrushText) Local $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp) _WinAPI_BitmapDisplayTransparentInGUI($hHBmp, $hGUI) _GDIPlus_BitmapDispose($hBmp) _GDIPlus_GraphicsDispose($hBmpGraphics) EndFunc ;==>_CircularProgress Func _WinAPI_BitmapDisplayTransparentInGUI(ByRef $hHBitmap, ByRef $hGUI, $iOpacity = 0xFF, $iFlags = $ULW_ALPHA, $bReleaseGDI = True, $tDest = Null, $iBGR = 0) If Not BitAND(GUIGetStyle($hGUI)[1], $WS_EX_LAYERED) = $WS_EX_LAYERED Then Return SetError(1, 0, 0) Local $tDim = DllStructCreate($tagBITMAP) If Not _WinAPI_GetObject($hHBitmap, DllStructGetSize($tDim), DllStructGetPtr($tDim)) Then Return SetError(2, 0, 0) Local $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION) Local Const $hScrDC = _WinAPI_GetDC(0), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC), $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) $tSize.X = $tDim.bmWidth $tSize.Y = $tDim.bmHeight $tBlend.Alpha = $iOpacity $tBlend.Format = 1 _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, $tDest, $tSize, $hMemDC, $tSource, $iBGR, $tBlend, $iFlags) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteDC($hMemDC) If $bReleaseGDI Then _WinAPI_DeleteObject($hHBitmap) Return True EndFunc ;==>_WinAPI_BitmapDisplayTransparentInGUI If you have static variable, such as bitmap, brushes, etc., you can put out these parts off the _CircularProgress() function.1 point
-
with _Timer_SetTimer() that will check every e.g.: 1000ms , if the application is running. If it is running it will do nothing, if it is not running it will remove the links example: #include <Timers.au3> #include <GUIConstantsEx.au3> #include <Array.au3> HotKeySet("{ESC}", "_Exit") ; exit HotKeySet("{HOME}", "_Display") ; Display $aApps array HotKeySet("{END}", "_NewApp") ; Run one more notepad (as new example app) Global $MyAppsDir = @ScriptDir & "\MyApps" Global $aApps[0][2] ; We need a GUI to make AutoIt timers work, as the Timers.au3 library is linked to GUI messages. Global $hGUI = GUICreate("My Timer need one GUI", 100, 100) GUISetState(@SW_HIDE) ; set timer to check every nnn Local $i_TimerInterval = 1000 _Timer_SetTimer($hGUI, $i_TimerInterval, "_TimerCheck") ; Run some example apps _RunApp("notepad") _RunApp("notepad") _RunApp("notepad") ; show result of fake symlink ShellExecute($MyAppsDir) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _Exit() Func _RunApp($sName) ShellExecute($sName) Sleep(200) Local $hWnd = WinGetHandle("[ACTIVE]") ConsoleWrite("$hWnd=" & $hWnd & @CRLF) If Not FileExists($MyAppsDir) Then DirCreate($MyAppsDir) Local $sPath = $MyAppsDir & "\" & $hWnd & ".txt" Local $sFill = $hWnd & "|" & $sPath _ArrayAdd($aApps, $sFill) ; fake symlink FileWrite($sPath, $hWnd) EndFunc ;==>_RunApp ; Timer call back function Func _TimerCheck($hWnd, $iMsg, $iIDTimer, $iTime) #forceref $hWnd, $iMsg, $iIDTimer, $iTime If IsArray($aApps) Then Local $sRange = "" For $i = 0 To UBound($aApps) - 1 If Not WinExists(HWnd($aApps[$i][0])) Then ConsoleWrite("found:" & $aApps[$i][0] & @CRLF) FileDelete($aApps[$i][1]) $sRange &= $i & ";" EndIf Next If $sRange <> "" Then $sRange = StringTrimRight($sRange, 1) ConsoleWrite("$sRange=" & $sRange & @CRLF) _ArrayDelete($aApps, $sRange) If @error Then ConsoleWrite("_ArrayDelete @error:" & @error & @CRLF) EndIf EndIf EndFunc ;==>_TimerCheck ; --- HotKeySet functions --- Func _NewApp() _RunApp("notepad") EndFunc ;==>_NewApp Func _Exit() ConsoleWrite("Killed All Timers? " & _Timer_KillAllTimers($hGUI) & @CRLF) GUIDelete($hGUI) DirRemove($MyAppsDir, 1) Exit EndFunc ;==>_Exit Func _Display() If WinExists("$aApps") Then WinClose("$aApps") Else _ArrayDisplay($aApps, "$aApps") EndIf EndFunc ;==>_Display1 point
-
This is an update of the old Automating Windows Explorer example. The update includes Desktop automation. However, Windows XP code has been removed. ThreadsOther threads related to File/Windows Explorer: Implementing Windows Explorer right pane Implementing Windows Explorer address bar Enumerating and Browsing the Desktop Some of these threads are very old. I'm considering updating some of the examples: Remove Windows XP code. Implement some of the code in other ways. Enumerating and Browsing the Desktop is important to me personally because it was the first time I used the ObjCreateInterface() function. The first version of the example was based on _AutoItObject_WrapperCreate() from the AutoItObject UDF. Then I was told that you can use ObjCreateInterface() instead. Of course I had to try. Automating File/Windows Explorer and DesktopAutomating File/Windows Explorer The old example contains a description of the techniques for automating File/Windows Explorer. The techniques are based on COM interfaces. Initially, it's about getting an IShellBrowser interface based on a File/Windows Explorer window handle. An IDispatch interface for the window is important for creating the IShellBrowser interface. Through the IShellBrowser interface, you can generate a large number of interfaces that can be used to implement the automation functions. Automating DesktopBilgus figured out how to get an IDispatch interface for the Desktop in this post: $oIShellWindows.FindWindowSW( Null, Null, $SWC_DESKTOP, $hWnd, $SWFO_NEEDDISPATCH, $pIDispatch ) This is the part of the old code in the GetIShellBrowser() function that needs to be updated to include the Desktop: ; Get an IWebBrowserApp object for each window ; This is done in two steps: ; 1. Get an IDispatch object for the window ; 2. Get the IWebBrowserApp interface ; Check if it's the right window Local $pIDispatch, $oIDispatch Local $pIWebBrowserApp, $oIWebBrowserApp, $hWnd For $i = 0 To $iWindows - 1 $oIShellWindows.Item( $i, $pIDispatch ) If $pIDispatch Then $oIDispatch = ObjCreateInterface( $pIDispatch, $sIID_IDispatch, $dtag_IDispatch ) $oIDispatch.QueryInterface( $tRIID_IWebBrowserApp, $pIWebBrowserApp ) If $pIWebBrowserApp Then $oIWebBrowserApp = ObjCreateInterface( $pIWebBrowserApp, $sIID_IWebBrowserApp, $dtag_IWebBrowserApp ) $oIWebBrowserApp.get_HWND( $hWnd ) If $hWnd = $hExplorer Then ExitLoop EndIf EndIf Next And here the code to include the Desktop is added: ; Get an IWebBrowserApp object for each window ; This is done in two steps: ; 1. Get an IDispatch object for the window ; 2. Get the IWebBrowserApp interface ; Check if it's the right window Local $pIDispatch, $oIDispatch, $hRes Local $pIWebBrowserApp, $oIWebBrowserApp, $hWnd For $i = 0 To $iWindows $hRes = $i < $iWindows ? $oIShellWindows.Item( $i, $pIDispatch ) _ : $oIShellWindows.FindWindowSW( Null, Null, $SWC_DESKTOP, $hWnd, $SWFO_NEEDDISPATCH, $pIDispatch ) If $pIDispatch Then $oIDispatch = ObjCreateInterface( $pIDispatch, $sIID_IDispatch, $dtag_IDispatch ) $oIDispatch.QueryInterface( $tRIID_IWebBrowserApp, $pIWebBrowserApp ) If $pIWebBrowserApp Then $oIWebBrowserApp = ObjCreateInterface( $pIWebBrowserApp, $sIID_IWebBrowserApp, $dtag_IWebBrowserApp ) $oIWebBrowserApp.get_HWND( $hWnd ) If $hWnd = $hExplorer Then ExitLoop EndIf EndIf Next The For loop runs an extra round if a File/Explorer Window has not been identified. In this last loop, the FindWindowSW() method returns a window corresponding to the Desktop. Here, the method always returns the Program Manager window. a consequence of this implementation is that if you specify a non-existent window as a parameter to the GetIShellBrowser() function, then the function will return the Program Manager window. Thus, the Program Manager window is the default window for the function. The IDispatch interface is the important thing in terms of automating the Desktop. Then all the functions used in connection with a File/Windows Explorer window can also be used in connection with the Desktop. Except for a few functions that are not relevant for the Desktop. Functions The automation functions are coded in FileExplorer.au3. The functions are implemented using a number of Shell API functions and Shell COM interfaces coded in ShellFunctions.au3 and ShellInterfaces.au3. The old example contains a list of implemented functions. New functions GetSortColumns() GetSortColumnsEx() SetSortColumns() Examples The 7z-file contains examples for automating the Desktop and a File/Windows Explorer window. These are the same examples as in this post. Note that the examples GetFiles.au3 and GetFolders.au3 also show how to make a list of selected files and folders. Note that the GetSetIconView.au3 example can change the order of icons on the Desktop. If you don't want this, run this example only in a File/Windows Explorer window. The GUI application that was used to demonstrate the features in the old version is not included. The small examples seems to be much more useful. This post contains new examples. In both the old and the new post, the examples are shown for a File/Windows Explorer window. But the 7z-file contains similar examples for the Desktop. Forum examplesThis is a list of the most interesting examples in the old thread: The original collection of small examples Automate a file search with UI Automation code. The question that led to this answer was asked in a slightly earlier post. Execute a function on a double-click in empty space of the listview. Based on UI Automation code. Here the question was asked somewhat earlier. UI Automation code to make a selected item visible by scrolling the listview up or down 7z-fileThe 7z-file contains source code for the UDF and examples. You need AutoIt 3.3.12 or later. Tested on Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. FileExplorerAndDesktop.7z1 point
-
interesting accident
KaFu reacted to pixelsearch for a topic
Maybe this explanation ? 1) Button when no style is indicated at creation (-1) , WS_TABSTOP will be forced (help file) Button style becomes 0x50010000 WS_CHILD, WS_VISIBLE, WS_TABSTOP [0x40000000, 'WS_CHILD'] [0x10000000, 'WS_VISIBLE'] [0x00010000, 'WS_TABSTOP'] 2) Button created with 0xFF0000 style Button style becomes 0x50FF0000 WS_CHILD, WS_VISIBLE, WS_OVERLAPPEDWINDOW, WS_VSCROLL, WS_HSCROLL [0x40000000, 'WS_CHILD'] [0x10000000, 'WS_VISIBLE'] [0x00CF0000, 'WS_OVERLAPPEDWINDOW'] [0x00200000, 'WS_VSCROLL'] [0x00100000, 'WS_HSCROLL'] 'WS_OVERLAPPEDWINDOW' means (WS_CAPTION | WS_SYSMENU | WS_SIZEBOX | WS_MINIMIZEBOX | WS_MAXIMIZEBOX)1 point -
I wrote this function to list the imports of a DLL. ;Coded by UEZ build 2024-06-09 #AutoIt3Wrapper_UseX64=n #include <Array.au3> #include <Debug.au3> #include <String.au3> #include <WinAPIFiles.au3> #include <WinAPIProc.au3> #include <WinAPIRes.au3> #include <WinAPISys.au3> Const $IMAGE_DIRECTORY_ENTRY_IMPORT = 1 Global $sFile = FileOpenDialog("Select a DLL file", "", "DLL (*.dll)", $FD_FILEMUSTEXIST) If @error Then Exit Global $a = _WinAPI_GetBinaryType2($sFile) Global $b = _WinAPI_GetBinaryType2(_WinAPI_GetProcessFileName()) If $a <> $b Or $a = "Error" Or $b = "Error" Then Exit MsgBox($MB_ICONERROR, "Error", "Script and DLL have not same binary type!", 10) Global $i, $aResult = _WinAPI_ListDLLImports($sFile) _DebugArrayDisplay($aResult, StringRegExpReplace($sFile, ".+\\(.+)", "$1") & " imports") Func _WinAPI_ListDLLImports($sFile, $iLevel = 1, $bRec = False, $bDisplayLocalFilesOnly = True, $iMaxRecLevel = 10) If $iLevel > $iMaxRecLevel Then Return Local Const $hModule = _WinAPI_LoadLibraryEx($sFile, BitOR($DONT_RESOLVE_DLL_REFERENCES, $LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR)) If Not $hModule Then Return SetError(1, 0, 0) Local Const $tSize = DllStructCreate("ulong bytes") ;https://learn.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-imagedirectoryentrytodata Local Const $aReturn = DllCall("Dbghelp.dll", "ptr", "ImageDirectoryEntryToData", "ptr", $hModule, "boolean", True, "ushort", $IMAGE_DIRECTORY_ENTRY_IMPORT, "struct*", $tSize) If Not IsArray($aReturn) Or @error Then _WinAPI_FreeLibrary($hModule) Return SetError(2, 0, 0) EndIf If Not $aReturn[0] Then _WinAPI_FreeLibrary($hModule) Return SetError(3, 0, 0) EndIf Local $tIMAGE_IMPORT_DESCRIPTOR, $sDLLName, $sPath = StringRegExpReplace($sFile, "(.+\\).+", "$1"), $sFN, $i = 0, $sDLL = StringRegExpReplace($sFile, ".+\\(.+)", "$1") Static $sDLLFiles = "" ConsoleWrite(_StringRepeat(@TAB, $iLevel - 1) & $sDLL & @CRLF) If $iLevel > 1 Then $sDLLFiles &= $sDLL & "|" While 1 $tIMAGE_IMPORT_DESCRIPTOR = DllStructCreate("dword dummy;dword TimeDateStamp;dword ForwarderChain;dword Name;dword FirstThunk;", $aReturn[0] + $i) If Not $tIMAGE_IMPORT_DESCRIPTOR.FirstThunk Then _WinAPI_FreeLibrary($hModule) If $iLevel = 1 Then Local $aResult = StringSplit(StringTrimRight($sDLLFiles, 1), "|", 2) $aResult = _ArrayUnique($aResult, 0, 0, 0, $ARRAYUNIQUE_NOCOUNT) _ArraySort($aResult) Return $aResult EndIf Return Else $sDLLName = _WinAPI_WideCharToMultiByte(DllStructCreate("char s[256];", $hModule + $tIMAGE_IMPORT_DESCRIPTOR.name).s, 65001) $sFN = $sPath & $sDLLName If $bRec Then If FileExists($sFN) Then $iLevel += 1 _WinAPI_ListDLLImports($sFN, $iLevel) $iLevel -= 1 Else If Not $bDisplayLocalFilesOnly Then $sDLLFiles &= $sDLLName & "|" ConsoleWrite($iLevel & ":" & _StringRepeat(@TAB, $iLevel) & $sDLLName & @CRLF) EndIf Else ConsoleWrite($iLevel & ":" & _StringRepeat(@TAB, $iLevel) & $sDLLName & @CRLF) If Not $bDisplayLocalFilesOnly Then $sDLLFiles &= $sDLLName & "|" Else If FileExists($sFN) Then $sDLLFiles &= $sDLLName & "|" EndIf EndIf Endif $i += DllStructGetSize($tIMAGE_IMPORT_DESCRIPTOR) WEnd EndFunc ; #FUNCTION# ==================================================================================================================== ; Author.........: UEZ ; Modified.......: ; =============================================================================================================================== Func _WinAPI_GetBinaryType2($sFile) Local $hFile = _WinAPI_CreateFile($sFile, 2, 2, 2) If Not $hFile Or @error Then Return SetError(1, 0, 0) Local $hMapping = _WinAPI_CreateFileMapping($hFile, 0, Null, $PAGE_READONLY, Null) If Not $hMapping Then _WinAPI_CloseHandle($hFile) Return SetError(2, 0, 0) EndIf Local Const $pAddress = _WinAPI_MapViewOfFile($hMapping, 0, 0, $FILE_MAP_READ) If Not $pAddress Or @error Then __ReturnGBT2($hMapping, $hFile, 3) Local Const $aHeader = DllCall("Dbghelp.dll", "ptr", "ImageNtHeader", "ptr", $pAddress) If @error Or IsArray($aHeader) = 0 Then Return __ReturnGBT2($hMapping, $hFile, 4) Local Const $tIMAGE_NT_HEADERS = DllStructCreate("dword Signature;ptr FileHeader;ptr OptionalHeader;", $aHeader[0]) If @error Or Not IsDllStruct($tIMAGE_NT_HEADERS) Then Return __ReturnGBT2($hMapping, $hFile, 5) Local Const $tIMAGE_FILE_HEADER = DllStructCreate("word Machine;word NumberOfSections;dword TimeDateStamp;dword PointerToSymbolTable;dword NumberOfSymbols;word SizeOfOptionalHeader;word Characteristics;", _ DllStructGetPtr($tIMAGE_NT_HEADERS) + 4) If @error Or Not IsDllStruct($tIMAGE_FILE_HEADER) Then Return __ReturnGBT2($hMapping, $hFile, 6) __ReturnGBT2($hMapping, $hFile, 0) Switch $tIMAGE_FILE_HEADER.Machine Case 0x014c Return "x86" Case 0x0200 Return "Intel Itanium" Case 0x8664 Return "x64" Case Else Return "Error" EndSwitch EndFunc ;==>_WinAPI_GetBinaryType2 Func __ReturnGBT2(Byref $hMapping, ByRef $hFile, $iError) _WinAPI_CloseHandle($hMapping) _WinAPI_CloseHandle($hFile) If $iError Then Return SetError($iError, 0, 0) EndFunc ;==>__ReturnGBT21 point
-
Predict Text for an Edit Control _PredictText.au3 (UDF)
hudsonhock reacted to PhoenixXL for a topic
Predict Text UDF Working It sub classes the edit control and matches the current word through the Database & sets selection in accordance. Functions Predicts Text from an User-Defined Database. Sets the Predicted Text when Enter is pressed. * Pressing Backspace deletes the current selection. Support Editing, Overwriting, Updating, Deleting the List. Has the Feature to add New words the user types in the control, to the List. Supports Sensitive and In-Sensitive Prediction. Supports Auto-completion and Auto-Suggestion. Edit and Input controls supported >Support RichEdit Controls. Automatically limit the New Words. Supports Phrase (Post-Space) Prediction Future Updates Support Auto-suggestion. [Coming soon]Done Note That if you set a Password Char for the Edit Box the Prediction will automatically get Unregistered. * Enter is supported Only in Edit Controls. For Input Control the user can use GuiSetAccelerators [Thanks to M23].Check Example 3 ; #CURRENT# ===================================================================================================================== ;_RegisterPrediction ;_UpdatePredictList ;_UnRegisterPrediction ;_RegisterListingSpaceWords ;_RegisterListingNewWords ;_GetSelectedText ;_GetListCount ;_GetCurrentWord ;_GetCaretOffset ; SetSuggestion_Dimensions ; =============================================================================================================================== ; #INTERNAL_USE_ONLY# =========================================================================================================== ;_New_WndProc ; AddToArray ; MakeArray ;_Edit_SubClass ;_AutoExit ;_PredictText ;_GetSpaceText ;_SetSelection ;_CtrlSetStyle ;_CtrlGetStyle ;_RemoveBit ; GetLineHeight ; Suggest_Show ; Suggest_PopuplateItems ; Suggest_SetPos ; =============================================================================================================================== Screen Shots Example 1 - Multiple Edits and Basic Functionality Example 2 - Adding New Words Example 3 - Password Char & Input Controls Example 4 - Supports Post-Space Prediction Example 5 - AutoSuggestion Please Notify for any other Updates and Bugs. ChangeLog V1.0 -First Release V1.1 -Now Supports New Words added by Pressing Enter -Supports Input Controls for Enter Key [Thanks to M23] V1.2 -Now Supports Prediction after Space -New Words are now Automatically Limited V1.3 -Converted to Iterative -Now is more faster V1.4 -Rewritten the UDF with Regular expressions. -Added support for Auto-Suggestion -Bug for incorrect insertion when inbetween typing is now cleared V1.5 -Fixed the bug for which MouseMove wasn't detected. V1.6 -Fixed: Scroll Bar unaccessible. -Fixed: Suggestion doesn't hide when space is typed in non-space text suggestion. V1.7 -Changed: Searching is now done with regular expressions. Lot of speed is increased. PredictText V1.7 v1.7 PredictText(UDF).7z Previous Downloads: 890 Regards Phoenix XL1 point -
I've not tried that. maybe later. So you can do something like this: #include <WinAPICom.au3> #include <Process.au3> #include <Array.au3> Opt("MustDeclareVars", 1) Global Const $CLSCTX_INPROC_SERVER = 0x01 + 0x02 + 0x04 + 0x10 Global Enum $eRender, $eCapture, $eAll, $EDataFlow_enum_count Global Enum $AudioSessionStateInactive, $AudioSessionStateActive, $AudioSessionStateExpired Global Const $eMultimedia = 1 Global Const $sCLSID_MMDeviceEnumerator = "{BCDE0395-E52F-467C-8E3D-C4579291692E}" Global Const $sIID_IMMDeviceEnumerator = "{A95664D2-9614-4F35-A746-DE8DB63617E6}" Global Const $sTagIMMDeviceEnumerator = _ "EnumAudioEndpoints hresult(int;dword;ptr*);" & _ "GetDefaultAudioEndpoint hresult(int;int;ptr*);" & _ "GetDevice hresult(wstr;ptr*);" & _ "RegisterEndpointNotificationCallback hresult(ptr);" & _ "UnregisterEndpointNotificationCallback hresult(ptr)" Global Const $sIID_IAudioMeterInformation = "{C02216F6-8C67-4B5B-9D00-D008E73E0064}" Global Const $sTagIAudioMeterInformation = "GetPeakValue hresult(float*);" & _ "GetMeteringChannelCount hresult(dword*);" & _ "GetChannelsPeakValues hresult(dword;float*);" & _ "QueryHardwareSupport hresult(dword*);" Global Const $sIID_IMMDevice = "{D666063F-1587-4E43-81F1-B948E807363F}" Global Const $sTagIMMDevice = _ "Activate hresult(clsid;dword;ptr;ptr*);" & _ "OpenPropertyStore hresult(dword;ptr*);" & _ "GetId hresult(wstr*);" & _ "GetState hresult(dword*)" Global Const $sIID_IAudioSessionManager2 = "{77aa99a0-1bd6-484f-8bc7-2c654c9a9b6f}" Global Const $sTagIAudioSessionManager = "GetAudioSessionControl hresult(ptr;dword;ptr*);" & _ "GetSimpleAudioVolume hresult(ptr;dword;ptr*);" Global Const $sTagIAudioSessionManager2 = $sTagIAudioSessionManager & "GetSessionEnumerator hresult(ptr*);" & _ "RegisterSessionNotification hresult(ptr);" & _ "UnregisterSessionNotification hresult(ptr);" & _ "RegisterDuckNotification hresult(wstr;ptr);" & _ "UnregisterDuckNotification hresult(ptr)" Global Const $sIID_IAudioSessionEnumerator = "{e2f5bb11-0570-40ca-acdd-3aa01277dee8}" Global Const $sTagIAudioSessionEnumerator = "GetCount hresult(int*);GetSession hresult(int;ptr*)" Global Const $sIID_IAudioSessionControl = "{f4b1a599-7266-4319-a8ca-e70acb11e8cd}" Global Const $sTagIAudioSessionControl = "GetState hresult(int*);GetDisplayName hresult(wstr*);" & _ "SetDisplayName hresult(wstr);GetIconPath hresult(wstr*);" & _ "SetIconPath hresult(wstr;ptr);GetGroupingParam hresult(ptr*);" & _ "SetGroupingParam hresult(ptr;ptr);RegisterAudioSessionNotification hresult(ptr);" & _ "UnregisterAudioSessionNotification hresult(ptr);" Global Const $sIID_IAudioSessionControl2 = "{bfb7ff88-7239-4fc9-8fa2-07c950be9c6d}" Global Const $sTagIAudioSessionControl2 = $sTagIAudioSessionControl & "GetSessionIdentifier hresult(wstr*);" & _ "GetSessionInstanceIdentifier hresult(wstr*);" & _ "GetProcessId hresult(dword*);IsSystemSoundsSession hresult();" & _ "SetDuckingPreferences hresult(bool);" Global $bExit= not False HotKeySet("{ESC}","_Exit") _WinAPI_CoInitialize() Local $aApp =0 While $bExit $aApp = _GetAppsPlayingSound() If IsArray($aApp) then ConsoleWrite("!SoundDetected!!!" & @CRLF) For $i= 0 to UBound($aApp)-1 ConsoleWrite($aApp[$i][0] & @CRLF) Next ConsoleWrite("!End" & @CRLF) EndIf Sleep(100) WEnd _WinAPI_CoUninitialize() Func _Exit() $bExit=False EndFunc Func _GetAppsPlayingSound() Local $pIMMDevice = 0 Local $oMMDevice = 0 Local $pIAudioSessionManager2 = 0 Local $oIAudioSessionManager2 = 0 Local $pIAudioSessionEnumerator = 0 Local $oIAudioSessionEnumerator = 0 Local $nSessions = 0 Local $oMMDeviceEnumerator = 0 Local $aApp[0] Local $pIAudioSessionControl2 = 0 Local $oIAudioSessionControl2 = 0 Local $oIAudioMeterInformation = 0 Local $ProcessID = 0 Local $fPeakValue = 0 Local $iState = 0 Local $iVolume = 0 Local $oErrorHandler = 0 $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") $oMMDeviceEnumerator = ObjCreateInterface($sCLSID_MMDeviceEnumerator, $sIID_IMMDeviceEnumerator, $sTagIMMDeviceEnumerator) If @error Then Return $aApp If SUCCEEDED($oMMDeviceEnumerator.GetDefaultAudioEndpoint($eRender, $eMultimedia, $pIMMDevice)) Then ;eRender $oMMDevice = ObjCreateInterface($pIMMDevice, $sIID_IMMDevice, $sTagIMMDevice) $oMMDevice.Activate($sIID_IAudioSessionManager2, $CLSCTX_INPROC_SERVER, 0, $pIAudioSessionManager2) $oIAudioSessionManager2 = ObjCreateInterface($pIAudioSessionManager2, $sIID_IAudioSessionManager2, $sTagIAudioSessionManager2) $oIAudioSessionManager2.GetSessionEnumerator($pIAudioSessionEnumerator) $oIAudioSessionEnumerator = ObjCreateInterface($pIAudioSessionEnumerator, $sIID_IAudioSessionEnumerator, $sTagIAudioSessionEnumerator) $oIAudioSessionEnumerator.GetCount($nSessions) For $i = 0 To $nSessions - 1 $oIAudioSessionEnumerator.GetSession($i, $pIAudioSessionControl2) $oIAudioSessionControl2 = ObjCreateInterface($pIAudioSessionControl2, $sIID_IAudioSessionControl2, $sTagIAudioSessionControl2) $oIAudioSessionControl2.GetState($iState) If $iState = $AudioSessionStateActive Then $oIAudioSessionControl2.GetProcessId($ProcessID) $oIAudioMeterInformation = ObjCreateInterface($pIAudioSessionControl2, $sIID_IAudioMeterInformation, $sTagIAudioMeterInformation) $oIAudioSessionControl2.AddRef $oIAudioMeterInformation.GetPeakValue($fPeakValue) If $fPeakValue > 0 Then ReDim $aApp[UBound($aApp) + 1][2] $aApp[UBound($aApp) - 1][0] = _ProcessGetName($ProcessID) $aApp[UBound($aApp) - 1][1] = $fPeakValue EndIf EndIf $fPeakValue = 0 $iState = 0 $ProcessID = 0 $oIAudioMeterInformation = 0 $oIAudioSessionControl2 = 0 Next $oIAudioSessionEnumerator = 0 $oIAudioSessionManager2 = 0 $oMMDevice = 0 $oMMDeviceEnumerator = 0 If UBound($aApp) = 0 Then $aApp = 0 Return $aApp Else Return 0 EndIf EndFunc ;==>_GetAppsPlayingSound Func SUCCEEDED($hr) Return ($hr >= 0) EndFunc ;==>SUCCEEDED ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc Saludos1 point
-
I hope this is helpful to you guys ; #FUNCTION# ==================================================================================================================== ; Name...........: GetActiveKeyboardLayout() Function ; Description ...: Get Active keyboard layout ; Author ........: Fredj A. Jad (DCCD) ; MSDN .........: GetWindowThreadProcessId Function ,http://msdn.microsoft.com/en-us/library/ms633522(VS.85).aspx ; MSDN .........: GetKeyboardLayout Function ,http://msdn.microsoft.com/en-us/library/ms646296(VS.85).aspx ; =============================================================================================================================== While 1 If Sleep(250) Then TrayTip('Active!', GetActiveKeyboardLayout(WinGetHandle('')), 5, 1) WEnd Func GetActiveKeyboardLayout($hWnd) Local $aRet = DllCall('user32.dll', 'long', 'GetWindowThreadProcessId', 'hwnd', $hWnd, 'ptr', 0) $aRet = DllCall('user32.dll', 'long', 'GetKeyboardLayout', 'long', $aRet[0]) Return '0000' & Hex($aRet[0], 4) EndFunc ;==>GetActiveKeyboardLayout1 point
-
SoulA modified helpfile example without any checking for menu handles. use the GuiMenu.au3 UDF to make menus you can check for the handles of using wparam in _WM_CONTEXTMENU(). see helpfile GuiMenu UDF section example for _GUICtrlMenu_CreatePopup () Edit: added comment on helpfile example #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Local $contextmenu, $button, $buttoncontext, $buttonitem, $msg, $iFlag = 0 Local $newsubmenu, $textitem, $fileitem, $saveitem, $infoitem ;right click on gui to bring up context Menu. ;right click on the "ok" button to bring up a control specific context menu. ;click on the "ok" button to disable contextmenus GUICreate("My GUI Context Menu", 300, 200) $button = GUICtrlCreateButton("Context Menu Enabled", 75, 100, 150, 20) $buttoncontext = GUICtrlCreateContextMenu($button) $buttonitem = GUICtrlCreateMenuItem("About button", $buttoncontext) $contextmenu = GUICtrlCreateContextMenu() $newsubmenu = GUICtrlCreateMenu("new", $contextmenu) $textitem = GUICtrlCreateMenuItem("text", $newsubmenu) $fileitem = GUICtrlCreateMenuItem("Open", $contextmenu) $saveitem = GUICtrlCreateMenuItem("Save", $contextmenu) GUICtrlCreateMenuItem("", $contextmenu) ; separator $infoitem = GUICtrlCreateMenuItem("Info", $contextmenu) GUIRegisterMsg($WM_CONTEXTMENU, "_WM_CONTEXTMENU") GUISetState() While 1 Switch GUIGetMsg() Case $button $iFlag = Not $iFlag If $iFlag Then GUICtrlSetData($button, "Context Menu Disabled") Else GUICtrlSetData($button, "Context Menu Enabled") EndIf Case $GUI_EVENT_CLOSE GUIDelete() Exit EndSwitch WEnd Func _WM_CONTEXTMENU($hwnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam If $iFlag Then Return 0 Return $GUI_RUNDEFMSG EndFunc1 point