AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MsgBox function

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
kimbledon



Joined: 28 Sep 2007
Posts: 26

PostPosted: Sat Nov 03, 2007 1:11 pm    Post subject: MsgBox function Reply with quote

Test the code and you will notice the difference Surprised
The script should create 2 same msgboxes but my own function doesn't work.
Does someone know why? Smile

Code:

MsgBox("Hello!", "Some message", 4)
MsgBox, 4, Hello!, Some message


;   BUTTONS:
;0 = OK (default)
;1 = OK/CANCEL
;2 = Abort/Retry/Ignore
;3 = Yes/No/Cancel
;4 = Yes/No
;5 = Retry/Cancel
;   ICONS:
;0 = No Icon(default)
;1 = Hand (stop/error)
;2 = Question
;3 = Exclamation
;4 = Asterisk (info)
;   OPTIONS:
;4096 = System modal (OnTop)
;1048576 = Right-To-Left Text
;Look from AHK helpfile for more

MsgBox(title, message, button = 0, icon = 0, option = 0)
{
   if (button < 0 || button > 5)
      button = 0
   if (icon < 0 || icon > 4)
      icon = 0
   if (option <> 4096 && option <> 1048576)
      option = 0
   if (title = )
      title = %A_Space%
   if icon = 1
      icon = 16
   if icon = 2
      icon = 32
   if icon = 3
      icon = 48
   if icon = 4
      icon = 64
   msgboxoptions := button+icon+option
   MsgBox, %msgboxoptions%, %title%, %message%,
}


Thanks! Smile
Back to top
View user's profile Send private message
garry



Joined: 19 Apr 2005
Posts: 1186
Location: switzerland

PostPosted: Sat Nov 03, 2007 1:24 pm    Post subject: Reply with quote

hello kimbledon,
I didn't tested
here a nice script from thalon
http://www.autohotkey.com/forum/viewtopic.php?t=11659&highlight=messageboxcreator
Back to top
View user's profile Send private message
RGF
Guest





PostPosted: Sat Nov 03, 2007 1:28 pm    Post subject: Re: MsgBox function Reply with quote

Help file wrote:
This parameter (msgbox's options) will not be recognized if it contains an expression or a variable reference such as %option%. Instead, use a literal numeric value.
Back to top
kimbledon



Joined: 28 Sep 2007
Posts: 26

PostPosted: Sat Nov 03, 2007 1:32 pm    Post subject: Reply with quote

Thanks for your fast replies!

garry:
Thanks for the script, it's great but I would need to create msgbox
without creating another .ahk file and running it


RGF:
I didn't see that in the help file Very Happy




Maybe I should use the dllcall
Back to top
View user's profile Send private message
kimbledon



Joined: 28 Sep 2007
Posts: 26

PostPosted: Sat Nov 03, 2007 1:38 pm    Post subject: Reply with quote

I just replaced the built-in msgbox command in the function with this:

Code:

DllCall("MessageBox", "int", "0", "str", message, "str", title , "int", msgboxoptions)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group