Leaderboard
Popular Content
Showing content with the highest reputation on 08/02/2023 in all areas
-
Tester needed ^^
argumentum and one other reacted to UEZ for a topic
This is the updated sample GUI code I made in parallel to argumentum's thread. Console output is the output of ConsoleWrite In SciTE the window at the bottom but not visible when compile. If you add #AutoIt3Wrapper_Change2CUI=Y then the output will be shown in a cmd or terminal window depending on the os you are running. Good for debugging purposes.2 points -
SystemParametersInfo > GetSystemFont ( I made an ugly bug )
Andreik reacted to argumentum for a topic
I'll be using it as: #include <Array.au3> Global $g_aFont = _SystemParametersInfo_GetSystemFont() Global $hGUI = GUICreate('Test', 400, 400) GUISetState(@SW_SHOW, $hGUI) GUIDelete($hGUI) _ArrayDisplay($g_aFont) Func _SystemParametersInfo_GetSystemFont($sFontUseage = 'MenuFont') Local $dMenuFont = Binary(RegRead('HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics', $sFontUseage)) ;Local $aFont[6] ; [FaceName, Weight(18,17); Quality(27); Italic(21); Underline(22); Strikeout(23)] Local $aFont[4] ; [FaceName, Weight; Quality; Attributes] $aFont[0] = BinaryToString('0x' & StringRegExpReplace($dMenuFont,'^0x(([0-9a-fA-F]{2}){28})|((00){4})+$', ''), 2) $aFont[1] = Dec(Hex(BinaryMid($dMenuFont, 18, 1) & BinaryMid($dMenuFont, 17, 1))) $aFont[2] = Dec(Hex(BinaryMid($dMenuFont, 27, 1))) $aFont[3] = BitOR(Dec(Hex(BinaryMid($dMenuFont, 21, 1))), Dec(Hex(BinaryMid($dMenuFont, 22, 1))), Dec(Hex(BinaryMid($dMenuFont, 23, 1)))) Return $aFont EndFunc given that we use the attributes BitORed.1 point -
SystemParametersInfo > GetSystemFont ( I made an ugly bug )
argumentum reacted to Andreik for a topic
Until someone will get the real problem you can use this. #include <Array.au3> Global $___gt__HiDpi_WinFont = _SystemParametersInfo_GetSystemFont() $hGUI = GUICreate('Test', 400, 400) GUISetState(@SW_SHOW, $hGUI) _ArrayDisplay($___gt__HiDpi_WinFont) Func _SystemParametersInfo_GetSystemFont() Local $dMenuFont = Binary(RegRead('HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics', 'MenuFont')) Local $aFont[6] ; [FaceName, Weight; Quality; Italic; Underline; Strikeout] $aFont[0] = BinaryToString('0x' & StringRegExpReplace($dMenuFont,'^0x(([0-9a-fA-F]{2}){28})|((00){4})+$', ''), 2) $aFont[1] = Dec(Hex(BinaryMid($dMenuFont, 18, 1) & BinaryMid($dMenuFont, 17, 1))) $aFont[2] = Dec(Hex(BinaryMid($dMenuFont, 27, 1))) $aFont[3] = Dec(Hex(BinaryMid($dMenuFont, 21, 1))) $aFont[4] = Dec(Hex(BinaryMid($dMenuFont, 22, 1))) $aFont[5] = Dec(Hex(BinaryMid($dMenuFont, 23, 1))) Return $aFont EndFunc1 point -
SystemParametersInfo > GetSystemFont ( I made an ugly bug )
argumentum reacted to Andreik for a topic
You can open a ticket, I am curios as well. I had a look over an old version of AutoIt source code to see if there is something obvious in GuiSetState(). Didn't find anything relevant but I don't know anyway if and how it changed in latest versions.1 point -
SystemParametersInfo > GetSystemFont ( I made an ugly bug )
argumentum reacted to Andreik for a topic
#include <StructureConstants.au3> Local $dMenuFont = Binary(RegRead('HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics', 'MenuFont')) Local $tLOGFONT = DllStructCreate('byte[' & BinaryLen($dMenuFont) & ']') DllStructSetData($tLOGFONT, 1, $dMenuFont) Local $tNew = DllStructCreate($tagLOGFONT, DllStructGetPtr($tLOGFONT)) ConsoleWrite("Italic: " & $tNew.Italic & @CRLF) ConsoleWrite("Underline: " & $tNew.Underline & @CRLF) ConsoleWrite("Strikeout: " & $tNew.Strikeout & @CRLF) ConsoleWrite("Weight: " & $tNew.Weight & @CRLF) ConsoleWrite("Quality: " & $tNew.Quality & @CRLF) ConsoleWrite("FaceName: " & $tNew.FaceName & @CRLF)1 point -
SystemParametersInfo > GetSystemFont ( I made an ugly bug )
argumentum reacted to Andreik for a topic
Local $dMenuFont = Binary(RegRead('HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics', 'MenuFont')) Local $tMF = DllStructCreate('byte Data[' & BinaryLen($dMenuFont) & ']') DllStructSetData($tMF, 'Data', $dMenuFont) Local $tFontName = DllStructCreate('wchar FontName[32]', DllStructGetPtr($tMF) + 28) ConsoleWrite(DllStructGetData($tFontName, 'FontName') & @CRLF) Like this?1 point -
SystemParametersInfo > GetSystemFont ( I made an ugly bug )
argumentum reacted to UEZ for a topic
You mean compiled? x64 or x86? I see only running the x64 compiled version that the fonts are bold. Main monitor at 125% compiled: Btw, your $tagNONCLIENTMETRICS struct is not correct -> the arrays must be 92 of size and not 60! When running at 100% the x64 exe and changing the monitor to 125% I get following output: Font : Attributes: 0 Font : Weight: 400 Font : Quality: 0 Font : FaceName: Segoe UI - $___ga__HiDpi_Controls 0 - ratio2 96 + $___gi__HiDpi_Context = -4 @@ (-1,0) : 0,28 ..lets use WM_DPICHANGED + Func WM_DPICHANGED(0x0000000000160A36, 02E0, 0x0000000000780078, 0x0000003AF9DDF870) - $dpi_new = 120 - $dpi_ratio = 1.25 - $dpi_ratio2 = 0.8 - WM_DPICHANGED TimerDiff: 314.8765 GUI looks ok, no bold font. Even when switching back to 100% again.1 point -
There are several ways to accomplish this. If you already have the handle of the target tab, then you use _WD_Window -- _WD_Window($sSession, 'Switch', $sTargetHandle) Otherwise, you can use _WD_Attach -- _WD_Attach($sSession, "google.com", "URL")1 point
-
"GuiCtrls_HiDpi" (UDF in progress)
argumentum reacted to Shark007 for a topic
x64 compile is an absolute MUST HAVE to avoid false positives.1 point -
"GuiCtrls_HiDpi" (UDF in progress)
argumentum reacted to Shark007 for a topic
1 point -
SpellNumber function to convert numbers to words
ioa747 reacted to Mateocedillo for a topic
Hi, I have been trying to do something for Spanish, but there are things that I surely have to improve. Here's my code: #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include-once Global $nNumber, $bIncludeAnd, $sNumber MsgBox(0, "Result", NumberToWords(23456, False)) Func NumberToWords($nNumber, $bIncludeAnd = True) Local $aOnes = StringSplit("cero,uno,dos,tres,cuatro,cinco,seis,siete,ocho,nueve", ",") local $aTildes = StringSplit("dós,trés,cuatro,cinco,séis,siete,ocho,nueve", ",") Local $aTeens = StringSplit("diez,once,doce,trece,catorce,quince,dieciseis,diecisiete,dieciocho,diecinueve", ",") Local $aTens = StringSplit("dieci,veinte,treinta,cuarenta,cincuenta,sesenta,setenta,ochenta,noventa", ",") Local $aHundreds = StringSplit("cien,doscientos,trescientos,cuatrocientos,quinientos,seiscientos,setecientos,ochocientos,novecientos", ",") local $bTilde Local $sNumber = "" If $nNumber = 0 Then $sNumber = "cero" ElseIf $nNumber < 0 Then $sNumber = "menos " & NumberToWords(Abs($nNumber), $bIncludeAnd) Else If $nNumber >= 1000000 Then $sNumber = NumberToWords(int($nNumber / 1000000), $bIncludeAnd) & " millones " If $bIncludeAnd And mod($nNumber, 1000000) Then $sNumber &= "y " $nNumber = mod($nNumber, 1000000) EndIf switch $nNumber case 1 to 1999 ; para evitar que convierta "uno mil xxx" if StringLen($nNumber) = 4 and StringLeft($nNumber, 1) = 1 then $sNumber &= "mil " case 2000 to 999999 $sNumber &= NumberToWords(Int($nNumber / 1000), $bIncludeAnd) & " mil " EndSwitch If $bIncludeAnd And mod($nNumber, 1000) Then $sNumber &= "y " $nNumber = mod($nNumber, 1000) switch $nNumber $bTilde = False case 100 ; número propio. $sNumber &= "cien " case 101 to 199 ; aquí se tendrá que convertir ciento. $sNumber &= "ciento " case 200 to 999 ; aquí doscientos, trescientos, cuatrocientos, etc. $sNumber &= $aHundreds[Int($nNumber / 100)] & " " EndSwitch $nNumber = mod($nNumber, 100) If $nNumber >= 20 Then if StringRight($nNumber, 1) >= 1 then If not StringLeft($nNumber, 1) = 2 then $bTilde = False $sNumber &= $aTens[Int($nNumber / 10)] & " y " Else $sNumber &= "veinti" $bTilde = True EndIf Else $sNumber &= $aTens[Int($nNumber / 10)] & " " EndIf $nNumber = mod($nNumber, 10) ElseIf $nNumber >= 10 Then $sNumber &= $aTeens[$nNumber - 9] & " " ;$nNumber = StringRight($nNumber, 1) $nNumber = 0 EndIf If $nNumber > 2 Then if $bTilde then $bTilde = False $sNumber &= $aTildes[$nNumber-1] & " " Else $sNumber &= $aOnes[$nNumber+1] & " " EndIf EndIf EndIf Return StringStripWS($sNumber, $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES) EndFunc1 point -
If used in the code in post #1, with the OP's requirements for sure it will. In this case the assertion returns true1 point
-
StringRegEx not working when inserting a variable in the pattern
TheOne23 reacted to pixelsearch for a topic
@TheOne23 the superfluous single quote delimiter seems to create the issue : ; Local $string = "'(" & $keywords_split_2 & ")(?!.*\1\b)'" Local $string = "(" & $keywords_split_2 & ")(?!.*\1\b)" Does it solve your problem ?1 point -
I've been using AutoIt for a couple of decades now, and created hundreds of programs, and my knowledge of C and derivatives could be written on a Napkin, and in all reality has never served me in my use of AutoIt. That said, I have of course benefited from the understanding of C etc by those who have developed and maintain AutoIt. I mostly came to AutoIt via VB 4, 5 & 6, especially VBA, where I would have created (and still do) lots of VBA macros. I'd dabbled with some C variants etc, but was quite turned off by them, they not matching how my mind works or wants to work. I'd class AutoIt as a bit like VB, but with a lot of the nonsense missing. To this day, despite how experienced I am with VBA, it still regularly gives me grief ... that rarely occurs with AutoIt ... all to do, in my view, with the mentality behind them. But then I am totally self taught, in the monkey-see monkey-do style of coding, with the ability to analyze enough. I am not well versed on theory and concepts, other than what I have picked up on-the-fly. Jon & the AutoIt Team, past & present, have liberated many folk like myself, for which I will eternally be grateful. In my view, AutoIt is the best language for the average person on the street to use, bar none. It is simple enough and plain speaking enough, with a superb Help file, to introduce many to programming, without the requirement to be nerdy etc. Many of course then move onto other languages, but often retain AutoIt in their toolbox.1 point
-
Use mine : #include <Constants.au3> Opt("MustDeclareVars", 1) Const $sZipFile = @ScriptDir & "\Test.zip" Const $sDestFolder = @ScriptDir & "\Temp" UnZip($sZipFile, $sDestFolder) If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error unzipping file : " & @error) Func UnZip($sZipFile, $sDestFolder) If Not FileExists($sZipFile) Then Return SetError (1) ; source file does not exists If Not FileExists($sDestFolder) Then If Not DirCreate($sDestFolder) Then Return SetError (2) ; unable to create destination Else If Not StringInStr(FileGetAttrib($sDestFolder), "D") Then Return SetError (3) ; destination not folder EndIf Local $oShell = ObjCreate("shell.application") Local $oZip = $oShell.NameSpace($sZipFile) Local $iZipFileCount = $oZip.items.Count If Not $iZipFileCount Then Return SetError (4) ; zip file empty For $oFile In $oZip.items $oShell.NameSpace($sDestFolder).copyhere($ofile) Next EndFunc ;==>UnZip1 point