Jump to content

Countdown timer msgbox with custom fonts


Recommended Posts

I've been searching and search to find the most appropriate UDFs for what I'm trying to do; but, unfortunately, I just haven't been on the forum long enough to know what's best for me.

The best way to describe what I want is to get as close as I can get to it as possible on my own below.

The problem is the message box depends on default WIndows fonts and respective sizes. So, if someone has custom fonts for their system message boxes, it could really screw up the way this message box looks. I am hoping someone can help me choose a UDF that allows there to be a countdown timer similar to the one below, yet, the fonts; and, possibly background are easily modifiable by me (background is secondary).

#include <_MsgBox.au3>
_MsgBox(4096, "MultiServer Mode", ""  & @CRLF & _
         "                      Starting UltraBlogger in MultiServer Mode..." & @CRLF & _
         "             Click Bypass button to start in Single Server mode"  , 5, 0, "Bypass")

I am hoping some friendly forum members might be able to help me reach my goal more easily.

Posted Image

Link to comment
Share on other sites

You could try Melba23's Extended Message Box, it allows you to create a custom sized message box and you can set the font/font size/color/background color of the message box.

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

Thank you. I'm a bit embarrassed to ask this; but, I honestly get any further that what I have below....

Could someone please tell me how to increase the width of the button so I can fit more characters? I was hoping it would automatically grow based on text length.

Lastly, Once, the button is clicked, I would like for the script to create a blank file located here: $localappdata & "switched.txt"

If the button isn't clicked, to try to delete that blank file if it exists.

Thanks so much in advance

#include "ExtMsgBox.au3"
_ExtMsgBoxSet(3, 0, 0x000073, 0xFF9C18, 10, "Arial Black")
$sMsg  = "UltraBlogger starting in MultiServer Mode...  " & @CRLF
$sMsg  &= "Click button to switch to Single Server mode    "
$iRetValue = _ExtMsgBox (128, "Switch...", "MultiServer Mode", $sMsg, 7)
ConsoleWrite("Test 6 returned: " & $iRetValue & @CRLF)
_ExtMsgBoxSet(Default)
Link to comment
Share on other sites

Edit: I thought I was able to figure this out on my own, but I'm going to need some help. Im trying to make the button bigger in my code; and, if the button is selected to create a blank text file.

I was able to find another piece of code that I thought might help me; but, unfortunately the code was a bit too different for me to integrate into mine.

My code:

$sMsg  = "UltraBlogger starting in MultiServer Mode...  " & @CRLF
$sMsg  &= "Click button to switch to Single Server mode    "
$iRetValue = _ExtMsgBox (128, "Switch...", "MultiServer Mode", $sMsg, 7)
ConsoleWrite("Mode switcher returned: " & $iRetValue & @CRLF)
_ExtMsgBoxSet(Default)

EDIT: My apologies, is it possible I asked this question in the wrong forum or thread? I was wondering if perhaps I should have asked for help in the extended message box thread.

Another piece of code I found. I wish this example included extended message box code.

#include <GUIConstantsEx.au3>
#include "ExtMsgBox.au3"
ModeSwitcher()
Func ModeSwitcher()
    Local $Button_1, $msg
    GUICreate("Mode Switch")
    Opt("GUICoordMode", 1)
    $Button_1 = GUICtrlCreateButton("Run Notepad", 10, 30, 200)
    GUISetState()
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
                Run('notepad.exe')
        EndSelect
    WEnd
EndFunc
Edited by MKANET
Link to comment
Share on other sites

I was able to take apart the example code provided with Extended Message Box. Unfortunately, the code that's used to make the buttons bigger are meant for the buttons created by Extended Message Box. I can't find code anywhere showing larger buttons for message boxes created within Extended Message Box. Is this something that only a standard GUI message windows can do? If so, maybe I need to create color GUI windows and custom fonts? Hopefully someone might be able to help me out. Thanks in advance!

Edited by MKANET
Link to comment
Share on other sites

  • Moderators

MKANET,

ExtMsgBox just creates a GUI using the parameters in the function call - button width is set automatically to fit within the GUI so it cannot deal with very long button text. But all you have to do is add the text you have in the button to the main body of the ExtMsgBox and then use a short text on the button as shown in "Test 6" of the example script. ;)

If that is not sufficient then I suggest that you use whatever code is useful from the UDF to create your own version. I am more than happy to help develop it, but I am not adapting the UDF to have expanding buttons for reasons I have explained at length in the UDF thread. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...