madmorgan Posted February 18, 2010 Posted February 18, 2010 (edited) hello all, i have this program im building well in the middle of doing and need help. it will be a TTS (text to speech) program. i have the tts bit working but i have left it out for now as my probelm is, if you run my script and click the settings > Edit you get the edit window load and you can change the test size and colour and background colour all that works fine but my probelm is if you click the back ground colour to somthing different it only changes the settings window it want pass over to the main app. can you have a look and tell were im going wrong please, i have put all the code in to one file and ill be making it better latter my spletting the code in to diffent fuctions and in to differnt files, so for now the code is a bit of a mess but please help me. here is the code. expandcollapse popup;Made By MadMorgan. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ;Varibuals Global $SIZE, $TCOLOUR, $BGCOLOUR, $FSTYLE $SIZE = 8 $BGCOLOUR = (0xFFFBF0) $TCOLOUR = (0x000000) $FSTYLE = ("MS Sans Serif") $Reader = ("") ;Main GUI #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Text To Spech Reader", 667, 546, 183, 124) GUISetBkColor($BGCOLOUR) $MenuItem1 = GUICtrlCreateMenu("File") $MenuItem2 = GUICtrlCreateMenu("Settings") $MenuItem6 = GUICtrlCreateMenuItem("Edit", $MenuItem2) $MenuItem3 = GUICtrlCreateMenu("Help") $MenuItem4 = GUICtrlCreateMenuItem("Exit", $MenuItem1) $MenuItem5 = GUICtrlCreateMenuItem("About", $MenuItem3) ;buttons that will link to the reader. $Button1 = GUICtrlCreateButton("Hello", 16, 40, 139, 57) $Button2 = GUICtrlCreateButton("Bye", 175, 38, 139, 57) $Button3 = GUICtrlCreateButton("Yes", 343, 38, 139, 57) $Button4 = GUICtrlCreateButton("No", 508, 39, 139, 57) $Group1 = GUICtrlCreateGroup("Type Your Own Text.", 8, 256, 649, 257) $Edit1 = GUICtrlCreateEdit("", 28, 367, 609, 137) GUICtrlSetData(-1, "Edit1") $Slider1 = GUICtrlCreateSlider(328, 296, 150, 45) $Label1 = GUICtrlCreateLabel("Volume", 336, 264, 119, 41, $SS_CENTER) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button5 = GUICtrlCreateButton("Play", 497, 290, 139, 57) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $MenuItem4 Exit Case $MenuItem6 SETTINGS() EndSwitch WEnd ;Functions Func SETTINGS() ;BACKGROUND COLOUR $Form2 = GUICreate("SETTINGS", 405, 416, 500, 143) $Group1 = GUICtrlCreateGroup("Back Ground Colour", 16, 16, 185, 97) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) $RED = GUICtrlCreateButton("RED", 24, 40, 75, 25) GUICtrlSetBkColor(-1, 0xFF0000) $GREEN = GUICtrlCreateButton("GREEN", 112, 40, 75, 25) GUICtrlSetBkColor(-1, 0x00FF00) $YELLOW = GUICtrlCreateButton("YELLOW", 24, 72, 75, 25) GUICtrlSetBkColor(-1, 0xFFFF00) $BLUE = GUICtrlCreateButton("BLUE", 112, 72, 75, 25) GUICtrlSetBkColor(-1, 0x00FFFF) GUICtrlCreateGroup("", -99, -99, 1, 1) ;TEXT COLOUR $Group2 = GUICtrlCreateGroup("Text Colour", 16, 128, 185, 97) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $REDT = GUICtrlCreateButton("RED", 24, 152, 75, 25) GUICtrlSetBkColor(-1, 0xFF0000) $GREENT = GUICtrlCreateButton("GREEN", 112, 152, 75, 25) GUICtrlSetBkColor(-1, 0x00FF00) $YELLOWT = GUICtrlCreateButton("YELLOW", 24, 184, 75, 25) GUICtrlSetBkColor(-1, 0xFFFF00) $BLUET = GUICtrlCreateButton("BLUE", 112, 184, 75, 25) GUICtrlSetBkColor(-1, 0x00FFFF) GUICtrlCreateGroup("", -99, -99, 1, 1) ;TEXT SIZE $Group3 = GUICtrlCreateGroup("Text Size", 216, 16, 169, 209) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Size1 = GUICtrlCreateButton("SIZE 10", 264, 40, 75, 25) GUICtrlSetFont(-1, 10, 800, 0, "") $Size2 = GUICtrlCreateButton("SIZE 14", 256, 80, 91, 25) GUICtrlSetFont(-1, 14, 800, 0, "") $Size3 = GUICtrlCreateButton("SIZE 18", 248, 120, 107, 33) GUICtrlSetFont(-1, 18, 800, 0, "") $Size4 = GUICtrlCreateButton("SIZE 24", 240, 168, 123, 41) GUICtrlSetFont(-1, 24, 800, 0, "") GUICtrlCreateGroup("", -99, -99, 1, 1) ;fount style $Group4 = GUICtrlCreateGroup("Text Style", 16, 248, 369, 89) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $radio = GUICtrlCreateRadio("Style 1", 24, 272, 97, 17) GUICtrlSetFont(-1, 10, 800, 0, "Balloonist SF") $Radio1 = GUICtrlCreateRadio("Style 2", 24, 296, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "Invite Engraved SF") $Radio2 = GUICtrlCreateRadio("Style 3", 144, 272, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "Comic Sans MS") $Radio3 = GUICtrlCreateRadio("Style 4", 144, 296, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "Cairo SF") $Radio4 = GUICtrlCreateRadio("Style 5", 256, 272, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "Accord Heavy SF") $Radio5 = GUICtrlCreateRadio("Style 6", 256, 296, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "Bookman Old Style") GUICtrlCreateGroup("", -99, -99, 1, 1) ;Preview $Input1 = GUICtrlCreateInput("Preview", 16, 344, 369, 40) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") ;Controls $Apply = GUICtrlCreateButton("Apply", 80, 384, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $CLOSE = GUICtrlCreateButton("CLOSE", 216, 384, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 2 $nMsg = GUIGetMsg() If $nMsg = $CLOSE Then ExitLoop ;FONT SELECT Select Case $nMsg = $radio And BitAND(GUICtrlRead($radio), $GUI_CHECKED) = $GUI_CHECKED GUICtrlSetFont($Input1, $SIZE, "", "", "Balloonist SF") $FSTYLE = ("Balloonist SF") Case $nMsg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED GUICtrlSetFont($Input1, $SIZE, "", "", "Invite Engraved SF") $FSTYLE = ("Invite Engraved SF") EndSelect ;MAIN CONTROLS Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $CLOSE GUIDelete($Form2) Case $Apply APPLY() ;TEXT SIZE Case $Size1 GUICtrlSetFont($Input1,10) $SIZE = 10 Case $Size2 GUICtrlSetFont($Input1,14) $SIZE = 14 Case $Size3 GUICtrlSetFont($Input1,18) $SIZE = 18 Case $Size4 GUICtrlSetFont($Input1,24) $SIZE = 24 ;TEXT COLOUR CONTROLS Case $REDT GUICtrlSetColor($Input1,0xFF0000) $TCOLOUR = 0xFF0000 Case $BLUET GUICtrlSetColor($Input1,0x00FFFF) $TCOLOUR = 0x00FFFF Case $GREENT GUICtrlSetColor($Input1,0x00FF00) $TCOLOUR = 0x00FF00 Case $YELLOWT GUICtrlSetColor($Input1,0xFFFF00) $TCOLOUR = 0xFFFF00 ;Back Ground Controls Case $RED GUISetBkColor(0xFF0000) $BGCOLOUR = 0xFF0000 Case $GREEN GUISetBkColor(0x00FF00) $BGCOLOUR = 0x00FF00 Case $BLUE GUISetBkColor(0x00FFFF) $BGCOLOUR = 0x00FFFF Case $YELLOW GUISetBkColor(0xFFFF00) $BGCOLOUR =0xFFFF00 EndSwitch WEnd GUIDelete($Form2) EndFunc Func APPLY() $Form3 = GUICreate("APPLYING SETTINGS", 297, 104) $Label1 = GUICtrlCreateLabel("PLEASE WAIT!!!", 40, 16, 249, 58) GUICtrlSetFont(-1, $SIZE, 800, 0, $FSTYLE) GUICtrlSetColor(-1, $TCOLOUR) $BGCOLOUR = GUISetBkColor($BGCOLOUR) GUISetState(@SW_SHOW) Sleep(1000) GUIDelete($Form3) MsgBox(0,"",$BGCOLOUR) EndFunc Edited February 18, 2010 by madmorgan
martin Posted February 18, 2010 Posted February 18, 2010 I think that you have applied the background to the Gui without specifying th eGui so it doesn't always work, and you haven't applied the settings to $Edit1 so of course it doesn't work, thoiugh maybe I nisunnderstood that bit. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ;Varibuals Global $SIZE, $TCOLOUR, $BGCOLOUR, $FSTYLE $SIZE = 8 $BGCOLOUR = (0xFFFBF0) $TCOLOUR = (0x000000) $FSTYLE = ("MS Sans Serif") $Reader = ("") ;Main GUI #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Text To Spech Reader", 667, 546, 183, 124) GUISetBkColor($BGCOLOUR) $MenuItem1 = GUICtrlCreateMenu("File") $MenuItem2 = GUICtrlCreateMenu("Settings") $MenuItem6 = GUICtrlCreateMenuItem("Edit", $MenuItem2) $MenuItem3 = GUICtrlCreateMenu("Help") $MenuItem4 = GUICtrlCreateMenuItem("Exit", $MenuItem1) $MenuItem5 = GUICtrlCreateMenuItem("About", $MenuItem3) ;buttons that will link to the reader. $Button1 = GUICtrlCreateButton("Hello", 16, 40, 139, 57) $Button2 = GUICtrlCreateButton("Bye", 175, 38, 139, 57) $Button3 = GUICtrlCreateButton("Yes", 343, 38, 139, 57) $Button4 = GUICtrlCreateButton("No", 508, 39, 139, 57) $Group1 = GUICtrlCreateGroup("Type Your Own Text.", 8, 256, 649, 257) $Edit1 = GUICtrlCreateEdit("", 28, 367, 609, 137) GUICtrlSetData(-1, "Edit1") $Slider1 = GUICtrlCreateSlider(328, 296, 150, 45) $Label1 = GUICtrlCreateLabel("Volume", 336, 264, 119, 41, $SS_CENTER) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button5 = GUICtrlCreateButton("Play", 497, 290, 139, 57) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $MenuItem4 Exit Case $MenuItem6 SETTINGS() EndSwitch WEnd ;Functions Func SETTINGS() ;BACKGROUND COLOUR $Form2 = GUICreate("SETTINGS", 405, 416, 500, 143) $Group1 = GUICtrlCreateGroup("Back Ground Colour", 16, 16, 185, 97) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) $RED = GUICtrlCreateButton("RED", 24, 40, 75, 25) GUICtrlSetBkColor(-1, 0xFF0000) $GREEN = GUICtrlCreateButton("GREEN", 112, 40, 75, 25) GUICtrlSetBkColor(-1, 0x00FF00) $YELLOW = GUICtrlCreateButton("YELLOW", 24, 72, 75, 25) GUICtrlSetBkColor(-1, 0xFFFF00) $BLUE = GUICtrlCreateButton("BLUE", 112, 72, 75, 25) GUICtrlSetBkColor(-1, 0x00FFFF) GUICtrlCreateGroup("", -99, -99, 1, 1) ;TEXT COLOUR $Group2 = GUICtrlCreateGroup("Text Colour", 16, 128, 185, 97) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $REDT = GUICtrlCreateButton("RED", 24, 152, 75, 25) GUICtrlSetBkColor(-1, 0xFF0000) $GREENT = GUICtrlCreateButton("GREEN", 112, 152, 75, 25) GUICtrlSetBkColor(-1, 0x00FF00) $YELLOWT = GUICtrlCreateButton("YELLOW", 24, 184, 75, 25) GUICtrlSetBkColor(-1, 0xFFFF00) $BLUET = GUICtrlCreateButton("BLUE", 112, 184, 75, 25) GUICtrlSetBkColor(-1, 0x00FFFF) GUICtrlCreateGroup("", -99, -99, 1, 1) ;TEXT SIZE $Group3 = GUICtrlCreateGroup("Text Size", 216, 16, 169, 209) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Size1 = GUICtrlCreateButton("SIZE 10", 264, 40, 75, 25) GUICtrlSetFont(-1, 10, 800, 0, "") $Size2 = GUICtrlCreateButton("SIZE 14", 256, 80, 91, 25) GUICtrlSetFont(-1, 14, 800, 0, "") $Size3 = GUICtrlCreateButton("SIZE 18", 248, 120, 107, 33) GUICtrlSetFont(-1, 18, 800, 0, "") $Size4 = GUICtrlCreateButton("SIZE 24", 240, 168, 123, 41) GUICtrlSetFont(-1, 24, 800, 0, "") GUICtrlCreateGroup("", -99, -99, 1, 1) ;fount style $Group4 = GUICtrlCreateGroup("Text Style", 16, 248, 369, 89) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $radio = GUICtrlCreateRadio("Style 1", 24, 272, 97, 17) GUICtrlSetFont(-1, 10, 800, 0, "Balloonist SF") $Radio1 = GUICtrlCreateRadio("Style 2", 24, 296, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "Invite Engraved SF") $Radio2 = GUICtrlCreateRadio("Style 3", 144, 272, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "Comic Sans MS") $Radio3 = GUICtrlCreateRadio("Style 4", 144, 296, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "Cairo SF") $Radio4 = GUICtrlCreateRadio("Style 5", 256, 272, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "Accord Heavy SF") $Radio5 = GUICtrlCreateRadio("Style 6", 256, 296, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "Bookman Old Style") GUICtrlCreateGroup("", -99, -99, 1, 1) ;Preview $Input1 = GUICtrlCreateInput("Preview", 16, 344, 369, 40) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") ;Controls $Apply = GUICtrlCreateButton("Apply", 80, 384, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $CLOSE = GUICtrlCreateButton("CLOSE", 216, 384, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 2 $nMsg = GUIGetMsg() If $nMsg = $CLOSE Then ExitLoop ;FONT SELECT Select Case $nMsg = $radio And BitAND(GUICtrlRead($radio), $GUI_CHECKED) = $GUI_CHECKED GUICtrlSetFont($Input1, $SIZE, "", "", "Balloonist SF") $FSTYLE = ("Balloonist SF") Case $nMsg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED GUICtrlSetFont($Input1, $SIZE, "", "", "Invite Engraved SF") $FSTYLE = ("Invite Engraved SF") EndSelect ;MAIN CONTROLS Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $CLOSE GUIDelete($Form2) Case $Apply APPLY() ;TEXT SIZE Case $Size1 GUICtrlSetFont($Input1,10) $SIZE = 10 Case $Size2 GUICtrlSetFont($Input1,14) $SIZE = 14 Case $Size3 GUICtrlSetFont($Input1,18) $SIZE = 18 Case $Size4 GUICtrlSetFont($Input1,24) $SIZE = 24 ;TEXT COLOUR CONTROLS Case $REDT GUICtrlSetColor($Input1,0xFF0000) $TCOLOUR = 0xFF0000 Case $BLUET GUICtrlSetColor($Input1,0x00FFFF) $TCOLOUR = 0x00FFFF Case $GREENT GUICtrlSetColor($Input1,0x00FF00) $TCOLOUR = 0x00FF00 Case $YELLOWT GUICtrlSetColor($Input1,0xFFFF00) $TCOLOUR = 0xFFFF00 ;Back Ground Controls<-----------the controls not the gui Case $RED GUICtrlSetBkColor($Input1,0xFF0000) $BGCOLOUR = 0xFF0000 Case $GREEN GUICtrlSetBkColor($Input1,0x00FF00) $BGCOLOUR = 0x00FF00 Case $BLUE GUICtrlSetBkColor($Input1,0x00FFFF) $BGCOLOUR = 0x00FFFF Case $YELLOW GUICtrlSetBkColor($Input1,0xFFFF00) $BGCOLOUR =0xFFFF00 EndSwitch WEnd GUIDelete($Form2) EndFunc Func APPLY() $Form3 = GUICreate("APPLYING SETTINGS", 297, 104) $Label1 = GUICtrlCreateLabel("PLEASE WAIT!!!", 40, 16, 249, 58) GUICtrlSetFont(-1, $SIZE, 800, 0, $FSTYLE) GUICtrlSetColor(-1, $TCOLOUR) GUICtrlSetFont($Edit1,$SIZE, 800, 0, $FSTYLE) GUICtrlSetColor($Edit1,$TCOLOUR) GUICtrlSetBkColor($Edit1,$BGCOLOUR) $BGCOLOUR = GUISetBkColor($BGCOLOUR) GUISetState(@SW_SHOW) Sleep(1000) GUIDelete($Form3) MsgBox(0,"",$BGCOLOUR) EndFunc Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
madmorgan Posted February 18, 2010 Author Posted February 18, 2010 im still building the rest of it so i have not set up the edit or the buttons on the main window yet. the probel is if you load the app from the taskbar > settings > edit and chose a colour it sets in only that window but not both and thats what i want it to do so if you click red background it applys it to the main window and the settings widow as well. so part of it have not been set yet like the text colour and size but i want all that information been passed from the settings window to the main app and it want send the back ground colour info to change the background on the main app.
madmorgan Posted February 18, 2010 Author Posted February 18, 2010 ok i have been working on this a bit now and have put all the text reader program in to the code as well so you can run it and see that it works but im still having my probelm getting the information from my settings windows to pass over to the main window. but for now here is what i got so can you all have a look and tell me how to get the information to pass from the settings window to the main app please. code below expandcollapse popup; By MadMorgan. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ;Varibuals Global $SIZE, $TCOLOUR, $BGCOLOUR, $FSTYLE $SIZE = 8 $BGCOLOUR = (0xFFFBF0) $TCOLOUR = (0x000000) $FSTYLE = ("MS Sans Serif") $Reader = ("") ;Main GUI #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Text To Spech Reader", 667, 546, 183, 124) GUISetBkColor($BGCOLOUR) $MenuItem1 = GUICtrlCreateMenu("File") $MenuItem2 = GUICtrlCreateMenu("Settings") $MenuItem6 = GUICtrlCreateMenuItem("Edit", $MenuItem2) $MenuItem3 = GUICtrlCreateMenu("Help") $MenuItem4 = GUICtrlCreateMenuItem("Exit", $MenuItem1) $MenuItem5 = GUICtrlCreateMenuItem("About", $MenuItem3) ;buttons that will link to the reader. $Button1 = GUICtrlCreateButton("Hello", 16, 40, 139, 57) $Button2 = GUICtrlCreateButton("Bye", 175, 38, 139, 57) $Button3 = GUICtrlCreateButton("Yes", 343, 38, 139, 57) $Button4 = GUICtrlCreateButton("No", 508, 39, 139, 57) $Group1 = GUICtrlCreateGroup("Type Your Own Text.", 8, 256, 649, 257) $Edit1 = GUICtrlCreateEdit("", 28, 367, 609, 137) GUICtrlSetData(-1, "") $Slider1 = GUICtrlCreateSlider(328, 296, 150, 45) $slidelim = GUICtrlSetLimit($Slider1,100,2) $Label1 = GUICtrlCreateLabel("Volume", 336, 264, 119, 41, $SS_CENTER) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button5 = GUICtrlCreateButton("Play", 497, 290, 139, 57) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $MenuItem4 Exit Case $MenuItem6 SETTINGS() Case $Button1 ;HELLO $volume = guictrlread($Slider1) $INPUTTEXT = ("HELLO") READ() Case $Button2 ;BYE $volume = guictrlread($Slider1) $INPUTTEXT = ("BYE") READ() Case $Button3 ;YES $volume = guictrlread($Slider1) $INPUTTEXT = ("YES") READ() Case $Button4 ;NO $volume = guictrlread($Slider1) $INPUTTEXT = ("NO") READ() Case $Button5 ;EDIT BOX $volume = guictrlread($Slider1) $INPUTTEXT = GUICtrlRead($Edit1) READ() Case $Slider1 $volume = guictrlread($Slider1) ;MsgBox(0,"",$volume) EndSwitch WEnd ;Functions Func SETTINGS() ;BACKGROUND COLOUR $Form2 = GUICreate("SETTINGS", 405, 416, 500, 143) $Group1 = GUICtrlCreateGroup("Back Ground Colour", 16, 16, 185, 97) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) $RED = GUICtrlCreateButton("RED", 24, 40, 75, 25) GUICtrlSetBkColor(-1, 0xFF0000) $GREEN = GUICtrlCreateButton("GREEN", 112, 40, 75, 25) GUICtrlSetBkColor(-1, 0x00FF00) $YELLOW = GUICtrlCreateButton("YELLOW", 24, 72, 75, 25) GUICtrlSetBkColor(-1, 0xFFFF00) $BLUE = GUICtrlCreateButton("BLUE", 112, 72, 75, 25) GUICtrlSetBkColor(-1, 0x00FFFF) GUICtrlCreateGroup("", -99, -99, 1, 1) ;TEXT COLOUR $Group2 = GUICtrlCreateGroup("Text Colour", 16, 128, 185, 97) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $REDT = GUICtrlCreateButton("RED", 24, 152, 75, 25) GUICtrlSetBkColor(-1, 0xFF0000) $GREENT = GUICtrlCreateButton("GREEN", 112, 152, 75, 25) GUICtrlSetBkColor(-1, 0x00FF00) $YELLOWT = GUICtrlCreateButton("YELLOW", 24, 184, 75, 25) GUICtrlSetBkColor(-1, 0xFFFF00) $BLUET = GUICtrlCreateButton("BLUE", 112, 184, 75, 25) GUICtrlSetBkColor(-1, 0x00FFFF) GUICtrlCreateGroup("", -99, -99, 1, 1) ;TEXT SIZE $Group3 = GUICtrlCreateGroup("Text Size", 216, 16, 169, 209) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Size1 = GUICtrlCreateButton("SIZE 10", 264, 40, 75, 25) GUICtrlSetFont(-1, 10, 800, 0, "") $Size2 = GUICtrlCreateButton("SIZE 14", 256, 80, 91, 25) GUICtrlSetFont(-1, 14, 800, 0, "") $Size3 = GUICtrlCreateButton("SIZE 18", 248, 120, 107, 33) GUICtrlSetFont(-1, 18, 800, 0, "") $Size4 = GUICtrlCreateButton("SIZE 24", 240, 168, 123, 41) GUICtrlSetFont(-1, 24, 800, 0, "") GUICtrlCreateGroup("", -99, -99, 1, 1) ;fount style $Group4 = GUICtrlCreateGroup("Text Style", 16, 248, 369, 89) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $radio = GUICtrlCreateRadio("Style 1", 24, 272, 97, 17) GUICtrlSetFont(-1, 10, 800, 0, "Balloonist SF") $Radio1 = GUICtrlCreateRadio("Style 2", 24, 296, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "Invite Engraved SF") $Radio2 = GUICtrlCreateRadio("Style 3", 144, 272, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "Comic Sans MS") $Radio3 = GUICtrlCreateRadio("Style 4", 144, 296, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "Cairo SF") $Radio4 = GUICtrlCreateRadio("Style 5", 256, 272, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "Accord Heavy SF") $Radio5 = GUICtrlCreateRadio("Style 6", 256, 296, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "Bookman Old Style") GUICtrlCreateGroup("", -99, -99, 1, 1) ;Preview $Input1 = GUICtrlCreateInput("Preview", 16, 344, 369, 40) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") ;Controls $Apply = GUICtrlCreateButton("Apply", 80, 384, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $CLOSE = GUICtrlCreateButton("CLOSE", 216, 384, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 2 $nMsg = GUIGetMsg() If $nMsg = $CLOSE Then ExitLoop ;FONT SELECT Select Case $nMsg = $radio And BitAND(GUICtrlRead($radio), $GUI_CHECKED) = $GUI_CHECKED GUICtrlSetFont($Input1, $SIZE, "", "", "Balloonist SF") $FSTYLE = ("Balloonist SF") Case $nMsg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED GUICtrlSetFont($Input1, $SIZE, "", "", "Invite Engraved SF") $FSTYLE = ("Invite Engraved SF") EndSelect ;MAIN CONTROLS Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $CLOSE GUIDelete($Form2) Case $Apply APPLY() ;TEXT SIZE Case $Size1 GUICtrlSetFont($Input1,10) $SIZE = 10 Case $Size2 GUICtrlSetFont($Input1,14) $SIZE = 14 Case $Size3 GUICtrlSetFont($Input1,18) $SIZE = 18 Case $Size4 GUICtrlSetFont($Input1,24) $SIZE = 24 ;TEXT COLOUR CONTROLS Case $REDT GUICtrlSetColor($Input1,0xFF0000) $TCOLOUR = 0xFF0000 Case $BLUET GUICtrlSetColor($Input1,0x00FFFF) $TCOLOUR = 0x00FFFF Case $GREENT GUICtrlSetColor($Input1,0x00FF00) $TCOLOUR = 0x00FF00 Case $YELLOWT GUICtrlSetColor($Input1,0xFFFF00) $TCOLOUR = 0xFFFF00 ;Back Ground Controls Case $RED GUISetBkColor(0xFF0000) $BGCOLOUR = 0xFF0000 Case $GREEN GUISetBkColor(0x00FF00) $BGCOLOUR = 0x00FF00 Case $BLUE GUISetBkColor(0x00FFFF) $BGCOLOUR = 0x00FFFF Case $YELLOW GUISetBkColor(0xFFFF00) $BGCOLOUR =0xFFFF00 EndSwitch WEnd GUIDelete($Form2) EndFunc Func APPLY() $Form3 = GUICreate("APPLYING SETTINGS", 297, 104) $Label1 = GUICtrlCreateLabel("PLEASE WAIT!!!", 40, 16, 249, 58) GUICtrlSetFont(-1, $SIZE, 800, 0, $FSTYLE) GUICtrlSetColor(-1, $TCOLOUR) $BGCOLOUR = GUISetBkColor($BGCOLOUR) GUISetState(@SW_SHOW) Sleep(1000) GUIDelete($Form3) MsgBox(0,"",$BGCOLOUR) EndFunc ;reader Func READ() $Reader = _StartTTS() _SetVolume($Reader, $volume) _Speak($Reader, $INPUTTEXT) EndFunc ;reader settings Func _StartTTS() Return ObjCreate("SAPI.SpVoice") EndFunc Func _SetRate(ByRef $Object, $iRate); Rates can be from -10 to 10 $Object.Rate = $iRate EndFunc Func _SetVolume(ByRef $Object, $iVolume);Volume $Object.Volume = $iVolume EndFunc Func _GetVoices(ByRef $Object, $bReturn = True) Local $sVoices, $VoiceGroup = $Object.GetVoices For $Voices In $VoiceGroup $sVoices &= $Voices.GetDescription() & '|' Next If $bReturn Then Return StringSplit(StringTrimRight($sVoices, 1), '|', 2) Return StringTrimRight($sVoices, 1) EndFunc Func _Speak(ByRef $Object, $sText) $Object.Speak($sText) EndFunc
martin Posted February 19, 2010 Posted February 19, 2010 Just apply the settings to the gui you want. Your Apply function makes no attempt to do that. My version applied the settings to the edit in the main gui. That might not have been what you wanted but I would have expected that it would have helped you rather than had zero effect. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
madmorgan Posted February 19, 2010 Author Posted February 19, 2010 Martin, can you please upload the one you got working please so i can have a look at the code so i can compare were i went wrong. thanks
martin Posted February 19, 2010 Posted February 19, 2010 Martin,can you please upload the one you got working please so i can have a look at the code so i can compare were i went wrong.thanksBut it's in post #2. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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