Leaderboard
Popular Content
Showing content with the highest reputation on 06/10/2025 in Posts
-
Another AutoIt extension for Visual Studio Code
seadoggie01 and 2 others reacted to genius257 for a topic
Working towards the 1.9.0 release was taking too long, so I'm releasing 1.8.4 in the meantime Notable changes: ignoreInternalInIncludes setting would also ignore declarations in current file. Fixed so only internal declarations in included files are ignored. When resolving included files, the same file could be loaded from disk multiple times. This will improve performance, when opening au3 files.3 points -
Telegram Bot UDF
argumentum reacted to pat4005 for a topic
The fix is looking like this for me: ;@PRIVATE CHAT MESSAGE ; The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user (from bot's API manual). If (Json_Get($Json, '[result][0][my_chat_member][chat][type]') = 'private') Then Local $msgData[10] = [ _ Json_Get($Json, '[result][0][update_id]'), _ Json_Get($Json, '[result][0][my_chat_member][message_id]'), _ Json_Get($Json, '[result][0][my_chat_member][from][id]'), _ Json_Get($Json, '[result][0][my_chat_member][from][username]'), _ Json_Get($Json, '[result][0][my_chat_member][from][first_name]') _ ] $sUserBlockStatus = (Json_Get($Json, '[result][0][my_chat_member][new_chat_member][status]')) $msgData[6] = $sUserBlockStatus ;[6] = Member (bot) status in a private chat $msgData[7] = Json_Get($Json, '[result][0][my_chat_member][new_chat_member][user][id]') ;[7] = Member ID $msgData[8] = Json_Get($Json, '[result][0][my_chat_member][new_chat_member][user][username]') ;[8] = Member Username $msgData[9] = Json_Get($Json, '[result][0][my_chat_member][new_chat_member][user][first_name]') ;[9] = Member Firstname Return $msgData ; New message has appeared in a private chat ElseIf (Json_Get($Json, '[result][0][message][chat][type]') = 'private') Then ...1 point -
Andreik, I saw your reply over the weekend, and I was very excited to give it a try. You did exactly what I needed with one single line of code and it is much simpler than the original PowerShell script. It worked so well that I made a command line utility with a function where I could scale my laptop display to any percentage by passing a string as a parameter like: 100%, 125%, 150%, 175% or it’s equivalent numerical value 0,1,2, or 3. I’m afraid it will not be very useful as-is. Nonetheless, I included it further towards the end so you can see it. The problem is that I think I discovered why the MSDN site has a note for SPI_SETLOGICALDPIOVERRIDE that says Do not use. When I ran the same script on a different laptop, the values I passed would give different results. For example, I might use the 125% value, and the machine would scale to 175% instead. Here is an interesting read on that undocumented Microsoft feature: https://stackoverflow.com/questions/35233182/how-can-i-change-windows-10-display-scaling-programmatically-using-c-sharp/62916586#62916586 I bookmarked the articles to circle back later when I can free up some spare time. In short, it looks like the values 0 – 3 are index values relative to a specific value that represents the OS “recommended” percentage for the display. For example, the screenshot below shows 100% is recommended for the machine; therefore, 0 represents the recommended value index. If I use your line of code a value of 1 as seen below, then the display scales to the next step up, 125%. _WinAPI_SystemParametersInfo(0x009F,1, Null, 0x0001) The other laptop where my test failed has a recommended value of 150%, so I can run the same script with a value of -1 as seen below to bring it to 125% since this percentage is the next step below the recommended (0 index) value. _WinAPI_SystemParametersInfo(0x009F,-1, Null, 0x0001) The same article writer explains more in this article which I added an excerpt below. https://stackoverflow.com/questions/35233182/how-can-i-change-windows-10-display-scaling-programmatically-using-c-sharp/58066736#58066736 Note on DPI scaling on windows 1. DPI scaling is property of the source and not of target (see ViPN for these terminologies). 2. DPI scaling of a display is dependent on 3 factors - resolution, physical size of display, expected viewing distance. The exact formula which Windows uses to arrive at recommended value is unknown. 3. In OS parlance DPI scaling values have a meaning when compared against the recommended DPI scaling of a display. Thus although we see 100%, 125%, etc. in system settings app, the OS doesn't understand scaling in percentages. Instead number of steps above, or below recommended scaling is used. For eg. a DPI scaling value of -1 would mean 1 step lower than the recommended DPI scaling. So if for a monitor the recommended value is 150%, -1 would mean 125%. I used WinDbg Preview (MS Store), and Ghidra to do the reverse engineering. There was a point when I was about to give up for the lack of IDA Pro license, when someone suggested me Ghidra. I have been a fan ever since. First Draft #AutoIt3Wrapper_UseX64=y #include <WinAPISys.au3> ; --- (NOTE: Cannot scale Display on a Terminal Services (RDP) session. The environment variable SESSIONNAME will be Null("") ; on the current machine if running in a Terminal Services session; or "Console" id running on a computer standard session. If EnvGet('SESSIONNAME')<>'Console' Then MsgBox(16,'Session Error','Cannot scale Display on a Terminal Services (RDP) session.',60) Exit(-1) EndIf ; --- Set Display Scale Percentage according to the value passed via the command line. If $CmdLine[0]=1 Then $bReturn=_SetWinDisplayScalePercent($CmdLine[1]) If $CmdLine[0]<>1 OR $bReturn=False Then MsgBox(16,'Syntax Error','Syntax:' & @CRLF & @CRLF & 'Set_Windows_Display_Scale_Percent.exe [value | percentage]' & @CRLF & @CRLF _ & ' "0" or "100%" (default)' & @CRLF & ' "1" or "125%"' & @CRLF & ' "2" or "150%"' & @CRLF & ' "3" or "175%"' _ & @CRLF & @CRLF & 'Example 1 - Set scale to 125% : ' & @CRLF & @CRLF & ' Set_Windows_Display_Scale_Percent.exe 125%' & @CRLF & @CRLF _ & 'Example 2 - Set scale to 150% using value 2 :' & @CRLF & @CRLF & ' Set_Windows_Display_Scale_Percent.exe 2',60) Endif Exit ; #FUNCTION# ==================================================================================================================== ; Script Function: Change the Windows Display Scale Percentage on the fly without the need to reboot. Unlike other ; solutions found on the internet which require modifying the registry and a system reboot, this ; solution takes effect immediately. ; This AutoIt function is a conversion based on an original Powershell script that was posted on the internet ; by IanXue-MSFT on https://learn.microsoft.com/en-us/answers/questions/197944/batch-file-or-tool-like-powertoy-to-change-the-res.html ; ------------------------------------------------------------------------------------------------------------------------------ ; -- Sets the Display Scale Percentage to 100% or optionally to the value specified by $iScale ; ; _SetWinDisplayScalePercent([$iScale=0]) ; ; Parameter $iScale: ; # $iScale = 0 : 100% (default) ; # $iScale = 1 : 125% ; # $iScale = 2 : 150% ; # $iScale = 3 : 175% ; ; Return Value - Returns True (success) or False (failed) as returned by _WinAPI_SystemParametersInfo() ; Returns @error and extended as returned by _WinAPI_SystemParametersInfo() ; ; =============================================================================================================================== Func _SetWinDisplayScalePercent($ScalePercent='') Select Case $ScalePercent='' OR $ScalePercent='0' OR $ScalePercent='100%' $iScale=0 ; --- Default Case $ScalePercent='1' OR $ScalePercent='125%' $iScale=1 Case $ScalePercent='2' OR $ScalePercent='150%' $iScale=2 Case $ScalePercent='3' OR $ScalePercent='175%' $iScale=3 Case Else Return SetError(-1,-1,False) EndSelect ; --- Set the Display Scale ; SPI_SETLOGICALDPIOVERRIDE = 0x009F ; SPIF_UPDATEINIFILE = 0x0001 $iReturn=_WinAPI_SystemParametersInfo(0x009F, $iScale, Null, 0x0001) ; --- set the display to the selected scale percentage ; --- Return results Return SetError(@error,@extended,$iReturn) EndFunc ; end _SetWinDisplayScalePercent() ; ===============================================================================================================================1 point
-
Script to detect active internet connection (Working Now)
hudsonhock reacted to BrewManNH for a topic
Try this version, there's no recursion involved and it doesn't hammer the autoitscript.com site every second. #include <MsgBoxConstants.au3> #include <INet.au3> Global $dData While 1 $dData = _GetIP() If $dData <> -1 Then ; internet connection is working MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "YAY!!!", "Internet Connection Back!") EndIf Sleep(301000) ; sleep for 5 minutes (and one second) WEnd1 point -
how to get the IP information?
hudsonhock reacted to NBJ for a topic
For another way which will give an alternative if yours fails again ipconfig() ;~ -------------------------------------------------------------------------------- #cs Possible things to have returned Host Name Primary Dns Suffix Node Type IP Routing Enabled WINS Proxy Enabled DNS Suffix Search List Media State Description Physical Address Connection-specific DNS Suffix Description Physical Address Dhcp Enabled Autoconfiguration Enabled IP Address Subnet Mask Default Gateway DHCP Server DNS Servers Lease Obtained Lease Expires #ce ;~ -------------------------------------------------------------------------------- Func ipconfig($lookfor = "IP Address") $cmd = Run(@Comspec & " /c ipconfig /all", "" , @SW_HIDE, 2+4) $Result = "" While 1 $line = StdoutRead($cmd) If @error Then Return "Error" if StringInStr($line,$lookfor) then ExitLoop WEnd $Data = StringSplit(StringStripWS($line,7),$lookfor,1) $Data = StringSplit($Data[2],":",1) $Data = StringStripWS($Data[2],7) ConsoleWrite (@CR & $lookfor & "=" &$Data) Return $Data EndFunc Cheers wakido1 point