Leaderboard
Popular Content
Showing content with the highest reputation on 06/23/2025 in Posts
-
Need help converting percentage to hex
WildByDesign and one other reacted to UEZ for a topic
I misunderstood the value but it's easy, too: Local $iIntensity = '80' ;% of the alpha channel Local $iTintColor = '0x0078D4' $iIntensity = Int($iIntensity) * 255 / 100 Local $iColor = BitOR(BitShift($iIntensity > 255 ? 255 : $iIntensity < 0 ? 0: $iIntensity, -24), Int($iTintColor)) ConsoleWrite(Hex($iColor, 8) & @CRLF) _WinAPI_DwmEnableBlurBehindWindow10($hGUI, True, $iColor)2 points -
Need help converting percentage to hex
ioa747 and one other reacted to argumentum for a topic
If all this is for coloring, there is code for all that in https://www.autoitscript.com/forum/files/file/489-my-fine-tuned-high-contrast-theme/ If is for Hex, do give the user 255% because, why not. It'd simplify your code, enlighten the user, and gives fine control ( other wise you'd have to calculate "value * 2.55" each step ) for those that are very picky with colors. I look at it as from zero to Maximum Effort !2 points -
Need help converting percentage to hex
argumentum reacted to WildByDesign for a topic
Thank you very much. That works beautifully.1 point -
Need help converting percentage to hex
WildByDesign reacted to UEZ for a topic
Try: Local $iIntensity = '80' ;hex Local $iTintColor = '0x0078D4' Local $iColor = BitOR(BitShift(Dec($iIntensity), -24), Int($iTintColor)) ConsoleWrite(Hex($iColor, 8) & @CRLF) _WinAPI_DwmEnableBlurBehindWindow10($hGUI, True, $iColor)1 point -
Need help converting percentage to hex
argumentum reacted to WildByDesign for a topic
Exquisite is the perfect and only word to describe your math, I agree. Thank you very much.1 point -
Need help converting percentage to hex
WildByDesign reacted to argumentum for a topic
ConsoleWrite(percentageOfAlpha(80, 0xFF1234FF) & @CRLF) ConsoleWrite(percentageOfAlpha(80, '0xFF0000FF') & @CRLF) ConsoleWrite(percentageOfAlpha(80, 0x0000FF) & @CRLF) ConsoleWrite(percentageOfAlpha(80, '0x0000FF') & @CRLF) Func percentageOfAlpha($iVal, $iColor) Return "0x" & percentageOfHex($iVal) & Hex($iColor, 6) ;~ Local $a = StringSplit(Hex($iColor, 6), "", 0) ;~ Return "0x" & percentageOfHex($iVal) & $a[$a[0] - 5] & $a[$a[0] - 4] & $a[$a[0] - 3] & $a[$a[0] - 2] & $a[$a[0] - 1] & $a[$a[0] - 0] EndFunc ;==>percentageOfAlpha Func percentageOfHex($iVal) $iVal = Int($iVal > 99 ? 100 : ($iVal < 1 ? 0 : $iVal)) ; no more than 100% or less than 0% Return Hex(Ceiling(($iVal * 100) * (2.55 * 100) / (100 * 100)), 2) ; calculate in integers, as floating point numbers suck in a CPU EndFunc ;==>percentageOfHex gotta say, my math is exquisite1 point -
Need help converting percentage to hex
WildByDesign reacted to argumentum for a topic
ConsoleWrite( percentageOfHex(110) & @CRLF) ConsoleWrite( percentageOfHex(80) & @CRLF) ConsoleWrite( percentageOfHex(-2) & @CRLF) Func percentageOfHex($iVal) $iVal = Int($iVal > 99 ? 100 : ($iVal < 1 ? 0 : $iVal)) ; no more than 100% or less than 0% Return Hex(Ceiling(($iVal * 100) * (2.55 * 100) / (100 * 100)), 2) ; calculate in integers, as floating point numbers suck in a CPU EndFunc1 point -
It's on my list to look at when I next have a dev spurt.1 point
-
Need help converting percentage to hex
SOLVE-SMART reacted to WildByDesign for a topic
Well that is actually really interesting. And thank you for your reply as well, by the way. I am still at that stage where I haven't really looked at AI at all yet. So looking at your AI response link there is my first actual look into something from AI. And to be honest, the response is really quite helpful. Particularly the way that it breaks down how it works. One reason why I have stayed away from AI is because I am still very new to AutoIt and I really would like to learn and fully understand things as best as possible. And then maybe dip into AI if needed. But this is very helped, I must admit. Thank you.1 point -
Need help converting percentage to hex
WildByDesign reacted to SOLVE-SMART for a topic
Hi @WildByDesign 👋 , this is one of rar good examples on when to use AI (in my opinion). Please have a look: https://chatgpt.com/share/68593c0e-abac-800f-b469-a29209d5d520 I really just copy and paste your question and already got an idea of how an approach could look like. I don't suggest to use AI to generate AutoIt code, becauce AutoIt code examples are not listed/progressed enough in the most LLMs, but I suggest to get the idea (which is close to your thoughts above) and then come up with the code/solution in AutoIt for yourself or by us as community 😀 . Hopefully this is a good starting point. Best regards Sven1 point -
Need help converting percentage to hex
WildByDesign reacted to ahmet for a topic
What is FF when converted to decimal? You have minimum of zero in hexadecimal that matches 0 in dec. You also have FF in hexadecimal that matches to what in decimal? Then map (0,100) in decimal to (0,FF) afte you have converted it to decimal.1 point -
As promised I post the updated UDF when I had the time to finish it. Please don't hesitate to report issues, i have made a few last minute changes that should not interfere but shit usually happens when you don't expect it. I was doubting for a long while; Would I create a new topic or would I add it to the existing topic? Two reasons I have chosen to create a new topic for it: -The programming has been changed so drastically that you cannot incorporate this UDF into your existing projects that are based on the old WINHTTP UDF. -Not just the fact that this UDF is curl based, but the given examples are demonstrating on many levels how you can apply the Curl UDF (including the mime adoption for media/file posting) and something simple but not obvious: how to get the HTTP response code, also when authentication errors like 401/407 occur. Because of the file-size of the libcurl DLL's, I cannot incorporate them into the zip archive so you have to download the libcurl library yourself from the libcurl.se site. As said above, the script also has some optimized (script breaking!) changes regarding the update array that Telegram returned. I know the earlier editions of the older UDF also used the curl executable, this edition uses libcurl instead: I had to test this on hardware and configuration certified environments, some of them are running specific windows environment that do not allow patching or updating/upgrading and won't be for quite a long time. It is there where WINHTTP was really shortcoming without patching. With libcurl, at least you can guarantee your production works out-of-the-box on X86 and X64 editions of windows without letting people to go through all kinds of pain by having to install KB updates or fixes and perhaps not getting any further afterall. New This version is now communicating with the security standards libcurl supports out of the box (no more unsecured plain text https queries) Proxy connections are supported (with or without authentication), i have tested with Synology proxy server, mitm proxy software and a service provider proxy. _getChatmember() has been added _getChatAdministrators() has been added _deleteMessage() has been added/altered to work $TELEGRAM_DEBUG allows enabling two levels of verbosity and logging to an output file to allow you to get debug data _UserPoll() routine support added -> You can build GUI components to process. Don't expect to build 60fps games, but at least you can interact with the GUI decently. (See adapted test.au3 how this works). Changed The _MsgDecode() function now returns a 2D array, rather than a 1D array (script breaking!) -> you need to process $msgData[$Record][$Field] instead of $msgData[$Field] $msgData[$Record][$MESSAGE_ID] is prefixed with a two or three character type indicator: p_, g_, c_, ep_, eg_, ec_ (private, group, channel) (see relaybot.au3 how filtering works) Fixes Binarycall has been altered: OnAutoit3ExitRegister has been removed. (Caused crash if you added your own onAutoitExitRegister callback function) __BinaryCall_DoRelease() is called more often to prevent memory hogging and is added to _Telegram_Close() function The full JSON array is now processed and resulting in this former mentioned 2D array. It saves multiple http queries for the same JSON array buffer if it is large. -> When bot is offline and multiple users were firing all kinds of commands and texts into the chat, group or channel during the bot's absence, Telegram is shoving down the whole history into the bot's throat for processing as soon as it gets online again. The larger the buffered data is, the longer it took to process and redownload before the buffer got released on the telegram server. In some cases I experienced a never-ending loop with the original UDF. I have added the LGPL license text, however: i did *not* have had any answer from Luca regarding the proposed change so it is not effective currently even though I changed a lot of code. telegram-udf-curl-autoit-master.zip1 point