Leaderboard
Popular Content
Showing content with the highest reputation on 06/10/2019 in all areas
-
Have you looked at this thread to control the IE version?1 point
-
question about iniEx UDF
FrancescoDiMuro reacted to TheXman for a topic
There is an error in the function's regular expression. Right before the last double quote, there is an erroneous right paren ("("). The corrected function below has the original line commented out and the corrected line right below it. Func _IniReadFromString($szInput, $szSection, $szKey, $Default) $szInput = StringStripCR($szInput) ;~ Local $aRegMl = StringRegExp($szInput, "\[" & __StringEscapeRegExp($szSection) & "\]\n+(?:[^\[].*?=.*\n)*" & __StringEscapeRegExp($szKey) & "=(.*)\n?(", 3) Local $aRegMl = StringRegExp($szInput, "\[" & __StringEscapeRegExp($szSection) & "\]\n+(?:[^\[].*?=.*\n)*" & __StringEscapeRegExp($szKey) & "=(.*)\n?", 3) If @error Then Return SetError(1, 0, $Default) ; key not found Return $aRegMl[0] EndFunc ;==>_IniReadFromString By the way, think twice before replying in all caps when someone is trying to help you. The next time you do it, don't be surprised if you get no replies.1 point -
Set Log On Informations for a service
Earthshine reacted to JLogan3o13 for a topic
SC is quite speedy, and it is a part of Windows for a reason. Why would you not use it?1 point -
Remove words up to a certain number of words
FrancescoDiMuro reacted to iamtheky for a topic
Also consider that since you know what you want, you can just ignore the other stuff altogether #include<array.au3> local $aList[] = ["Mon","Tues","Wed","Thur","Fri","Sat","Sun"] _ArrayDisplay($aList , "The first 5 items" , 4)1 point -
Maybe something like this works? Global $count = 0 HotKeySet ("+{F7}" , "temp") While 1 Sleep(100) WEnd Func temp() $count = $count + 1 $WindowList = WinList() Local $NewWindowList[100][10] $newcount = 1 For $i = 1 To $WindowList[0][0] If $WindowList[$i][0] <> "" And BitAND(WinGetState($WindowList[$i][1]), 2) Then $NewWindowList[0][0] = $newcount $NewWindowList[$newcount][0] = ($WindowList[$i][0]) $NewWindowList[$newcount][1] = ($WindowList[$i][1]) $newcount = $newcount + 1 EndIf Next If $count > $NewWindowList[0][0] then $count = 1 WinActivate($NewWindowList[$count][1]) EndFunc1 point
-
Phil1991, Welcome to the AutoIt forums. Not only do you need to increase the height of the notification, you need to increase the height of the label in which the message is displayed. As you have not done this and as you are displaying a title, the message label remains sized for a single line. If you really need 2 lines of message text then I suggest not using a title - which automatically gives you the possibility of a 2-line message. As I have often stated, the idea of these notifications is to enable short messages to be passed to the user - and the limited size allows as many as possible to fit onto the screen. As for previous requests to make the notifications larger I am not prepared amend the code to allow this as it seems to me to be counter to the basic idea behind the UDF. If you insist on displaying longer messages, might I point you at my Toast and ExtMsgBox UDFs which do allow for much larger messages - and also for rather more user interaction. M231 point
-
Seems like a bug..
Flaccid_Jack reacted to BrewManNH for a topic
Because in your code you're comparing 2 strings, just because those strings contain characters that are also considered to be numbers, doesn't mean they're treated like numbers, they're treated like strings. Look up lexicographical comparison for an explanation as to why.1 point -
INIread into array of variables from dropdown
Subz reacted to InunoTaishou for a topic
Not quite sure if I'm following what you mean exactly but I think I understand what you're trying to do. Update a combobox with values based on the item selected? This might get you on the right track: #include <GUIConstants.au3> Global $aBrandsIni = ["Tools", "Items"] Global $aTools = ["Tool 1", "Tool 2", "Tool 3"] Global $aItems = ["Item 1", "Item 2", "Item 3"] Global $hMain = GUICreate("Dropdown Menus", 240, 40) Global $cboOne = GUICtrlCreateCombo("", 10, 10, 100, 20) Global $cboTwo = GUICtrlCreateCombo("", 120, 10, 100, 20) PopulateCombo($cboOne, $aBrandsIni) GUISetState(@SW_SHOW) While (True) Switch (GUIGetMsg()) Case $GUI_EVENT_CLOSE Exit 0 Case $cboOne ; Store the selected item Local $sSelection = GUICtrlRead($cboOne) ; Figure out which combobox value was selected If ($sSelection = "Tools") Then ; The "Tools" item was selected, update the second combo with the tools items PopulateCombo($cboTwo, $aTools) ElseIf ($sSelection = "Items") Then ; The "Items" item was selected, update the second combo with the items PopulateCombo($cboTwo, $aItems) EndIf EndSwitch WEnd Func PopulateCombo(Const ByRef $cboCombo, Const ByRef $aArray) Local $sItems = "" GUICtrlSetData($cboCombo, "") ; Creating the string used to set the data of the combobox: "Item 1|Item 2|Item 3|" For $i = 0 to UBound($aArray) - 1 $sItems &= $aArray[$i] & "|" Next ; Update the combobox with the new items, remove the trailing '|' GUICtrlSetData($cboCombo, StringTrimRight($sItems, 1)) EndFunc1 point -
Autoit SDL2 DLL Help
LeftyGuitar reacted to TheXman for a topic
You're welcome. As you can see in my sdl2.au3, the dllopen() is not necessary. You can just point the dllcall() to the correct dll file.1 point -
After a lot of experiments, I think I solved the issue (at least to my satisfaction). Here are a few relevant experiments: 1. As I mentioned in my initial comment, I started from the "Console Input" post. After a few edits, I've got to the point where it was reading a string terminated by [Enter] in Windows 2003/XP, but it was behaving weird in Windows 10 x32: #include <WinAPI.au3> Local $nChars, $tBuffer, $hConIN, $nCount, $sInChr, $sInput $nChars = 1 $tBuffer = DllStructCreate("char") $hConIN = _WinAPI_CreateFile("CON", 2, 2) ConsoleWrite(@CRLF & "Write some text and close with ENTER: ") While 1 ; We read 1 char at a time and we want all of them _WinAPI_ReadFile($hConIN, DllStructGetPtr($tBuffer), 1, $nCount) If @error Then ExitLoop If $nCount > 0 Then $sInChr = BinaryToString(DllStructGetData($tBuffer, 1)) If $sInChr = @CR Then ExitLoop $sInput &= $sInChr EndIf WEnd If @error Then ConsoleWriteError(@CRLF & "ERROR: " & @error) _WinAPI_CloseHandle($hConIN) ConsoleWrite(@CRLF & "INPUT: """ & $sInput & """" & @CRLF) #cs --------------------------------------------------------------------------- Windows 2003/XP: Reads string terminated by [Enter] +----------------------------------------------------------- | Write some text and close with ENTER: ABCDE | | INPUT: "ABCDE" +----------------------------------------------------------- Windows 10 x32: Reads only the SECOND string terminated by [Enter] +----------------------------------------------------------- | Write some text and close with ENTER: ABCDE | FGHIJ | | INPUT: "FGHIJ" +----------------------------------------------------------- #ce --------------------------------------------------------------------------- 2. Then I found a way to make this work properly in both environments. The trick was FreeConsole/AttachConsole: #include <WinAPI.au3> Local $nChars, $tBuffer, $hConIN, $nCount, $sInChr, $sInput ; The next two lines make ReadFile work well in Windows 10 (and Windows 8.x ?) DllCall("Kernel32.dll", "bool", "FreeConsole") ; _WinAPI_FreeConsole() ??? _WinAPI_AttachConsole() $nChars = 1 $tBuffer = DllStructCreate("char") $hConIN = _WinAPI_CreateFile("CON", 2, 2) ConsoleWrite(@CRLF & "Write some text and close with ENTER: ") While 1 ; We read 1 char at a time and we want all of them _WinAPI_ReadFile($hConIN, DllStructGetPtr($tBuffer), $nChars, $nCount) If @error Then ExitLoop If $nCount > 0 Then $sInChr = BinaryToString(DllStructGetData($tBuffer, 1)) If $sInChr = @CR Then ExitLoop $sInput &= $sInChr EndIf WEnd If @error Then ConsoleWriteError(@CRLF & "ERROR: " & @error) _WinAPI_CloseHandle($hConIN) ConsoleWrite(@CRLF & "INPUT: """ & $sInput & """" & @CRLF) #cs --------------------------------------------------------------------------- Windows 2003/XP: Reads string terminated by [Enter] +----------------------------------------------------------- | Write some text and close with ENTER: ABCDE | | INPUT: "ABCDE" +----------------------------------------------------------- Windows 10 x32: Reads string terminated by [Enter] +----------------------------------------------------------- | Write some text and close with ENTER: ABCDE | | INPUT: "ABCDE" +----------------------------------------------------------- #ce --------------------------------------------------------------------------- 3. Then I simplified the code for the situation where I know the maximum number of characters I'm interested in: #include <WinAPI.au3> Local $nChars, $tBuffer, $hConIN, $nCount, $sInput ; The next two lines make ReadFile work well in Windows 10 (and Windows 8.x ?) DllCall("Kernel32.dll", "bool", "FreeConsole") ; _WinAPI_FreeConsole() ??? _WinAPI_AttachConsole() $nChars = 3 ; The struct size has to be $nChars or larger $tBuffer = DllStructCreate("char[" & $nChars & "]") $hConIN = _WinAPI_CreateFile("CON", 2, 2) ConsoleWrite(@CRLF & "Write some text and close with ENTER: ") ; Read $nChars (or less) at a time _WinAPI_ReadFile($hConIN, DllStructGetPtr($tBuffer), $nChars, $nCount) If @error Then ConsoleWriteError(@CRLF & "ERROR: " & @error) _WinAPI_CloseHandle($hConIN) $sInput = BinaryToString(DllStructGetData($tBuffer, 1)) ; This line is for input strings shorter by 1 compared to $nChars $sInput = StringReplace($sInput, @CR, "") ; This line is for input strings shorter by 2 or more compared to $nChars $sInput = StringReplace($sInput, @LF, "") ConsoleWrite(@CRLF & "INPUT: """ & $sInput & """" & @CRLF) #cs --------------------------------------------------------------------------- Windows 2003/XP: Reads string terminated by [Enter] +----------------------------------------------------------- | Write some text and close with ENTER: ABCDE | | INPUT: "ABC" +----------------------------------------------------------- | Write some text and close with ENTER: AB | | INPUT: "AB" +----------------------------------------------------------- | Write some text and close with ENTER: A | | INPUT: "A" +----------------------------------------------------------- | Write some text and close with ENTER: | | INPUT: "" +----------------------------------------------------------- Windows 10 x32: Reads string terminated by [Enter] +----------------------------------------------------------- | Write some text and close with ENTER: ABCDE | | INPUT: "ABC" +----------------------------------------------------------- | Write some text and close with ENTER: AB | | INPUT: "AB" +----------------------------------------------------------- | Write some text and close with ENTER: A | | INPUT: "A" +----------------------------------------------------------- | Write some text and close with ENTER: | | INPUT: "" +----------------------------------------------------------- #ce --------------------------------------------------------------------------- 4. Then I cracked the issue of having to press [Enter] to trigger the read (I wanted a "Press any key ..." input). The trick was finding the right flags combination for SetConsoleMode: #include <WinAPI.au3> Local $aDllRC, $hStdIN, $tBuffer, $hConIN, $nCount, $sInChr ; The next two lines make ReadFile work well in Windows 10 (and Windows 8.x ?) DllCall("Kernel32.dll", "bool", "FreeConsole") ; _WinAPI_FreeConsole() ??? _WinAPI_AttachConsole() ; SetConsoleMode is used to get 1 character without having to press [Enter] Local Const $STD_INPUT = -10 $aDllRC = DllCall("kernel32.dll", "handle", "GetStdHandle", "dword", $STD_INPUT) $hStdIN = $aDllRC[0] ; According to Microsoft documentation of SetConsoleMode for Input handles: ; ENABLE_ECHO_INPUT: 0x0004 - Disabled (For "Press any key: ") ; ENABLE_EXTENDED_FLAGS: 0x0080 - Enabled (by default) ; ENABLE_INSERT_MODE: 0x0020 - Enabled (by default) ; ENABLE_LINE_INPUT: 0x0002 - Disabled (For "Press any key: ") ; ENABLE_MOUSE_INPUT: 0x0010 - Enabled (by default) ; ENABLE_PROCESSED_INPUT: 0x0001 - Enabled (by default) ; ENABLE_QUICK_EDIT_MODE: 0x0040 - Enabled (by default) ; ENABLE_WINDOW_INPUT: 0x0008 - Disabled (by default) ; ENABLE_VIRTUAL_TERMINAL_INPUT: 0x0200 - Disabled (For "Press any key: ") ; TOTAL: 0x00F1 - Enabled only DllCall("kernel32.dll", "bool", "SetConsoleMode", "handle", $hStdIN, "dword", 0x00F1) $tBuffer = DllStructCreate("char") $hConIN = _WinAPI_CreateFile("CON", 2, 2) ConsoleWrite(@CRLF & "Press any key: ") ; Read just 1 character _WinAPI_ReadFile($hConIN, DllStructGetPtr($tBuffer), 1, $nCount) If @error Then ConsoleWriteError(@CRLF & "ERROR: " & @error) _WinAPI_CloseHandle($hConIN) $sInChr = BinaryToString(DllStructGetData($tBuffer, 1)) ; This line is for when the key pressed is [Enter] $sInChr = StringReplace($sInChr, @CR, "") ConsoleWrite(@CRLF & "INPUT: """ & $sInChr & """" & @CRLF) #cs --------------------------------------------------------------------------- Windows 2003/XP: Reads string terminated by [Enter] +----------------------------------------------------------- | Press any key: | INPUT: "A" +----------------------------------------------------------- +----------------------------------------------------------- | Press any key: | INPUT: "" +----------------------------------------------------------- Windows 10 x32: Reads string terminated by [Enter] +----------------------------------------------------------- | Press any key: | INPUT: "A" +----------------------------------------------------------- +----------------------------------------------------------- | Press any key: | INPUT: "" +----------------------------------------------------------- #ce --------------------------------------------------------------------------- And this made me really happy ... 5. However, I wanted to evaluate the suggestion made earlier by Jos, which is way simpler and works on Windows 10 but not on 2003/XP: Local $sInput ConsoleWrite(@CRLF & "Write some text and close with ENTER: ") While True ; ConsoleRead needs to be polled ... $sInput &= ConsoleRead() If @error Then ExitLoop if $sInput <> "" then ExitLoop Sleep(10) WEnd If @error Then ConsoleWriteError(@CRLF & "ERROR: " & @error) $sInput = StringReplace($sInput, @CRLF, "") ConsoleWrite(@CRLF & "INPUT: """ & $sInput & """" & @CRLF) #cs --------------------------------------------------------------------------- Windows 2003/XP: Skips the reading (ConsoleRead returns @error=1) +----------------------------------------------------------- | Write some text and close with ENTER: | ERROR: 1 | INPUT: "" +----------------------------------------------------------- Windows 10 x32: Reads string terminated by [Enter] (and keeps @CRLF) +----------------------------------------------------------- | Write some text and close with ENTER: ABCDE | | INPUT: "ABCDE" +----------------------------------------------------------- #ce --------------------------------------------------------------------------- 6. To my total surprise, the same two lines of code that made the previous solution work well, have totally broken this one: Local $sInput ; The next two lines BREAK ConsoleRead in Windows 10 (and Windows 8.x ?) DllCall("Kernel32.dll", "bool", "FreeConsole") DllCall("kernel32.dll", "bool", "AttachConsole", "dword", -1) ConsoleWrite(@CRLF & "Write some text and close with ENTER: ") While True ; ConsoleRead needs to be polled ... $sInput &= ConsoleRead() If @error Then ExitLoop if $sInput <> "" then ExitLoop Sleep(10) WEnd If @error Then ConsoleWriteError(@CRLF & "ERROR: " & @error) $sInput = StringReplace($sInput, @CRLF, "") ConsoleWrite(@CRLF & "INPUT: """ & $sInput & """" & @CRLF) #cs --------------------------------------------------------------------------- Windows 2003/XP: Skips the reading (ConsoleRead returns @error=1) +----------------------------------------------------------- | Write some text and close with ENTER: | ERROR: 1 | INPUT: "" +----------------------------------------------------------- Windows 10 x32: Skips the reading (ConsoleRead returns @error=1) +----------------------------------------------------------- | Write some text and close with ENTER: | ERROR: 1 | INPUT: "" +----------------------------------------------------------- #ce --------------------------------------------------------------------------- Food for thought ... ... but I'm done with this.1 point