Jump to content

How to make Toast - New version 2 Aug 18


Melba23
 Share

Recommended Posts

  • Moderators

Final instalment in this saga (I hope!).

In this version of the UDF you get the nice-looking "X in a box" if you have WingDings 2 installed or the "back of a bus WingDings" version if not.

; See first post

Sorry for all the confusion. I should have learned by now never to trust MS! :D

All previous posts adjusted.

M23

Edit: Clear up different versions - see first post for latest

Edited by Melba23

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

Final instalment in this saga (I hope!).

All previous posts adjusted.

M23

Famous last words.

Yes, I am very resistant to Bill Gates but not so much that I don't use Windows! My laptop didn't have WIngDings 2 so I installed it then saw that you had made my one-minute-old udf obsolete!

But I get

C:\Documents and Settings\Martin\Local Settings\Temp\Toast.au3 (245) : ==> Subscript used with non-Array variable.:

$sMessage = $aLabel_Pos[0]

Edited by martin
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.
Link to comment
Share on other sites

  • Moderators

martin,

I knew I should not have said that! :D

Your problem is actually the StringSize UDF not returning as it should. Could you please post the _Toast_Set and _Toast_Show lines that are giving you the problem and I will see what I can do to resolve it.

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

martin,

I knew I should not have said that! :D

Your problem is actually the StringSize UDF not returning as it should. Could you please post the _Toast_Set and _Toast_Show lines that are giving you the problem and I will see what I can do to resolve it.

M23

I simply copied the three scripts again ,toast.au3, stringsize.au3 and the example and the example wouldn't run. Do you mean it works for you?

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.
Link to comment
Share on other sites

  • Moderators

martin and UEZ,

Apologies.

I had already changed the UDF to show optional icons and I posted a amended version of that in the first post, completely forgetting to post the new example script at the same time. :D

First post should now work "out-of-the-box". <fingers crossed emoticon>! : It does for me!

M23

Note to self: do not edit big posts late at night. :huggles:

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

Good work Melba, I have already incorporated this UDF

into one my scripts. Thank you for sharing.

However, I have a problem: How do I get it to NOT wrap text?

I have text that is already pre-formatted, and I just want

it displayed in the toast. The StringSize function returns

the correct text, but the Toast_Show function somehow

wraps the second or third line, no matter how long the

text (see attached image).

Console Output:
StringSize Return: 
 Message From   : IBMX40
 Time Stamp : 13:18:03
 Category   : Sessionresume
 Message    : Total Pause Time 23 min 17 sec

The icon is sometimes not displayed.

post-35502-12639061354637_thumb.jpg

post-35502-12639062439289_thumb.jpg

Edited by dmob
Link to comment
Share on other sites

  • Moderators

dmob,

As I explained in the first post, a Toast has a maximum (and minimum) width setting. I did this to prevent the Toast taking up too much of the screen space when it appeared - I prefer a "boxy" appearance to a "long and flat" one. So even if you have pre-formatted text, the UDF will still try and fit it into the maximum width by wrapping as necessary. If you change the maximum width to a suitably high value, you should be able to display your text as you want it. The line to change is around line 209:

Local $iToast_Width_max = 500

I am not going to modify the UDF to make this value user-definable - there are quite enough options as it is! : But feel free to modify it for your own use if you wish.

A tip: if you run your pre-formatted text through StringSize without specifying a max width, the [2] element of the array returned is the width of the text as it stands without wrapping. Add 20 to that value and you have the maximum size of Toast you would need to use (add another 50 if you want an icon as well). :huggles:

Can you post your _Toast_Show lines which do not display an icon? If you are referring to the example - there are some Toasts there which do not have icons (it is optional you know! :D ).

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

Thanks for your prompt reply (don't you sleep? it's day time

here in SA) I was still editing my first post, got distracted,

and I submitted not realising you had already replied.

I shall try your suggestions.

Thank you for sharing your brilliant code. I was busy coding

something similar, but yours is much more elegant and professional.

Link to comment
Share on other sites

  • Moderators

dmob,

It is day time here in the UK too. And I slept very well last night thanks! :D

elegant and professional

I might even begin to forgive you for winning the final Test if you carry on like that! :huggles:

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

  • Moderators

corgano,

Can you not copy the 3 scripts from the first post and zip them yourself?

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

corgano,

Can you not copy the 3 scripts from the first post and zip them yourself?

M23

Sorry for that, I was feeling especially lazy that day...

This UDF is good! It seems to work pretty well, but can you have 2 toasts at the same time?

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

  • Moderators

corgano,

can you have 2 toasts at the same time?

No. An existing Toast is retracted before a new one is shown. But 2 separate scripts can show Toasts at the same time.

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