AndreyS

It seems a bug in the function _ChooseFont

7 posts in this topic

Try running the example from the help file and select the font color olive. In the next dialog, it will have turquoise. This happens with some other colors.

#include <Misc.au3>
#include <MsgBoxConstants.au3>

Local $a_vFont = _ChooseFont()

Local $sFontName = $a_vFont[2]
Local $iFontSize = $a_vFont[3]
Local $iColorRef = $a_vFont[5]
Local $iFontWeight = $a_vFont[4]
Local $bItalic = BitAND($a_vFont[1], 2)
Local $bUnderline = BitAND($a_vFont[1], 4)
Local $bStrikethru = BitAND($a_vFont[1], 8)
$a_vFont = _ChooseFont($sFontName, $iFontSize, $iColorRef, $iFontWeight, $bItalic, $bUnderline, $bStrikethru)
If (@error) Then
    MsgBox($MB_SYSTEMMODAL, "", "Error _ChooseFont: " & @error)
Else
    MsgBox($MB_SYSTEMMODAL, "", "Font Name: " & $a_vFont[2] & @CRLF & "Size: " & $a_vFont[3] & @CRLF & "Weight: " & $a_vFont[4] & @CRLF & "COLORREF rgbColors: " & $a_vFont[5] & @CRLF & "Hex BGR Color: " & $a_vFont[6] & @CRLF & "Hex RGB Color: " & $a_vFont[7])
EndIf

Autoit: 3.3.14.2. Windows: 8.1.

How to fix it?

Share this post


Link to post
Share on other sites



1 hour ago, AndreyS said:

How to fix it?

#include <Misc.au3>
#include <MsgBoxConstants.au3>

Local $a_vFont = _ChooseFont()

Local $sFontName = $a_vFont[2]
Local $iFontSize = $a_vFont[3]
Local $iColorRef = $a_vFont[7]
Local $iFontWeight = $a_vFont[4]
Local $bItalic = BitAND($a_vFont[1], 2)
Local $bUnderline = BitAND($a_vFont[1], 4)
Local $bStrikethru = BitAND($a_vFont[1], 8)
$a_vFont = _ChooseFont($sFontName, $iFontSize, $iColorRef)
If (@error) Then
    MsgBox($MB_SYSTEMMODAL, "", "Error _ChooseFont: " & @error)
Else
    MsgBox($MB_SYSTEMMODAL, "", "Font Name: " & $a_vFont[2] & @CRLF & "Size: " & $a_vFont[3] & @CRLF & "Weight: " & $a_vFont[4] & @CRLF & "COLORREF rgbColors: " & $a_vFont[5] & @CRLF & "Hex BGR Color: " & $a_vFont[6] & @CRLF & "Hex RGB Color: " & $a_vFont[7])
EndIf

 


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Thank you, JohnOne!
Perhaps for this purpose, this function returns the color representation so many options. )))

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I was looking for a more suitable, but not found. Tell me, please, in the future.

But the problem is not really in the documentation, so as soon as this function to work properly as in the example. Apparently with the release of a new version Autoit something changed.

Edited by AndreyS

Share this post


Link to post
Share on other sites
8 minutes ago, JohnOne said:

Maybe it went from RGB to BGR.

Very similar to that! Since not all the colors so. Just green unchanged.
Yes, thank you, you helped me!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now