Sign in to follow this  
Followers 0
Lakes

Help with the Font Selector ComboBox

2 posts in this topic

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")

WinWaitActive($title)
Send($text)
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
sleep($Delay)
ControlSend($FontTitle, "","Edit3", "{DEL}{DEL}20");Font size
sleep($Delay)
ControlSend($FontTitle, "","ComboBox4", "G");Font Color
sleep($Delay)
ControlSend($FontTitle, "","Button5", "{ENTER}");Ok Button

Send("{DOWN}")

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"]

Run("notepad.exe")

; 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}" )

sleep($Delay)
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)

Next 
;------------------------------------------------------------

While 1

   $msg = GUIGetMsg()

   Select
      Case $msg = $GUI_EVENT_CLOSE
         GUIDelete()
         Exit

      Case $msg = $Cancel
         ExitLoop
   EndSelect

WEnd

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

Thanks!


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

Share this post


Link to post
Share on other sites



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])
Next
For $x = 1 To UBound($SendCol) - 1
    MsgBox(0, 'SendCol: ' & $x, $SendCol[$x])
Next

[center]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.[/center]

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
Sign in to follow this  
Followers 0