Jump to content
Sign in to follow this  
deef99

Text or Background Color Change

Recommended Posts

deef99

Here is a script we currently use. Mgmt is now wanting the text and/or background to change color instead of the Font changing size.

Is there a way to do this?

#include <Date.au3>
#include <File.au3>
#include "array.au3"
#include "String.au3"
#include <Sound.au3>
#include <Constants.au3>

Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown.
Opt("WinTitleMatchMode", 1) ;1=start
;HotKeySet("^z", "Terminate"); Press Ctrl z to terminate script
[indent=1]
While 9 = 9
Sleep(2000) ;answered during ringing...wait 6 seconds?
SplashTextOn("Talk Timer", "0 Secs", 80, 40, 1050, 9, -1, "Arial", 9, 400)
$BeginTime = TimerInit()
$CountTo = 600 ;stop at 10 minutes
$SecondsLapsed = 0
$message = ""
While $SecondsLapsed < $CountTo
$TimeDifference = TimerDiff($BeginTime)
$SecondsLapsed = Round($TimeDifference / 1000, 0)

If $SecondsLapsed >= 180 And $SecondsLapsed < 240 Then ;up to 3 minutes
SplashTextOn("Talk Timer", "", 120, 40, 1050, 9, -1, "Arial", 9, 500)
$message = "3 Minutes..."
ElseIf $SecondsLapsed >= 240 And $SecondsLapsed < 300 Then ;at 4 minutes
$message = "Over 4 Minutes..."
SplashTextOn("Talk Timer", "", 150, 40, 1050, 9, -1, "Arial", 10, 500)
ElseIf $SecondsLapsed >= 300 And $SecondsLapsed < 360 Then ;at 5 minutes
$message = "Over 5 Minutes..."
SplashTextOn("Talk Timer", "", 150, 40, 1050, 9, -1, "Arial", 11, 600)
ElseIf $SecondsLapsed >= 360 And $SecondsLapsed < 420 Then ;at 6 minutes
$message = "Over 6 Minutes..."
SplashTextOn("Talk Timer", "", 170, 40, 1050, 9, -1, "Arial", 12, 700)
ElseIf $SecondsLapsed >= 420 And $SecondsLapsed < 480 Then ;at 7 minutes
$message = "Over 7 Minutes now..."
SplashTextOn("Talk Timer", "", 190, 40, 1050, 9, -1, "Arial", 12, 800)
ElseIf $SecondsLapsed >= 480 And $SecondsLapsed < 540 Then
$message = "Call is over 8 Minutes!"
SplashTextOn("Talk Timer", "", 210, 40, 1050, 9, -1, "Arial", 12, 800)
ElseIf $SecondsLapsed > 540 Then
$message = "Over 9 Minutes Now!"
SplashTextOn("Talk Timer", "", 220, 40, 1050, 9, -1, "Arial", 14, 800)
EndIf
If $SecondsLapsed <= 180 Then
ControlSetText("Talk Timer", "", "Static1", $message & $SecondsLapsed & " Secs")
Else
ControlSetText("Talk Timer", "", "Static1", $message)
EndIf
Sleep(1000)
WEnd
WEnd

Share this post


Link to post
Share on other sites
BrewManNH

You'd probably have an easier time with it using your own GUI with a label instead of using the SplashText control function. You could even use the function in my signature and update the label information as it runs. The progressbar would also be a visual indicator as to how long the time has been running.

The link is to the Customizable GUI with progress bar.


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

Share this post


Link to post
Share on other sites
deef99

BrewManNH,

Thank you for your quick response. I have taken the code for Customizable Splashscren w/ProgresssBar and saved it in Include folder.

Not 100% certain how to proceed, as I was hoping to just modify the existing code, but I'll review and see how I can make this work.

Thanks again!

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  

×