Jump to content



Photo

Rename MsgBox() Buttons


  • Please log in to reply
10 replies to this topic

#1 SmOke_N

SmOke_N

    It's not what you know ... It's what you can prove!

  • Moderators
  • 15,729 posts

Posted 10 June 2006 - 09:22 PM

This was made because of a question in the Support Forum, it renames the MsgBox() buttons to what you want them to be... I'm not setting up any instructions, it's pretty straight forward.
AutoIt         
;=============================================================================== ; ;~ Function:        _MsgBoxChangeButtons() ;~ Desctiption      Changes the button text of a MsgBox() ;~ Version:     N/A ;~ Author:      SmOke_N ;~ Parameter(s):        ;~          $iMBFlag = Icon and or Flags (Type of buttons) ;~          $MBTitle = Title of MsgBox() ;~          $MBText = Text for the Body of the MsgBox() ;~          $MBButton1 = Text to change the first button ;~          $MBButton2 = Optional Param:  Text to change the second Button if applicable ;~          $MBButton3 = Optional Param:  Text to change the third Button if applicable ;~          $iMBTimeOut = Optional Param:  MsgBox() Time out ;~ Requirement(s):  AutoIt Beta 3.1xx ;~ Example: ;~          _MsgBoxChangeButtons(36, 'My Title', 'My Text', 'Button 1', 'Button 2', '', 3) ;~ Example Result:  Will turn out a MsgBox() instead of Yes and No button will be Button 1 and Button 2 with a time out of 3 seconds ;~ Return Value(s): Will return the value that was clicked in the MsgBox() ; ;===============================================================================ƒo݊÷ Ø&¥–Ú-…å«­¢+ÙÕ¹Œ}5͝  ½á ¡…¹•  ÕÑѽ¹Ì ˜ŒÀÌØí¥5    ±…œ°€˜ŒÀÌØí5    Q¥Ñ±”°€˜ŒÀÌØí5  Q•áа€˜ŒÀÌØí5        ÕÑѽ¸Ä°€˜ŒÀÌØí5       ÕÑѽ¸È€ô€˜ŒÌä옌Ìä찀˜ŒÀÌØí5     ÕÑѽ¸Ì€ô€˜ŒÌä옌Ìä찀˜ŒÀÌØí¥5   Q¥µ•=ÕЀô€À¤(€€€1½…°€˜ŒÀÌØí5 ¥±”€ô¥±•=Á•¸¡Q•µÁ¥È€™…µÀ쀘ŒÌä옌ÀäÈí5¥Í5  ¹ÑáИŒÌä찀Ȥ(€€€1½…°€˜ŒÀÌØí5    1¥¹”Ä€ô€˜ŒÌäí=ÁÐ ™ÅÕ½Ðí]¥¹]…¥Ñ•±…ä™ÅÕ½Ð찀À¤˜ŒÌäì(€€€1½…°€˜ŒÀÌØí5 1¥¹”È€ô€˜ŒÌäí]¥¹]…¥Ð ™ÅÕ½Ð옌Ìä쀙…µÀ쀘ŒÀÌØí5 Q¥Ñ±”€™…µÀ쀘ŒÌäì™ÅÕ½Ð줘ŒÌäì(€€€1½…°€˜ŒÀÌØí5  1¥¹”Ì€ô€˜ŒÌäí ½¹Ñɽ±M•ÑQ•áÐ ™ÅÕ½Ð옌Ìä쀙…µÀ쀘ŒÀÌØí5  Q¥Ñ±”€™…µÀ쀘ŒÌäì™ÅÕ½Ð찀™ÅÕ½Ðì™ÅÕ½Ð찀™ÅÕ½Ðí   ÕÑѽ¸Ä™ÅÕ½Ð찀™ÅÕ½Ð옌Ìä쀙…µÀ쀘ŒÀÌØí5       ÕÑѽ¸Ä€™…µÀ쀘ŒÌäì™ÅÕ½Ð줘ŒÌäì(€€€1½…°€˜ŒÀÌØí5   1¥¹”Ѐô€˜ŒÌäí ½¹Ñɽ±M•ÑQ•áÐ ™ÅÕ½Ð옌Ìä쀙…µÀ쀘ŒÀÌØí5  Q¥Ñ±”€™…µÀ쀘ŒÌäì™ÅÕ½Ð찀™ÅÕ½Ðì™ÅÕ½Ð찀™ÅÕ½Ðí   ÕÑѽ¸È™ÅÕ½Ð찀™ÅÕ½Ð옌Ìä쀙…µÀ쀘ŒÀÌØí5       ÕÑѽ¸È€™…µÀ쀘ŒÌäì™ÅÕ½Ð줘ŒÌäì(€€€1½…°€˜ŒÀÌØí5   1¥¹”Ô€ô€˜ŒÌäí ½¹Ñɽ±M•ÑQ•áÐ ™ÅÕ½Ð옌Ìä쀙…µÀ쀘ŒÀÌØí5  Q¥Ñ±”€™…µÀ쀘ŒÌäì™ÅÕ½Ð찀™ÅÕ½Ðì™ÅÕ½Ð찀™ÅÕ½Ðí   ÕÑѽ¸Ì™ÅÕ½Ð찀™ÅÕ½Ð옌Ìä쀙…µÀ쀘ŒÀÌØí5       ÕÑѽ¸Ì€™…µÀ쀘ŒÌäì™ÅÕ½Ð줘ŒÌäì(€€€%˜€˜ŒÀÌØí5     ÕÑѽ¸È€ô€˜ŒÌä옌ÌäìQ¡•¸(€€€€€€€¥±•]ɥє¡Q•µÁ¥È€™…µÀ쀘ŒÌä옌ÀäÈí5¥Í5 ¹ÑáИŒÌä찀˜ŒÀÌØí5    1¥¹”Ä€™…µÀì I1€™…µÀ쀘ŒÀÌØí5  1¥¹”È€™…µÀì I1€™…µÀ쀘ŒÀÌØí5  1¥¹”̤(€€€±Í•%˜€˜ŒÀÌØí5       ÕÑѽ¸È€™±Ð왝Ð쀘ŒÌä옌Ìä쁹€˜ŒÀÌØí5      ÕÑѽ¸Ì€ô€˜ŒÌä옌ÌäìQ¡•¸(€€€€€€€¥±•]ɥє¡Q•µÁ¥È€™…µÀ쀘ŒÌä옌ÀäÈí5¥Í5 ¹ÑáИŒÌä찀˜ŒÀÌØí5    1¥¹”Ä€™…µÀì I1€™…µÀ쀘ŒÀÌØí5  1¥¹”È€™…µÀì|(€€€€€€€€€€€ I1€™…µÀ쀘ŒÀÌØí5  1¥¹”Ì€™…µÀì I1€™…µÀ쀘ŒÀÌØí5  1¥¹”Ф(€€€±Í•%˜€˜ŒÀÌØí5       ÕÑѽ¸È€™±Ð왝Ð쀘ŒÌä옌Ìä쁹€˜ŒÀÌØí5      ÕÑѽ¸Ì€™±Ð왝Ð쀘ŒÌä옌ÌäìQ¡•¸(€€€€€€€¥±•]ɥє¡Q•µÁ¥È€™…µÀ쀘ŒÌä옌ÀäÈí5¥Í5   ¹ÑáИŒÌä찀˜ŒÀÌØí5    1¥¹”Ä€™…µÀì I1€™…µÀ쀘ŒÀÌØí5  1¥¹”È€™…µÀì I1€™…µÀì|(€€€€€€€€€€€€˜ŒÀÌØí5    1¥¹”Ì€™…µÀì I1€™…µÀ쀘ŒÀÌØí5  1¥¹”Ѐ™…µÀì I1€™…µÀ쀘ŒÀÌØí5  1¥¹”Ô¤(€€€¹‘%˜(€€€€˜ŒÀÌØí5  A%ĀôIÕ¸¡Õѽ%Ñᔀ™…µÀ쀘ŒÌä쀽Õѽ%ÐÍᕍÕѕMÉ¥ÁЀ˜ŒÌä쀙…µÀ쁹ٕР˜ŒÌäíQ5@˜ŒÌä준™…µÀ쀘ŒÌä옌ÀäÈí5¥Í5   ¹ÑáИŒÌäì¤(€€€€˜ŒÀÌØí5     ½à€ô5͝ ½à ˜ŒÀÌØí¥5    ±…œ°€˜ŒÀÌØí5    Q¥Ñ±”°€˜ŒÀÌØí5  Q•áа€˜ŒÀÌØí¥5  Q¥µ•=ÕФ(€€€¥±• ±½Í” ˜ŒÀÌØí5  ¥±”¤(€€€¼(€€€€€€€¥±••±•Ñ”¡Q•µÁ¥È€™…µÀ쀘ŒÌä옌ÀäÈí5¥Í5 ¹ÑáИŒÌäì¤(€€€U¹Ñ¥°9½Ð¥±•á¥ÍÑÌ¡Q•µÁ¥È€™…µÀ쀘ŒÌä옌ÀäÈí5¥Í5   ¹ÑáИŒÌäì¤(€€€I•ÑÕɸ€˜ŒÀÌØí5        ½à)¹‘Õ¹Œ


Edit:
Provided a UDF break down.

Edit2:
Added herewasplatos suggestion of Opt('WinWaitDelay', 0) rather than While Not WinExists().

Edited by SmOke_N, 11 June 2006 - 06:21 PM.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.








#2 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,729 posts

Posted 11 June 2006 - 11:51 AM

HI,

nice work. :D

But, isn't there any easier way doing that? :D

Looks as pretty much to do.

Thanks!

So long,

Mega

Edited by th.meger, 11 June 2006 - 11:58 AM.

Scripts & functions Organize Includes Let Scite organize the include files *newYahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication)_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

#3 gamerman2360

gamerman2360

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 505 posts

Posted 11 June 2006 - 11:54 AM

You mean like some way of not having to use the temp file? I wish there was an autoit Obj you could just .document.write to.

#4 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,729 posts

Posted 11 June 2006 - 11:59 AM

You mean like some way of not having to use the temp file? I wish there was an autoit Obj you could just .document.write to.


Yeah, exactly. Any C++ guru in here? Maybe it can be done in some code lines. :D

So long,

Mega
Scripts & functions Organize Includes Let Scite organize the include files *newYahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication)_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

#5 gamerman2360

gamerman2360

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 505 posts

Posted 11 June 2006 - 12:29 PM

Hmm... Scripting autoit with an autoit script.. Is there an echo in here?

#6 RazerM

RazerM

    cowinkeedenky - coincidence?

  • Active Members
  • PipPipPipPipPipPip
  • 1,246 posts

Posted 11 June 2006 - 01:52 PM

This could come in useful! Well done.
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

#7 herewasplato

herewasplato

    Most Senile Poster

  • Active Members
  • PipPipPipPipPipPip
  • 4,426 posts

Posted 11 June 2006 - 03:52 PM

Good job SmOke_N.

I've pointed to this thread from "the other one" where we played with the MsgBox:
http://www.autoitscript.com/forum/index.ph...showtopic=22531

One note - this code:
    Local $MBLine1 = 'While Not WinExists("' & $MBTitle & '")'     Local $MBLine2 = '    Sleep(10)'     Local $MBLine3 = 'WEnd'
...could be an OPT line to reduce the winwaitdelay to 1 or 0 and then a winwait line. You might gain a few milliseconds in response time and lose one line of temp code.

Just a thought.
..

#8 Rick

Rick

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 328 posts

Posted 11 June 2006 - 05:45 PM

Love this script and added another parameter to it "$iMBIcon" taken from another script on this forum tho cant remember who.

It gives the abilty to hide the taskbar icon of the messagebox, the drawback being any wait time specified will be ignored.

Rick

Edit: added optional move messagebox option

Attached Files


Edited by Rick, 13 June 2006 - 06:51 AM.

Who needs puzzles when we have AutoIt!!

#9 SmOke_N

SmOke_N

    It's not what you know ... It's what you can prove!

  • Moderators
  • 15,729 posts

Posted 11 June 2006 - 06:22 PM

Thanks for the suggestions, I added herewasplato's idea to this one, and will re-do the MoveMsgBox() UDF alteration I made with the same idea.

@Rick, that would throw things off as nice as it would be to add. I haven't figured out how to add a timer myself, but if someone knows how, I'll add that option in, but I can't have a potentially dead parameter if you know what I mean. Thanks for idea :D .

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.


#10 Rick

Rick

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 328 posts

Posted 11 June 2006 - 06:53 PM

I disagree as any unused parameter is a potentially dead one, and the more options the better surely?
Still, good luck with making it better.

Edited by Rick, 11 June 2006 - 06:54 PM.

Who needs puzzles when we have AutoIt!!

#11 SmOke_N

SmOke_N

    It's not what you know ... It's what you can prove!

  • Moderators
  • 15,729 posts

Posted 11 June 2006 - 07:01 PM

I disagree as any unused parameter is a potentially dead one, and the more options the better surely?
Still, good luck with making it better.

I meant, if the user of the UDF puts a timeout and still wants to hide the icon, then it won't do the timeout, therefore rendering the timeout a dead parameter for that call.

As I said, I like the idea, but I would like to know how to do the timeout with the DLL call, without having to do "another" /AutoIt3ExecuteScript with TimerInit()/TimerDiff() (Which as you can see from some of my other posts is not past me anyway).

Maybe one of the Devs can show us how they used the timeout parameter when they made the MsgBox() function.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users