Jump to content

Help with the Font Selector ComboBox


Recommended Posts

This works for WordPad..

#include <Misc.au3>

$text = "Hello from Wordpad.{ENTER}1 2 3 4 5 6 7 8 9 10{ENTER}"
$title = "Document - WordPad"
$FontTitle = "Font"

$Delay = 500;Slows things down so you can whats happening

Run("C:\Program Files\Windows NT\Accessories\wordpad.exe")

Send("+{UP 2}")

;Send KeyStokes to the Font Combobox using ControlSend

WinMenuSelectItem($title, "", "F&ormat", "&Font" )

;ControlSend ( "title", "text", controlID, "string" [, flag] )

ControlSend($FontTitle, "","Edit1", "BN Jinx");Font Type
ControlSend($FontTitle, "","Edit3", "{DEL}{DEL}20");Font size
ControlSend($FontTitle, "","ComboBox4", "G");Font Color
ControlSend($FontTitle, "","Button5", "{ENTER}");Ok Button


This should cycle through the colors getting the values, but its not sending the text to the Font Combobox as it did in the previous example...

#include <Misc.au3>

Opt("WinTitleMatchMode", 2)
$title = "Untitled - Notepad"
$CntrlID = 15
$FontTitle = "Font"

$Delay = 1  ; Increase this to 2000 to see the Font Changes


Dim $Colours[16] = ["Black","Maroon","Green","Olive","Navy","Purple","Teal","Grey","Silver","Red","Lime","Yellow","Blue","Fuchsia","Aqua","White"]

Dim $SendCol[16] = ["BL","M","G","O","N","P","T","G","S","R","L","Y","B","F","A","W"]


; This will not read the color combobox
;ControlCommand ( "title", "text", controlID, "command" [, "option"] )
;                         "GetCurrentSelection", ""

;Get Value for each Color
For $C = 0 to 15
    $font = _ChooseFont()

ControlSend($FontTitle, "","ComboBox4", $SendCol[$C])
ControlSend($FontTitle, "","Button5", "{ENTER}")

ControlSend($Title, "",$CntrlID, "text sent to ComboBox " &$SendCol[$C] &"{ENTER}" )

ControlSend($FontTitle, "","Button5", "{ENTER}")

$Selt = ("COLORREF rgbColors: " & $font[5] & @LF & "Hex BGR Color: " & $font[6] & @LF & "Hex RGB Color:"& $font[7]&"{ENTER}{ENTER}")

    ControlSend($Title, "",$CntrlID, "Colour is " &$Colours[$C] &"{ENTER}" &$Selt)


While 1

   $msg = GUIGetMsg()

      Case $msg = $GUI_EVENT_CLOSE

      Case $msg = $Cancel


I can`t work out why its not working....


2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

  • Moderators

I didn't look much into it past this:

Dim $Colours = StringSplit("Black,Maroon,Green,Olive,Navy,Purple,Teal,Grey,Silver,Red,Lime,Yellow,Blue,Fuchsia,Aqua,White", ',')

Dim $SendCol = StringSplit("BL,M,G,O,N,P,T,G,S,R,L,Y,B,F,A,W", ',')

For $i = 1 To UBound($Colours) - 1
    MsgBox(0, 'Color: ' & $i, $Colours[$i])
For $x = 1 To UBound($SendCol) - 1
    MsgBox(0, 'SendCol: ' & $x, $SendCol[$x])

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...