NegativeNrG Posted December 15, 2005 Posted December 15, 2005 (edited) i need help setting Font/size/type. heres my existing Font script: #Include <misc.au3> $changefont = _ChooseFont() GUIctrlsetfont($Edit1,$changefont) and the following doesnt work, can anyone help? Edited December 15, 2005 by NegativeNrG [size=20]My File Upload[/size]Register at my site and upload.
NegativeNrG Posted December 15, 2005 Author Posted December 15, 2005 Thanks, but thats not what im looking for, to make it clearer, when the user clicks "font" the Fontmenu will come up, the user picks the font/size/type, then it assignes the font/size/type to $Edit1 so when the user types, it will type the font/size/type the user chose. [size=20]My File Upload[/size]Register at my site and upload.
Moderators SmOke_N Posted December 15, 2005 Moderators Posted December 15, 2005 i need help setting Font/size/type. heres my existing Font script: #Include <misc.au3> $changefont = _ChooseFont() GUIctrlsetfont($Edit1,$changefont) and the following doesnt work, can anyone help? Is that all the code you have? I've never tried to use the _ChooseFont() UDF, but I wouldn't even attempt helping without the GUI you're using. 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.
BigDod Posted December 15, 2005 Posted December 15, 2005 well, its for my Text Editor. #Include <GUIconstants.au3> #Include <misc.au3> $Form1 = GUICreate("Simple Text v0.1", 477, 299, 199, 129) $Edit1 = GUICtrlCreateEdit("", 8, 32, 465, 249, -1, $WS_EX_CLIENTEDGE) GUICtrlSetData($Edit1, "") $menu = GUICtrlCreateMenu("File") $item1 = GUICtrlCreateMenuitem("Open Alt+a", $menu) $item = GUICtrlCreateMenuitem("Save As.. Alt+z", $menu) $fontmenu = GUICtrlCreateMenu("Format") $font = GUICtrlCreateMenuitem("Font..", $fontmenu) $color = GUICtrlCreateMenuitem("colour..", $fontmenu) GUISetState(@SW_SHOW) While 1 $msg = GUIgetmsg() Select Case $msg = $font $changefont = _ChooseFont() GUIctrlsetfont($Edit1,$changefont) CASE ELSE EndSelect There, that should help out. Change GUIctrlsetfont($Edit1,$changefont) to GUIctrlsetfont($Edit1,$changefont[3],$changefont[4],$changefont[1],$changefont[2]) Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
NegativeNrG Posted December 15, 2005 Author Posted December 15, 2005 Thanks bigdod, that works, i couldnt find _ChooseFont() in the help file, so i didnt know if there was [1] etc. [size=20]My File Upload[/size]Register at my site and upload.
BigDod Posted December 15, 2005 Posted December 15, 2005 Thanks bigdod, that works, i couldnt find _ChooseFont() in the help file, so i didnt know if there was [1] etc.It is in the Beta help file. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
NegativeNrG Posted December 15, 2005 Author Posted December 15, 2005 oh, i see, Thanks for the info!. [size=20]My File Upload[/size]Register at my site and upload.
Lakes Posted February 12, 2006 Posted February 12, 2006 Maybe you can help me also... Ok, this works from the previous posting.. #Include <GUIconstants.au3> #Include <misc.au3> $Form1 = GUICreate("Simple Text v0.1", 477, 299, 199, 129) $Edit1 = GUICtrlCreateEdit("", 8, 32, 465, 249, -1, $WS_EX_CLIENTEDGE) GUICtrlSetData($Edit1, "") $menu = GUICtrlCreateMenu("File") $item1 = GUICtrlCreateMenuitem("Open Alt+a", $menu) $item = GUICtrlCreateMenuitem("Save As.. Alt+z", $menu) $fontmenu = GUICtrlCreateMenu("Format") $font = GUICtrlCreateMenuitem("Font..", $fontmenu) $color = GUICtrlCreateMenuitem("colour..", $fontmenu) GUISetState(@SW_SHOW) While 1 $msg = GUIgetmsg() Select Case $msg = $font $changefont = _ChooseFont() GUIctrlsetfont($Edit1,$changefont[3],$changefont[4],$changefont[1],$changefont[2]) CASE ELSE EndSelect WEnd But this does not... #include <Misc.au3> $text = "Hello from Notepad.{ENTER}1 2 3 4 5 6 7 8 9 10{ENTER}{ENTER}" $title = "Untitled - Notepad" $CntrlID = 15 Run("notepad.exe") $font = _ChooseFont() MsgBox(0, "", "Font Name: " & $font[2] & @LF & "Size: " & $font[3] & @LF & "Weight: " & $font[4] & @LF & "COLORREF rgbColors: " & $font[5] & @LF & "Hex BGR Color: " & $font[6] & @LF & "Hex RGB Color: " & $font[7]) GUIctrlsetfont($CntrlID, $font[3], $font[4], $font[1], $font[2]) ControlFocus ( $Title, "", $CntrlID) ControlSend($Title, "",$CntrlID, $Text) $font = _ChooseFont() MsgBox(0, "", "Font Name: " & $font[2] & @LF & "Size: " & $font[3] & @LF & "Weight: " & $font[4] & @LF & "COLORREF rgbColors: " & $font[5] & @LF & "Hex BGR Color: " & $font[6] & @LF & "Hex RGB Color: " & $font[7]) GUIctrlsetfont($CntrlID, $font[3], $font[4], $font[1], $font[2]) ControlFocus ( $Title, "", $CntrlID) ControlSend($Title, "",$CntrlID, $Text) what am I doing wrong? Thanks! 2015 - Still no flying cars, instead blankets with sleeves.
Valuater Posted February 12, 2006 Posted February 12, 2006 this line GUIctrlsetfont($ is for gui controls YOU created in Autoit ... not outside/other windows 8)
Lakes Posted February 12, 2006 Posted February 12, 2006 this line GUIctrlsetfont($ is for gui controls YOU created in Autoit ... not outside/other windows 8) This what I wanted to do, but I will to read the combobox controls first, so I can get what is already selected. #include <Misc.au3> $text = "Hello from Wordpad.{ENTER}1 2 3 4 5 6 7 8 9 10{ENTER}" $title = "Document - WordPad" Run("C:\Program Files\Windows NT\Accessories\wordpad.exe") WinWaitActive($title) Send($text) Send("+{UP 2}") WinMenuSelectItem($title, "", "F&ormat", "&Font" ) ;Send Keystokes to the Font ComboBox Send("{DOWN 3}{TAB}{DOWN 2}{TAB}{DOWN 4}{TAB 3 }{DOWN 4}{TAB 2}{ENTER}") 2015 - Still no flying cars, instead blankets with sleeves.
Lakes Posted February 15, 2006 Posted February 15, 2006 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... expandcollapse popup#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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now