Jump to content

New to this - a little help required


 Share

Recommended Posts

I am very new to writing such scripts - any infact - but have pieced together a GUI for openening and application we use.

I cannot however seem to change the text for just the GuiCtrlCreateLabel ("Please select .."). When I add in GUISetFont it changes the size of the font for both the label and my first button! I cannot work this out - i am sure it is sometihng simple. PLease see below and many thanks.

#include <GUIConstantsEx.au3>

#include <ButtonConstants.au3>

#include <StaticConstants.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()

GUICreate ("MOSAIQ Department Chooser", 400, 520, -1, -1) ; will create a dialog box that when displayed is centered

GuiSetIcon(@SystemDir & "\mspaint.exe", 0)

; PIC

GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\Examples\GUI\loc.jpg", 0,0, 169,68)

GUISetFont (14)

GuiCtrlCreateLabel("Please Select Your Department", 80, 100, -1, -1, $SS_CENTER) GUICtrlSetColor(-1, 0xff0000)

Local $Button_1, $Button_2, $Button_3, $Button_4, $Button_5, $msg

Opt("GUICoordMode", 2)

$Button_1 = GUICtrlCreateButton("MOSAIQ SCRUK", -1, 10, 110, 50, $BS_DEFPUSHBUTTON, 0x0001)

GUISetFont (9)

$Button_2 = GUICtrlCreateButton("MOSAIQ LOC", -1, 10, 110, 50, $BS_DEFPUSHBUTTON, 0x0001);Left, Top, Width, Height, Style ex style

GUISetFont (9)

$Button_3 = GUICtrlCreateButton("MOSAIQ PMC", -1, 10, 110, 50, $BS_DEFPUSHBUTTON, 0x0001)

GUISetFont (9)

$Button_4 = GUICtrlCreateButton("MOSAIQ LBH", -1, 10, 110, 50, $BS_DEFPUSHBUTTON, 0x0001)

GUISetFont (9)

$Button_5 = GUICtrlCreateButton("MOSAIQ TLC", -1, 10, 110, 50, $BS_DEFPUSHBUTTON, 0x0001)

GUISetFont (9)

GUISetState() ; will display an dialog box with 2 button

; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button_1

Run("\\Svrmosaiq2\mosaiq_app\ACCWIN.exe = /INST_ID=1") ; Will Run/Open Notepad

ExitLoop

Case $msg = $Button_2

Run("\\Svrmosaiq2\mosaiq_app\ACCWIN.exe = /INST_ID=2") ; Will demonstrate Button 2 being pressed

ExitLoop

Case $msg = $Button_3

Run("\\Svrmosaiq2\mosaiq_app\ACCWIN.exe = /INST_ID=3") ; Will demonstrate Button 2 being pressed

ExitLoop

Case $msg = $Button_4

Run("\\Svrmosaiq2\mosaiq_app\ACCWIN.exe = /INST_ID=4")

ExitLoop

Case $msg = $Button_5

Run("\\Svrmosaiq2\mosaiq_app\ACCWIN.exe = /INST_ID=5")

ExitLoop

EndSelect

WEnd

EndFunc ;==>Example

Link to comment
Share on other sites

GUISetFont

--------------------------------------------------------------------------------

Sets the default font for a GUI window.

GUICtrlSetFont

--------------------------------------------------------------------------------

Sets the font for a control.

I hope this helps.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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
 Share

  • Recently Browsing   0 members

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