Extended Message Box - New Version: 30 Mar 15

171 posts in this topic




Posted

Wow!!! Outstanding stuff. Marvellous work, Melba...

You, Sir, are top notch:graduated:

MariusN likes this

Share this post


Link to post
Share on other sites

Posted

GREAT JOB!

I love your work.

while playing with your example I found that line 140 should read ConsoleWrite("Test 6 returned: " & $iRetValue & @CRLF)

not ConsoleWrite("Test 5 returned: " & $iRetValue & @CRLF)

Guess the old copy/paste bug got you. :D

It is nice to download an example and have it go right off the bat. Keep them coming.

REB

Share this post


Link to post
Share on other sites

Posted

Thanks, great work :-)

Share this post


Link to post
Share on other sites

Posted

Great Job Melba23 It works Cool.

Thank you very-very much.

Share this post


Link to post
Share on other sites

Posted

Great Job Melba23 It works Cool.

Thank you very-very much.

btw, the forum has an inbuilt way to post members: Melba23

Share this post


Link to post
Share on other sites

Posted (edited)

Hi to all again.

Just wondering about:

If i use standart msgbox of Autoit with flag 64 and when it appears i hear "ding" sound.

But when i use _ExtMsgBox() and when it appears i didn`t hear somethink like that sound which i say at bottom(i assume "ding" sound)

So my question: Is here any other ways to do it somethink like which i mean?

I use this way to figure it out:

_ExtMsgBox (64 , "Beli|Xeyr|LEGV", "title", $sTestMsg,5)

No success:( Only icon changed in MSGBOX and it still silent:(

Any hints would be super as always.

Thanks in advance.

Edited by Sh3llC043r

Share this post


Link to post
Share on other sites

Posted

Sh3llC043r,

If you want a sound as the ExtMsgBox appears, just add this line into the UDF after the GUI is shown:

; Show GUI
GUISetState(@SW_SHOW, $hMsgGUI)

; Play sound
Soundplay(@WindowsDir & "\Media\Windows Exclamation.wav", 1)

From what I can see from my system, the sound should normally only be heard for alert, rather than information or query, message boxes. If you want to match that then you need to use this line:

If $iIcon_Style = -2 Or $iIcon_Style = -4 Then Soundplay(@WindowsDir & "\Media\Windows Exclamation.wav", 1)

Happy listening! :D

M23

iFFgen likes this

Share this post


Link to post
Share on other sites

Posted

Yes

Melba23 you solve it.Thank you very much.

Only one problem in this method is if user OS == from my (which i wrote in eg. my script) it may cause problems.

BTW i can use Fileinstall() for Windows Exclamation.wav(renamed in ex:sound64.wav) and use it.

You solve my problem THANK YOU VERY-VERY MUCH. You are amazing:huggles:

Share this post


Link to post
Share on other sites

Posted (edited)

Are you annoyed by the limitations of the standard Windows message dialog created by MsgBox?

Would you like to have coloured backgrounds and text? To choose the justification and font?

Do you want to be able to place the message box other than in the centre of the screen? Centred on your GUI, for example, or at a particular location on screen?

What about having user-defined text on up to 6 buttons? And user-defined icons?

Finally, would you like to choose whether the message box has a button on your already too-crowded taskbar?

If the answer to any of these questions is "YES" then the ExtMsgBox UDF is for you! :blink:

<snip code out>

Once again, I realise nearly all of the DLL calls in these UDFs could be made by using commands in other UDFs like WinAPI.au3 - but as with my Toast UDF (which you can find here) I am trying to prevent the need for any other include files to prevent bloat. If anyone wants the "pretty" versions, just let me know!

As always, courteous comments and constructive criticisms welcome - guess which I prefer! :P

All files above in zip format:

M23

Edit: Minor code change to example script - see 2 posts below. ;)

You might want to update the files that you uploaded in the .zip file. I ran this example script with the 2 #include files contained in the archive and I was getting errors all over the place. When I copied the text from the post rather than downloading it, it worked great. Also, this script requires another function you posted called GetDefaultFont.au3 which isn't shown or included here. I found it by searching for the function name on the forums here and I found it here. Edited by BrewManNH

Share this post


Link to post
Share on other sites

Posted

BrewManNH,

Apologies for that - not quite sure what happened there, the zip had an older version of the UDF in it. :blink: New zip files uploaded.

I hope you liked the UDF after all that! ;)

M23

Share this post


Link to post
Share on other sites

Posted

BrewManNH,

Apologies for that - not quite sure what happened there, the zip had an older version of the UDF in it. :blink: New zip files uploaded.

I hope you liked the UDF after all that! :P

M23

No worries, once I figured out what had happened, it all came together and worked great, I will definitely be including this in place of the standard message box when I need to make an impact. Thank you for your work on this. I hope to be able to be able to figure out this language one day. ;)

Share this post


Link to post
Share on other sites

Posted

BrewManNH,

Glad you like it. :blink:

By the way, when you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. ;)

M23

Share this post


Link to post
Share on other sites

Posted

Thanks Melba - As always, Great work - as always

I hate to say this, but isn't it just a GUI not a Msgbox, what was the point of going to all that trouble when you can use predifined GUI's?

But nevertheless, I'm not slaging you off, because I probably will use it some time!

Share this post


Link to post
Share on other sites

Posted

...but isn't it just a GUI not a Msgbox...

Not quite, a GUI is a window. A MsgBox is a predifined GUI with some few options whereas _ExtMsgBox is a predifined GUI with some more options. Utilizing MsgBox a lot you'll soon reach a point where this or that could be done better / different. At that point you'll either code your own GUI... or remember this UDF with a higher degree of freedom :blink:...

Share this post


Link to post
Share on other sites

Posted

KaFu,

Thank you for that. You were very polite....... :blink:

DjATUit,

As KaFu has pointed out, there are a few more user definable options available with this UDF - read the list at the top of the thread to see why you might want to use it in place of a normal MsgBox. ;)

But if you feel you must use a standard MsgBox, you might like to look at SmOke_N's MsgBoxUDF here. :P

M23

Share this post


Link to post
Share on other sites

Posted

Thanks for explaining - I just wasn't sure!

It's not that I don't like the script/idea, it's just I coudn't see the fact that you could replace about 5 lines with 1!

Thanks

Share this post


Link to post
Share on other sites

Posted (edited)

I liked the Extended Message Box idea so much that I have added it to the scripts I write now instead of the default message box. I even came up with an interesting addition to it for my own use. I am just learning the AutoIt scripting language, and wanted to try something out using your message box as a base. I added an additional parameter to the function call which I called $Random, what this does is when the user puts any non-zero number in the parameter the ext. msg box function will now change the background color to a random color every ($Random * 1000) milliseconds. I was writing a script that has a message box pop up after copying files to tell the user that it finished, and I wanted to make it have a little more impact and be more noticeable so I threw this twist to your script together.

You call the function with this line.

	_ExtMsgBox($Icon, $Button, $Title, $Text, $Timeout, $Pos, $Vpos,$Random) ; Where $Random is any positive number and it causes a delay of this many seconds

Change line 188 to this:

Func _ExtMsgBox($iIcon, $iButton, $sTitle, $sText, $iTimeout = 0, $hWin = "", $iVPos = 0, $Random = 0)

And this is added to the _ExtMsgBox function itself starting at line 406

$Timer = TimerInit()
While 1
	$Delay = TimerDiff($Timer)
	If $Random > 0 Then
		$DelayTime = ($Random * 1000) ; Multiply $Random times 1000 for a delay in milliseconds
		If $Delay > $DelayTime Then
			GUISetBkColor(Random(1, 32365, 1))
			$Timer = TimerInit()
		EndIf
	EndIf

I'm not sure if anyone else would have a use for this but I thought it was a cool change. :blink:

Edited by BrewManNH

Share this post


Link to post
Share on other sites

Posted

BrewManNH,

A nice modification. :blink:

I hope to be able to be able to figure out this language one day

You are well on your way! ;)

M23

Share this post


Link to post
Share on other sites

Posted

I have found an issue with this UDF, which is probably caused by the StringSize.au3 UDF that it calls, but I'm not sure of that part. What I have found, and something other users should be aware of, is in my media player I started to incorporate the EMB UDF to make the messages displayed a little more unique. What I found is that after calling an ExtMsgBox function, my media player's controls were getting all messed up. My timer, progress bar, and volume control indicator wouldn't update after. My help menu message boxes were getting the Timer text updates instead of their usual text.

I believe it is because StringSize, or the EMB is creating ControlIDs that are causing the media player's control IDs to get changed, so I'm updating the wrong controls after calling this function. I have gotten around the problem by only using it when the playlist is empty, so nothing will be playing afterward, or when I'm exiting the script.

I still find this UDF to be a great addition to my toolbox, but there are limitations to using it that I thought others should be aware of.

Share this post


Link to post
Share on other sites

Posted

I believe it is because StringSize, or the EMB is creating ControlIDs that are causing the media player's control IDs to get changed, so I'm updating the wrong controls after calling this function.

Sorry, but that is complete garbage. ;)

AutoIt ControlIDs are internally organised by AutoIt so unless we are using exactly the same variable names in Global scope there is no way any UDF can change the ControlIDs within a script calling it.

The only Global constants and variable names in the release version of ExtMsgBox are:

; #GLOBAL CONSTANTS# =================================================================================================
Global Const $MB_IConstop   = 16 ; Stop-sign icon
Global Const $MB_ICONQUERY  = 32 ; Question-mark icon
Global Const $MB_ICONEXCLAM = 48 ; Exclamation-point icon
Global Const $MB_ICONINFO   = 64 ; Icon consisting of an 'i' in a circle

; #GLOBAL VARIABLES# =================================================================================================
Global $iDef_EMB_Font_Size = _GetDefaultEMBFont(0)
Global $sDef_EMB_Font_Name = _GetDefaultEMBFont(1)
Global $iEMB_Style = 0
Global $iEMB_Just = 0
Global $iEMB_BkCol = Default
Global $iEMB_Col   = Default
Global $sEMB_Font_Name = $sDef_EMB_Font_Name
Global $iEMB_Font_Size = $iDef_EMB_Font_Size

There are none at all in StringSize. All other variables are Local in scope.

So unless your media player controls store their ControlIDs in variables with exactly those names, there cannot be any interference. I use EMB all the time in my own media player (which includes timers, progress bars and volume controls) and have absolutely no problems at all. :)

I am happy to try and help you solve the problem you are having with your script, but it is certainly not what you are currently suggesting. ;)

M23

Share this post


Link to post
Share on other sites

Posted

I found out why it was doing this after I looked at the variables I was using to call the EMB function, and found that it wasn't the UDF that was messing it up, it was me using variable names in the calling routine that was doing it.

What I had done was to copy the _ExtMsgBox function routine from your UDF (_ExtMsgBox($iIcon, $iButton, $sTitle, $sText, $iTimeout = 0, $hWin = "", $iVPos = 0)) then used that as the method to call the function in my script because I wanted to make sure that I called it with the correct parameters in the correct places, totally forgetting that some of the variable names you used in your function were the same as some of the variable names I was using in my script. So of course it was screwing up my script because I wasn't paying attention as I should have when using it.

I feel pretty dumb at the moment, but I view it as a learning experience and hopefully won't make this same mistake in the future. ;)

I apologize for any misinformation that I posted about this excellent function because as I have said before, I really find it to be invaluable to have in my toolbox.

Share this post


Link to post
Share on other sites

Posted

BrewManNH,

No problem. Thanks for owning up and clearing my UDF. ;)

M23

Share this post


Link to post
Share on other sites

Posted

AWESOME UDF.

I'm trying the example right now and I can't figure out why the first msgBox (the one with 1 to 4 buttons) doesn't disable the parent GUI. I didn't change any code in the example script.

I'm using AutoIt version 3.3.6.1.

Share this post


Link to post
Share on other sites

Posted

leomoon,

why the first msgBox (the one with 1 to 4 buttons) doesn't disable the parent GUI

I thought it did! :(

You can certainly action the buttons on the parent "EMB Test" GUI but are you saying that they actually work while the "Test 1" EMB is displayed? If so I would like to know as they certainly do not work when I run the example. :graduated:

M23

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