AutoHotkey Community

It is currently May 27th, 2012, 9:56 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: January 9th, 2007, 7:21 am 
Offline

Joined: July 15th, 2006, 7:36 pm
Posts: 31
Could someone put this in the catalog of all scripts. It's handy as a shirt on a pocket!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 9th, 2007, 8:22 am 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
It is handy to have a shirt in your pocket sometimes.They're just so easy to misplace! :lol:

Yes, I know what you meant.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 9th, 2007, 10:28 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
There were anterior similar programs. For example, I updated a script by oldbug and in this topic, Titan points to his own.
My version has less options that Thalon's one (limited to options documented in the AHK manual) but is slightly more compact.
As I often write, it is good to have choice... :-)

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 9th, 2007, 12:51 pm 
Offline

Joined: July 12th, 2005, 1:21 pm
Posts: 633
PhiLho wrote:
My version has less options that Thalon's one (limited to options documented in the AHK manual) but is slightly more compact.
As I often write, it is good to have choice... :-)
Hmm? All my options are documented in the AHK manual, but I've updated it after the new options were added...
I do not matter with it's size, because I normally can only use one window at a time and the rest it is in tray :)
Dual-monitor does help too 8)
And yes! It is always good to have the choice :D

Thalon

_________________
AHK-Icon-Changer
AHK-IRC
deutsches Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 9th, 2007, 2:35 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Thalon wrote:
Hmm? All my options are documented in the AHK manual, but I've updated it after the new options were added...
:!: I totally missed this update of the manual! :-) So it is "limited to options documented in the AHK manual of a year ago"... ;-)
Of course, size of GUI doesn't matter, even more as it is (for me) a run and close program.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 9th, 2007, 3:30 pm 
Offline

Joined: April 28th, 2004, 1:12 pm
Posts: 349
userabuser wrote:
Could someone put this in the catalog of all scripts. It's handy as a shirt on a pocket!


Just about managed to squeeze it on under Autohotkey related tools
(I've reached the post length limit)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 9th, 2007, 4:23 pm 
Offline

Joined: July 15th, 2006, 7:36 pm
Posts: 31
Truth be told, I like philho's layout better. (Sorry Thalon) But for me, functionality always wins. Thus Thalon's is the one I use. :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 9th, 2007, 5:45 pm 
Offline

Joined: July 12th, 2005, 1:21 pm
Posts: 633
@userabuser
I'll forgive you :)
I'll try a new layout tomorrow...

This version has "allignment" removed, but looks maybe better:
Code:
;Tray-Menu
Menu, Tray, Add, Open, Open
Menu, Tray, Add, Reset Settings, Reset
Menu, Tray, Add, Close, GuiClose
Menu, Tray, Click, 1
Menu, Tray, Default, Open
Menu, Tray, NoStandard

;GUI
Gui, Add, Text, x10 y10 section, Title
Gui, Add, Edit, xs+0 ys+15 section w400 vTitle gCreate_Msgbox_Command,
Gui, Add, Text, xs+0 ys+25 section, Text:
Gui, Add, Edit, xs+0 ys+15 section r3 w400 vText gCreate_Msgbox_Command WantTab,

Gui, Add, Groupbox, x10 y130 h215 w190 section, Buttons
Gui, Add, Radio, xs+10 ys+20 section vButton_Selection1 Checked gCreate_Msgbox_Command, OK
Gui, Add, Radio, xs+0 ys+25 section vButton_Selection2 gCreate_Msgbox_Command, OK/Cancel
Gui, Add, Radio, xs+0 ys+25 section vButton_Selection3 gCreate_Msgbox_Command, Abort/Retry/Ignore
Gui, Add, Radio, xs+0 ys+25 section vButton_Selection4 gCreate_Msgbox_Command, Yes/No/Cancel
Gui, Add, Radio, xs+0 ys+25 section vButton_Selection5 gCreate_Msgbox_Command, Yes/No
Gui, Add, Radio, xs+0 ys+25 section vButton_Selection6 gCreate_Msgbox_Command, Retry/Cancel
Gui, Add, Radio, xs+0 ys+25 section vButton_Selection7 gCreate_Msgbox_Command, Cancel/Try Again/Continue
Gui, Add, Checkbox, xs+0 ys+25 vButton_Selection_Help gCreate_Msgbox_Command, Help button

Gui, Add, Groupbox, x220 y130 h215 w190 section, Icons
Gui, Add, Radio, xs+10 ys+25 section vIcon1 Checked gCreate_Msgbox_Command, No Icon
Gui, Add, Radio, xs+0 ys+40 vIcon2 gCreate_Msgbox_Command, Stop/Error
Gui, Add, Radio, xs+0 ys+80 vIcon3 gCreate_Msgbox_Command, Question
Gui, Add, Radio, xs+0 ys+120 vIcon4 gCreate_Msgbox_Command, Exclamation
Gui, Add, Radio, xs+0 ys+160 vIcon5 gCreate_Msgbox_Command, Info
Gui, Add, Picture, xs+90 ys-10 gSelect_NoIcon icon1, %A_WinDir%\system32\user32.dll
Gui, Add, Picture, xs+90 ys+30 gSelect_ErrorIcon icon4 , %A_WinDir%\system32\user32.dll
Gui, Add, Picture, xs+90 ys+70 gSelect_Question icon3 , %A_WinDir%\system32\user32.dll
Gui, Add, Picture, xs+90 ys+110 gSelect_Exclamation icon2, %A_WinDir%\system32\user32.dll
Gui, Add, Picture, xs+90 ys+150 gSelect_Info icon5 , %A_WinDir%\system32\user32.dll

Gui, Add, Groupbox, x10 y360 h140 w190 section, Modality
Gui, Add, Radio, xs+10 ys+20 section Checked vModality1 gCreate_Msgbox_Command, Normal
Gui, Add, Radio, xs+0 ys+25 section vModality2 gCreate_Msgbox_Command, Task Modal
Gui, Add, Radio, xs+0 ys+25 section vModality3 gCreate_Msgbox_Command, System Modal (always on top)
Gui, Add, Radio, xs+0 ys+25 section vModality4 gCreate_Msgbox_Command, Always on top
Gui, Add, Radio, xs+0 ys+25 section vModality5 gCreate_Msgbox_Command, Default desktop

Gui, Add, Groupbox, x220 y360 h45 w190 section, Default-Button
Gui, Add, Radio, xs+10 ys+20 section Checked vDefault1 gCreate_Msgbox_Command, 1st
Gui, Add, Radio, xs+70 ys+0 section vDefault2 gCreate_Msgbox_Command, 2nd
Gui, Add, Radio, xs+70 ys+0 section vDefault3 gCreate_Msgbox_Command, 3rd
/*
Gui, Add, Groupbox, x10 y510 h45 w190 section, Allignment
Gui, Add, Checkbox, xs+10 ys+20 vAllignment1 section gCreate_Msgbox_Command, Right-justified
Gui, Add, Checkbox, xs+100 ys+0 vAllignment2 gCreate_Msgbox_Command, Right-to-left
*/
Gui, Add, Groupbox, x220 y415 h45 w90 section, Timeout
Gui, Add, Edit, xs+10 ys+17 w70 vTimeout gCreate_Msgbox_Command
Gui, Add, UpDown, Range-1-2147483, -1

Gui, Add, Button, x320 y425 h30 w90 vTest gTest, &Test
Gui, Add, Button, x220 y470 h30 w90 Default gCopy_to_Clipboard, &Clipboard
Gui, Add, Button, x320 y470 h30 w90 gReset, &Reset

Gui, Show, , Create MessageBox
GoSub, Reset      ;Initalize GUI from Ini
return

Select_NoIcon:
GuiControl, , Icon1, 1
GoSub, Create_Msgbox_Command
return

Select_ErrorIcon:
GuiControl, , Icon2, 1
GoSub, Create_Msgbox_Command
return

Select_Question:
GuiControl, , Icon3, 1
GoSub, Create_Msgbox_Command
return

Select_Exclamation:
GuiControl, , Icon4, 1
GoSub, Create_Msgbox_Command
return

Select_Info:
GuiControl, , Icon5, 1
GoSub, Create_Msgbox_Command
return

Create_Msgbox_Command:
Gui, Submit, NoHide
;Get types of used buttons
Loop, 7
{
   if Button_Selection%A_Index% = 1
   {
      ButtonSelection := A_Index -1
      if Button_Selection_Help = 1
         ButtonSelection += 16384
      break
   }
}

;Get used Icon
Loop, 5
{
   if Icon%A_Index% = 1
   {
      if A_Index = 1
         Icon = 0
      else if A_Index = 2
         Icon = 16
      else if A_Index = 3
         Icon = 32
      else if A_Index = 4
         Icon = 48
      else if A_Index = 5
         Icon = 64
      break
   }
}

;Get Modality-State
Loop, 5
{
   if Modality%A_Index% = 1
   {
      if A_Index = 1
         Modality = 0
      else if A_Index = 2
         Modality = 8192
      else if A_Index = 3
         Modality = 4096
      else if A_Index = 4
         Modality = 262144
      else if A_Index = 5
         Modality = 131072
      break
   }
}

;Get Default-Button
Loop, 3
{
   if Default%A_Index% = 1
   {
      if A_Index = 1
         Default = 0
      else if A_Index = 2
         Default = 256
      else if A_Index = 3
         Default = 512
      break
   }
}

;Check Allignment
Allignment = 0
if Allignment1 = 1
   Allignment += 524288
if Allignment2 = 1
   Allignment += 1048576

Msgbox_Number := ButtonSelection + Icon + Modality + Default + Allignment   ;Generate type of messagebox

Escape_Characters(Title)
Escape_Characters(Text)

;Timeout "-1" = no timeout
if Timeout = -1
   Timeout =
else
{
   StringReplace, Timeout, Timeout, `,, .      ;Allows "," as decimal-point
   Timeout = , %Timeout%
}



;Create command and set it to Edit-Control
Msgbox_Command = msgbox, %Msgbox_Number%, %Title%, %Text%%Timeout%
GuiControl, , Msgbox_Command, %Msgbox_Command%
return


;Creates a Temp-File to show actual configuration
Test:
GoSub, Create_Msgbox_Command
GuiControl, Disable, Test
FileAppend, %Msgbox_Command%, MsgboxTemp.ahk
RunWait, MsgboxTemp.ahk
FileDelete, MsgboxTemp.ahk
GuiControl, Enable, Test
return


;Escapes Characters like ","
Escape_Characters(byref Var)
{
   StringReplace, Var, Var, `n, ``n, All      ;Translate line breaks in entered text
   StringReplace, Var, Var, `,, ```,, All      ;Escapes ","
   StringReplace, Var, Var, `;, ```;, All      ;Escapes ";"
}



Copy_to_Clipboard:
Clipboard = %Msgbox_Command%
IniRead, Reset_after_Clipboard, %A_ScriptDir%\Msgbox.ini, Clipboard, Reset after Clipboard, 0
if Reset_after_Clipboard = 1
   GoSub, Reset
return

GuiClose:
ExitApp

Open:
Gui, Show
return

Reset:
IfExist %A_ScriptDir%\Msgbox.ini
{
   IniRead, Title, %A_ScriptDir%\Msgbox.ini, Reset, Title, plk
   if Title = plk
      Title =
   IniRead, Text, %A_ScriptDir%\Msgbox.ini, Reset, Text, plk
   if Text = plk
      Text =   
   IniRead, Modality, %A_ScriptDir%\Msgbox.ini, Reset, Modality, 1
   IniRead, Icon, %A_ScriptDir%\Msgbox.ini, Reset, Icon, 1
   IniRead, Button_Selection, %A_ScriptDir%\Msgbox.ini, Reset, Button, 1
   IniRead, Button_Selection_Help, %A_ScriptDir%\Msgbox.ini, Reset, Help Button, 0
   IniRead, Default, %A_ScriptDir%\Msgbox.ini, Reset, Default Button, 1
   IniRead, Timeout, %A_ScriptDir%\Msgbox.ini, Reset, Timeout, -1
   IniRead, Allignment1, %A_ScriptDir%\Msgbox.ini, Reset, Allignment_Right, 0
   IniRead, Allignment2, %A_ScriptDir%\Msgbox.ini, Reset, Allignment_RtL, 0
}
else
{
   Title =
   Text =
   Modality = 1
   Icon = 1
   Button_Selection = 1
   Button_Selection_Help = 0
   Default = 1
   Timeout = -1
   Allignment1 = 0
   Allignment2 = 0
}

GuiControl, , Title, %Title%
GuiControl, , Text, %Text%
GuiControl, , Modality%Modality%, 1
GuiControl, , Icon%Icon%, 1
GuiControl, , Button_Selection%Button_Selection%, 1
GuiControl, , Button_Selection_Help, %Button_Selection_Help%
GuiControl, , Default%Default%, 1
GuiControl, , Timeout, %Timeout%
GuiControl, , Allignment1, %Allignment1%
GuiControl, , Allignment2, %Allignment2%
return

GuiSize:
if A_EventInfo = 1
   Gui, Show, Hide
return

I'll move it a bit around, maybe all fits and looks good ^^

_________________
AHK-Icon-Changer
AHK-IRC
deutsches Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 9th, 2007, 9:24 pm 
Offline

Joined: July 12th, 2005, 1:21 pm
Posts: 633
How about this solution?
Code:
see post below (code deleted here)

Thalon

_________________
AHK-Icon-Changer
AHK-IRC
deutsches Forum


Last edited by Thalon on January 10th, 2007, 10:50 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2007, 6:44 pm 
Offline

Joined: July 15th, 2006, 7:36 pm
Posts: 31
I may have to back up a little here.. Your original has top->down flow, which is much more functional.. And we "have" to have the results box,because that will help us see the code as it's typed. I can't believe I'm still "picking" at you.. Something like this??
Code:
;Tray-Menu
Menu, Tray, Add, Open, Open
Menu, Tray, Add, Reset Settings, Reset
Menu, Tray, Add, Close, GuiClose
Menu, Tray, Click, 1
Menu, Tray, Default, Open
Menu, Tray, NoStandard

;GUI
Gui, Add, Groupbox, x10 y10 w550 h125, Title && Text
Gui, Add, Text, xs+10 ys+20 section, Title:
Gui, Add, Edit, xs+30 ys-3 w500 vTitle gCreate_Msgbox_Command WantTab,
Gui, Add, Text, xs+0 ys+25 section, Text:
Gui, Add, Edit, xs+30 ys-3 r5 w500 vText gCreate_Msgbox_Command WantTab,

Gui, Add, Groupbox, x10 y145 h45 w550 section, Modality
Gui, Add, Radio, xs+10 ys+20 section Checked vModality1 gCreate_Msgbox_Command, Normal
Gui, Add, Radio, xs+70 ys+0 vModality2 gCreate_Msgbox_Command, Task Modal
Gui, Add, Radio, xs+160 ys+0 vModality3 gCreate_Msgbox_Command, System Modal
Gui, Add, Radio, xs+270 ys+0 section vModality4 gCreate_Msgbox_Command, Always on top
Gui, Add, Radio, xs+100 ys+0 section vModality5 gCreate_Msgbox_Command, Default desktop

Gui, Add, Groupbox, x10 y200 w550 h100 section, Icons
Gui, Add, Picture, xs+20 ys+20 gSelect_NoIcon section icon1, %A_WinDir%\system32\user32.dll
Gui, Add, Picture, xs+110 ys+0 gSelect_ErrorIcon icon4 , %A_WinDir%\system32\user32.dll
Gui, Add, Picture, xs+235 ys+0 gSelect_Question icon3 , %A_WinDir%\system32\user32.dll
Gui, Add, Radio, xs-10 ys+40 section vIcon1 Checked gCreate_Msgbox_Command, No Icon
Gui, Add, Radio, xs+100 ys+0 vIcon2 gCreate_Msgbox_Command, Stop/Error
Gui, Add, Radio, xs+225 ys+0 vIcon3 gCreate_Msgbox_Command, Question
Gui, Add, Radio, xs+325 ys+0 section vIcon4 gCreate_Msgbox_Command, Exclamation
Gui, Add, Radio, xs+125 ys+0 vIcon5 gCreate_Msgbox_Command, Info
Gui, Add, Picture, xs+30 ys-40 gSelect_Exclamation section icon2, %A_WinDir%\system32\user32.dll
Gui, Add, Picture, xs+100 ys+0 gSelect_Info icon5 , %A_WinDir%\system32\user32.dll

Gui, Add, Groupbox, x10 y310 h65 w550 section, Buttons
Gui, Add, Radio, xs+10 ys+20 vButton_Selection1 section Checked gCreate_Msgbox_Command, OK
Gui, Add, Radio, xs+115 ys+0 vButton_Selection2 gCreate_Msgbox_Command, OK/Cancel
Gui, Add, Radio, xs+210 ys+0 vButton_Selection3 gCreate_Msgbox_Command, Abort/Retry/Ignore
Gui, Add, Checkbox, xs+335 ys+0 vButton_Selection_Help gCreate_Msgbox_Command, Help button
Gui, Add, Radio, xs+0 ys+25 section vButton_Selection4 gCreate_Msgbox_Command, Yes/No/Cancel
Gui, Add, Radio, xs+115 ys+0 vButton_Selection5 gCreate_Msgbox_Command, Yes/No
Gui, Add, Radio, xs+210 ys+0 vButton_Selection6 gCreate_Msgbox_Command, Retry/Cancel
Gui, Add, Radio, xs+335 ys+0 section vButton_Selection7 gCreate_Msgbox_Command, Cancel/Try Again/Continue


Gui, Add, Groupbox, x10 y390 h45 w235 section, Default-Button
Gui, Add, Radio, xs+10 ys+20 section Checked vDefault1 gCreate_Msgbox_Command, First
Gui, Add, Radio, xs+80 ys+0 vDefault2 gCreate_Msgbox_Command, Second
Gui, Add, Radio, xs+160 ys+0 vDefault3 gCreate_Msgbox_Command, Third

Gui, Add, Groupbox, x250 y390 h45 w90 section, Timeout
Gui, Add, Edit, xs+10 ys+17 w70 vTimeout gCreate_Msgbox_Command
Gui, Add, UpDown, Range-1-2147483, -1

Gui, Add, Groupbox, x345 y390 w215 h45 section, Allignment
Gui, Add, Checkbox, xs+10 ys+20 vAllignment1 section gCreate_Msgbox_Command, Right-justified
Gui, Add, Checkbox, xs+100 ys+0 vAllignment2 gCreate_Msgbox_Command, Right-to-left

Gui, Add, Groupbox, x10 y445 w550 h105 section, Result
Gui, Add, Edit, xs+10 ys+20 w525 r3 vMsgbox_Command,
Gui, Add, Button, xs+20 ys+75 h20 w40 Default vTest gTest, Test
Gui, Add, Button, xs+120 ys+75 h20 w100 gCopy_to_Clipboard, Copy to Clipboard
Gui, Add, Button, xs+290 ys+75 h20 w40 gReset, Reset
Gui, Show, , Create MessageBox
GoSub, Reset      ;Initalize GUI from Ini
return

Select_NoIcon:
GuiControl, , Icon1, 1
GoSub, Create_Msgbox_Command
return

Select_ErrorIcon:
GuiControl, , Icon2, 1
GoSub, Create_Msgbox_Command
return

Select_Question:
GuiControl, , Icon3, 1
GoSub, Create_Msgbox_Command
return

Select_Exclamation:
GuiControl, , Icon4, 1
GoSub, Create_Msgbox_Command
return

Select_Info:
GuiControl, , Icon5, 1
GoSub, Create_Msgbox_Command
return

Create_Msgbox_Command:
Gui, Submit, NoHide
;Get types of used buttons
Loop, 7
{
   if Button_Selection%A_Index% = 1
   {
      ButtonSelection := A_Index -1
      if Button_Selection_Help = 1
         ButtonSelection += 16384
      break
   }
}

;Get used Icon
Loop, 5
{
   if Icon%A_Index% = 1
   {
      if A_Index = 1
         Icon = 0
      else if A_Index = 2
         Icon = 16
      else if A_Index = 3
         Icon = 32
      else if A_Index = 4
         Icon = 48
      else if A_Index = 5
         Icon = 64
      break
   }
}

;Get Modality-State
Loop, 5
{
   if Modality%A_Index% = 1
   {
      if A_Index = 1
         Modality = 0
      else if A_Index = 2
         Modality = 8192
      else if A_Index = 3
         Modality = 4096
      else if A_Index = 4
         Modality = 262144
      else if A_Index = 5
         Modality = 131072
      break
   }
}

;Get Default-Button
Loop, 3
{
   if Default%A_Index% = 1
   {
      if A_Index = 1
         Default = 0
      else if A_Index = 2
         Default = 256
      else if A_Index = 3
         Default = 512
      break
   }
}

;Check Allignment
Allignment = 0
if Allignment1 = 1
   Allignment += 524288
if Allignment2 = 1
   Allignment += 1048576

Msgbox_Number := ButtonSelection + Icon + Modality + Default + Allignment   ;Generate type of messagebox

Escape_Characters(Title)
Escape_Characters(Text)

;Timeout "-1" = no timeout
if Timeout = -1
   Timeout =
else
{
   StringReplace, Timeout, Timeout, `,, .      ;Allows "," as decimal-point
   Timeout = , %Timeout%
}



;Create command and set it to Edit-Control
Msgbox_Command = msgbox, %Msgbox_Number%, %Title%, %Text%%Timeout%
GuiControl, , Msgbox_Command, %Msgbox_Command%
return


;Creates a Temp-File to show actual configuration
Test:
GoSub, Create_Msgbox_Command
GuiControl, Disable, Test
FileAppend, %Msgbox_Command%, MsgboxTemp.ahk
RunWait, MsgboxTemp.ahk
FileDelete, MsgboxTemp.ahk
GuiControl, Enable, Test
return


;Escapes Characters like ","
Escape_Characters(byref Var)
{
   StringReplace, Var, Var, `n, ``n, All      ;Translate line breaks in entered text
   StringReplace, Var, Var, `,, ```,, All      ;Escapes ","
   StringReplace, Var, Var, `;, ```;, All      ;Escapes ";"
}



Copy_to_Clipboard:
Clipboard = %Msgbox_Command%
IniRead, Reset_after_Clipboard, %A_ScriptDir%\Msgbox.ini, Clipboard, Reset after Clipboard, 0
if Reset_after_Clipboard = 1
   GoSub, Reset
return

GuiClose:
ExitApp

Open:
Gui, Show
return

Reset:
IfExist %A_ScriptDir%\Msgbox.ini
{
   IniRead, Title, %A_ScriptDir%\Msgbox.ini, Reset, Title, plk
   if Title = plk
      Title =
   IniRead, Text, %A_ScriptDir%\Msgbox.ini, Reset, Text, plk
   if Text = plk
      Text =   
   IniRead, Modality, %A_ScriptDir%\Msgbox.ini, Reset, Modality, 1
   IniRead, Icon, %A_ScriptDir%\Msgbox.ini, Reset, Icon, 1
   IniRead, Button_Selection, %A_ScriptDir%\Msgbox.ini, Reset, Button, 1
   IniRead, Button_Selection_Help, %A_ScriptDir%\Msgbox.ini, Reset, Help Button, 0
   IniRead, Default, %A_ScriptDir%\Msgbox.ini, Reset, Default Button, 1
   IniRead, Timeout, %A_ScriptDir%\Msgbox.ini, Reset, Timeout, -1
   IniRead, Allignment1, %A_ScriptDir%\Msgbox.ini, Reset, Allignment_Right, 0
   IniRead, Allignment2, %A_ScriptDir%\Msgbox.ini, Reset, Allignment_RtL, 0
}
else
{
   Title =
   Text =
   Modality = 1
   Icon = 1
   Button_Selection = 1
   Button_Selection_Help = 0
   Default = 1
   Timeout = -1
   Allignment1 = 0
   Allignment2 = 0
}

GuiControl, , Title, %Title%
GuiControl, , Text, %Text%
GuiControl, , Modality%Modality%, 1
GuiControl, , Icon%Icon%, 1
GuiControl, , Button_Selection%Button_Selection%, 1
GuiControl, , Button_Selection_Help, %Button_Selection_Help%
GuiControl, , Default%Default%, 1
GuiControl, , Timeout, %Timeout%
GuiControl, , Allignment1, %Allignment1%
GuiControl, , Allignment2, %Allignment2%
return

GuiSize:
if A_EventInfo = 1
   Gui, Show, Hide
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2007, 10:49 pm 
Offline

Joined: July 12th, 2005, 1:21 pm
Posts: 633
So you can choose between
Code:
;Tray-Menu
Menu, Tray, Add, Open, Open
Menu, Tray, Add, Reset Settings, Reset
Menu, Tray, Add, Close, GuiClose
Menu, Tray, Click, 1
Menu, Tray, Default, Open
Menu, Tray, NoStandard

;GUI
Gui, Add, Groupbox, x10 y10 w510 h125, Title && Text
Gui, Add, Text, xs+10 ys+20 section, Title:
Gui, Add, Edit, xs+30 ys-3 w460 vTitle gCreate_Msgbox_Command WantTab,
Gui, Add, Text, xs+0 ys+25 section, Text:
Gui, Add, Edit, xs+30 ys-3 r5 w460 vText gCreate_Msgbox_Command WantTab,

Gui, Add, Groupbox, x10 y145 h45 w510 section, Modality
Gui, Add, Radio, xs+10 ys+20 section Checked vModality1 gCreate_Msgbox_Command, Normal
Gui, Add, Radio, xs+70 ys+0 vModality2 gCreate_Msgbox_Command, Task Modal
Gui, Add, Radio, xs+160 ys+0 vModality3 gCreate_Msgbox_Command, System Modal
Gui, Add, Radio, xs+270 ys+0 section vModality4 gCreate_Msgbox_Command, Always on top
Gui, Add, Radio, xs+100 ys+0 section vModality5 gCreate_Msgbox_Command, Default desktop

Gui, Add, Groupbox, x10 y200 w510 h90 section, Icons
;Gui, Add, Picture, xs+20 ys+20 gSelect_NoIcon section icon1, %A_WinDir%\system32\user32.dll
Gui, Add, Picture, xs+20 ys+20 gSelect_NoIcon h30 w20 section,
Gui, Add, Picture, xs+115 ys+0 gSelect_ErrorIcon icon4 , %A_WinDir%\system32\user32.dll
Gui, Add, Picture, xs+215 ys+0 gSelect_Question icon3 , %A_WinDir%\system32\user32.dll
Gui, Add, Picture, xs+310 ys+0 gSelect_Exclamation icon2, %A_WinDir%\system32\user32.dll
Gui, Add, Picture, xs+415 ys+0 gSelect_Info icon5 , %A_WinDir%\system32\user32.dll
Gui, Add, Radio, xs-10 ys+40 section vIcon1 Checked gCreate_Msgbox_Command, No Icon
Gui, Add, Radio, xs+105 ys+0 vIcon2 gCreate_Msgbox_Command, Stop/Error
Gui, Add, Radio, xs+205 ys+0 vIcon3 gCreate_Msgbox_Command, Question
Gui, Add, Radio, xs+300 ys+0 vIcon4 gCreate_Msgbox_Command, Exclamation
Gui, Add, Radio, xs+415 ys+0 vIcon5 gCreate_Msgbox_Command, Info


Gui, Add, Groupbox, x10 y300 h65 w510 section, Buttons
Gui, Add, Radio, xs+10 ys+20 vButton_Selection1 section Checked gCreate_Msgbox_Command, OK
Gui, Add, Radio, xs+115 ys+0 vButton_Selection2 gCreate_Msgbox_Command, OK/Cancel
Gui, Add, Radio, xs+210 ys+0 vButton_Selection3 gCreate_Msgbox_Command, Abort/Retry/Ignore
Gui, Add, Checkbox, xs+335 ys+0 vButton_Selection_Help gCreate_Msgbox_Command, Help button
Gui, Add, Radio, xs+0 ys+25 section vButton_Selection4 gCreate_Msgbox_Command, Yes/No/Cancel
Gui, Add, Radio, xs+115 ys+0 vButton_Selection5 gCreate_Msgbox_Command, Yes/No
Gui, Add, Radio, xs+210 ys+0 vButton_Selection6 gCreate_Msgbox_Command, Retry/Cancel
Gui, Add, Radio, xs+335 ys+0 section vButton_Selection7 gCreate_Msgbox_Command, Cancel/Try Again/Continue


Gui, Add, Groupbox, x10 y375 h45 w200 section, Default-Button
Gui, Add, Radio, xs+10 ys+20 section Checked vDefault1 gCreate_Msgbox_Command, 1st
Gui, Add, Radio, xs+70 ys+0 section vDefault2 gCreate_Msgbox_Command, 2nd
Gui, Add, Radio, xs+70 ys+0 section vDefault3 gCreate_Msgbox_Command, 3rd

Gui, Add, Groupbox, x220 y375 h45 w90 section, Timeout
Gui, Add, Edit, xs+10 ys+17 w70 vTimeout gCreate_Msgbox_Command
Gui, Add, UpDown, Range-1-2147483, -1

Gui, Add, Groupbox, x315 y375 w205 h45 section, Allignment
Gui, Add, Checkbox, xs+10 ys+20 vAllignment1 section gCreate_Msgbox_Command, Right-justified
Gui, Add, Checkbox, xs+100 ys+0 vAllignment2 gCreate_Msgbox_Command, Right-to-left

Gui, Add, Groupbox, x10 y430 w510 h105 section, Result
Gui, Add, Edit, xs+10 ys+20 w485 r3 vMsgbox_Command,
Gui, Add, Button, xs+20 ys+75 section h20 w40 vTest gTest, Test
Gui, Add, Button, xs+60 ys+0 h20 w100 Default gCopy_to_Clipboard, Copy to Clipboard
Gui, Add, Button, xs+180 ys+0 h20 w40 gReset, Reset
Gui, Show, , Create MessageBox
GoSub, Reset      ;Initalize GUI from Ini
return

Select_NoIcon:
GuiControl, , Icon1, 1
GoSub, Create_Msgbox_Command
return

Select_ErrorIcon:
GuiControl, , Icon2, 1
GoSub, Create_Msgbox_Command
return

Select_Question:
GuiControl, , Icon3, 1
GoSub, Create_Msgbox_Command
return

Select_Exclamation:
GuiControl, , Icon4, 1
GoSub, Create_Msgbox_Command
return

Select_Info:
GuiControl, , Icon5, 1
GoSub, Create_Msgbox_Command
return

Create_Msgbox_Command:
Gui, Submit, NoHide
;Get types of used buttons
Loop, 7
{
   if Button_Selection%A_Index% = 1
   {
      ButtonSelection := A_Index -1
      if Button_Selection_Help = 1
         ButtonSelection += 16384
      break
   }
}

;Get used Icon
Loop, 5
{
   if Icon%A_Index% = 1
   {
      if A_Index = 1
         Icon = 0
      else if A_Index = 2
         Icon = 16
      else if A_Index = 3
         Icon = 32
      else if A_Index = 4
         Icon = 48
      else if A_Index = 5
         Icon = 64
      break
   }
}

;Get Modality-State
Loop, 5
{
   if Modality%A_Index% = 1
   {
      if A_Index = 1
         Modality = 0
      else if A_Index = 2
         Modality = 8192
      else if A_Index = 3
         Modality = 4096
      else if A_Index = 4
         Modality = 262144
      else if A_Index = 5
         Modality = 131072
      break
   }
}

;Get Default-Button
Loop, 3
{
   if Default%A_Index% = 1
   {
      if A_Index = 1
         Default = 0
      else if A_Index = 2
         Default = 256
      else if A_Index = 3
         Default = 512
      break
   }
}

;Check Allignment
Allignment = 0
if Allignment1 = 1
   Allignment += 524288
if Allignment2 = 1
   Allignment += 1048576

Msgbox_Number := ButtonSelection + Icon + Modality + Default + Allignment   ;Generate type of messagebox

Escape_Characters(Title)
Escape_Characters(Text)

;Timeout "-1" = no timeout
if Timeout = -1
   Timeout =
else
{
   StringReplace, Timeout, Timeout, `,, .      ;Allows "," as decimal-point
   Timeout = , %Timeout%
}



;Create command and set it to Edit-Control
Msgbox_Command = msgbox, %Msgbox_Number%, %Title%, %Text%%Timeout%
GuiControl, , Msgbox_Command, %Msgbox_Command%
return


;Creates a Temp-File to show actual configuration
Test:
GoSub, Create_Msgbox_Command
GuiControl, Disable, Test
FileAppend, %Msgbox_Command%, MsgboxTemp.ahk
RunWait, MsgboxTemp.ahk
FileDelete, MsgboxTemp.ahk
GuiControl, Enable, Test
return


;Escapes Characters like ","
Escape_Characters(byref Var)
{
   StringReplace, Var, Var, `n, ``n, All      ;Translate line breaks in entered text
   StringReplace, Var, Var, `,, ```,, All      ;Escapes ","
   StringReplace, Var, Var, `;, ```;, All      ;Escapes ";"
}



Copy_to_Clipboard:
Clipboard = %Msgbox_Command%
IniRead, Reset_after_Clipboard, %A_ScriptDir%\Msgbox.ini, Clipboard, Reset after Clipboard, 0
if Reset_after_Clipboard = 1
   GoSub, Reset
return

GuiClose:
ExitApp

Open:
Gui, Show
return

Reset:
IfExist %A_ScriptDir%\Msgbox.ini
{
   IniRead, Title, %A_ScriptDir%\Msgbox.ini, Reset, Title, plk
   if Title = plk
      Title =
   IniRead, Text, %A_ScriptDir%\Msgbox.ini, Reset, Text, plk
   if Text = plk
      Text =
   IniRead, Modality, %A_ScriptDir%\Msgbox.ini, Reset, Modality, 1
   IniRead, Icon, %A_ScriptDir%\Msgbox.ini, Reset, Icon, 1
   IniRead, Button_Selection, %A_ScriptDir%\Msgbox.ini, Reset, Button, 1
   IniRead, Button_Selection_Help, %A_ScriptDir%\Msgbox.ini, Reset, Help Button, 0
   IniRead, Default, %A_ScriptDir%\Msgbox.ini, Reset, Default Button, 1
   IniRead, Timeout, %A_ScriptDir%\Msgbox.ini, Reset, Timeout, -1
   IniRead, Allignment1, %A_ScriptDir%\Msgbox.ini, Reset, Allignment_Right, 0
   IniRead, Allignment2, %A_ScriptDir%\Msgbox.ini, Reset, Allignment_RtL, 0
}
else
{
   Title =
   Text =
   Modality = 1
   Icon = 1
   Button_Selection = 1
   Button_Selection_Help = 0
   Default = 1
   Timeout = -1
   Allignment1 = 0
   Allignment2 = 0
}

GuiControl, , Title, %Title%
GuiControl, , Text, %Text%
GuiControl, , Modality%Modality%, 1
GuiControl, , Icon%Icon%, 1
GuiControl, , Button_Selection%Button_Selection%, 1
GuiControl, , Button_Selection_Help, %Button_Selection_Help%
GuiControl, , Default%Default%, 1
GuiControl, , Timeout, %Timeout%
GuiControl, , Allignment1, %Allignment1%
GuiControl, , Allignment2, %Allignment2%
return

GuiSize:
if A_EventInfo = 1
   Gui, Show, Hide
return
and
Code:
;Tray-Menu
Menu, Tray, Add, Open, Open
Menu, Tray, Add, Reset Settings, Reset
Menu, Tray, Add, Close, GuiClose
Menu, Tray, Click, 1
Menu, Tray, Default, Open
Menu, Tray, NoStandard

;GUI
Gui, Add, Text, x10 y10 section, Title
Gui, Add, Edit, xs+0 ys+15 section w400 vTitle gCreate_Msgbox_Command,
Gui, Add, Text, xs+0 ys+25 section, Text:
Gui, Add, Edit, xs+0 ys+15 section r3 w400 vText gCreate_Msgbox_Command WantTab,

Gui, Add, Groupbox, x10 y130 h215 w190 section, Buttons
Gui, Add, Radio, xs+10 ys+20 section vButton_Selection1 Checked gCreate_Msgbox_Command, OK
Gui, Add, Radio, xs+0 ys+25 section vButton_Selection2 gCreate_Msgbox_Command, OK/Cancel
Gui, Add, Radio, xs+0 ys+25 section vButton_Selection3 gCreate_Msgbox_Command, Abort/Retry/Ignore
Gui, Add, Radio, xs+0 ys+25 section vButton_Selection4 gCreate_Msgbox_Command, Yes/No/Cancel
Gui, Add, Radio, xs+0 ys+25 section vButton_Selection5 gCreate_Msgbox_Command, Yes/No
Gui, Add, Radio, xs+0 ys+25 section vButton_Selection6 gCreate_Msgbox_Command, Retry/Cancel
Gui, Add, Radio, xs+0 ys+25 section vButton_Selection7 gCreate_Msgbox_Command, Cancel/Try Again/Continue
Gui, Add, Checkbox, xs+0 ys+25 vButton_Selection_Help gCreate_Msgbox_Command, Help button

Gui, Add, Groupbox, x220 y130 h215 w190 section, Icons
Gui, Add, Radio, xs+10 ys+25 section vIcon1 Checked gCreate_Msgbox_Command, No Icon
Gui, Add, Radio, xs+0 ys+40 vIcon2 gCreate_Msgbox_Command, Stop/Error
Gui, Add, Radio, xs+0 ys+80 vIcon3 gCreate_Msgbox_Command, Question
Gui, Add, Radio, xs+0 ys+120 vIcon4 gCreate_Msgbox_Command, Exclamation
Gui, Add, Radio, xs+0 ys+160 vIcon5 gCreate_Msgbox_Command, Info
;Gui, Add, Picture, xs+90 ys-10 gSelect_NoIcon icon1, %A_WinDir%\system32\user32.dll
Gui, Add, Picture, xs+90 ys-10 gSelect_NoIcon h30 w20
Gui, Add, Picture, xs+90 ys+30 gSelect_ErrorIcon icon4 , %A_WinDir%\system32\user32.dll
Gui, Add, Picture, xs+90 ys+70 gSelect_Question icon3 , %A_WinDir%\system32\user32.dll
Gui, Add, Picture, xs+90 ys+110 gSelect_Exclamation icon2, %A_WinDir%\system32\user32.dll
Gui, Add, Picture, xs+90 ys+150 gSelect_Info icon5 , %A_WinDir%\system32\user32.dll

Gui, Add, Groupbox, x430 y20 h140 w190 section, Modality
Gui, Add, Radio, xs+10 ys+20 section Checked vModality1 gCreate_Msgbox_Command, Normal
Gui, Add, Radio, xs+0 ys+25 section vModality2 gCreate_Msgbox_Command, Task Modal
Gui, Add, Radio, xs+0 ys+25 section vModality3 gCreate_Msgbox_Command, System Modal (always on top)
Gui, Add, Radio, xs+0 ys+25 section vModality4 gCreate_Msgbox_Command, Always on top
Gui, Add, Radio, xs+0 ys+25 section vModality5 gCreate_Msgbox_Command, Default desktop

Gui, Add, Groupbox, x430 y170 h45 w190 section, Default-Button
Gui, Add, Radio, xs+10 ys+20 section Checked vDefault1 gCreate_Msgbox_Command, 1st
Gui, Add, Radio, xs+65 ys+0 section vDefault2 gCreate_Msgbox_Command, 2nd
Gui, Add, Radio, xs+65 ys+0 section vDefault3 gCreate_Msgbox_Command, 3rd

Gui, Add, Groupbox, x435 y220 h45 w190 section, Allignment
Gui, Add, Checkbox, xs+10 ys+20 vAllignment1 section gCreate_Msgbox_Command, Right-justified
Gui, Add, Checkbox, xs+100 ys+0 vAllignment2 gCreate_Msgbox_Command, Right-to-left

Gui, Add, Groupbox, x430 y270 h45 w90 section, Timeout
Gui, Add, Edit, xs+10 ys+17 w70 vTimeout gCreate_Msgbox_Command
Gui, Add, UpDown, Range-1-2147483, -1

Gui, Add, Button, x530 y280 h30 w90 vTest gTest, &Test
Gui, Add, Button, x430 y320 h30 w90 Default gCopy_to_Clipboard, &Clipboard
Gui, Add, Button, x530 y320 h30 w90 gReset, &Reset

Gui, Add, Groupbox, x10 y350 w610 h75 section, Result
Gui, Add, Edit, xs+10 ys+20 w590 r3 vMsgbox_Command,

Gui, Show, , Create MessageBox
GoSub, Reset      ;Initalize GUI from Ini
return

Select_NoIcon:
GuiControl, , Icon1, 1
GoSub, Create_Msgbox_Command
return

Select_ErrorIcon:
GuiControl, , Icon2, 1
GoSub, Create_Msgbox_Command
return

Select_Question:
GuiControl, , Icon3, 1
GoSub, Create_Msgbox_Command
return

Select_Exclamation:
GuiControl, , Icon4, 1
GoSub, Create_Msgbox_Command
return

Select_Info:
GuiControl, , Icon5, 1
GoSub, Create_Msgbox_Command
return

Create_Msgbox_Command:
Gui, Submit, NoHide
;Get types of used buttons
Loop, 7
{
   if Button_Selection%A_Index% = 1
   {
      ButtonSelection := A_Index -1
      if Button_Selection_Help = 1
         ButtonSelection += 16384
      break
   }
}

;Get used Icon
Loop, 5
{
   if Icon%A_Index% = 1
   {
      if A_Index = 1
         Icon = 0
      else if A_Index = 2
         Icon = 16
      else if A_Index = 3
         Icon = 32
      else if A_Index = 4
         Icon = 48
      else if A_Index = 5
         Icon = 64
      break
   }
}

;Get Modality-State
Loop, 5
{
   if Modality%A_Index% = 1
   {
      if A_Index = 1
         Modality = 0
      else if A_Index = 2
         Modality = 8192
      else if A_Index = 3
         Modality = 4096
      else if A_Index = 4
         Modality = 262144
      else if A_Index = 5
         Modality = 131072
      break
   }
}

;Get Default-Button
Loop, 3
{
   if Default%A_Index% = 1
   {
      if A_Index = 1
         Default = 0
      else if A_Index = 2
         Default = 256
      else if A_Index = 3
         Default = 512
      break
   }
}

;Check Allignment
Allignment = 0
if Allignment1 = 1
   Allignment += 524288
if Allignment2 = 1
   Allignment += 1048576

Msgbox_Number := ButtonSelection + Icon + Modality + Default + Allignment   ;Generate type of messagebox

Escape_Characters(Title)
Escape_Characters(Text)

;Timeout "-1" = no timeout
if Timeout = -1
   Timeout =
else
{
   StringReplace, Timeout, Timeout, `,, .      ;Allows "," as decimal-point
   Timeout = , %Timeout%
}



;Create command and set it to Edit-Control
Msgbox_Command = msgbox, %Msgbox_Number%, %Title%, %Text%%Timeout%
GuiControl, , Msgbox_Command, %Msgbox_Command%
return


;Creates a Temp-File to show actual configuration
Test:
GoSub, Create_Msgbox_Command
GuiControl, Disable, Test
FileAppend, %Msgbox_Command%, MsgboxTemp.ahk
RunWait, MsgboxTemp.ahk
FileDelete, MsgboxTemp.ahk
GuiControl, Enable, Test
return


;Escapes Characters like ","
Escape_Characters(byref Var)
{
   StringReplace, Var, Var, `n, ``n, All      ;Translate line breaks in entered text
   StringReplace, Var, Var, `,, ```,, All      ;Escapes ","
   StringReplace, Var, Var, `;, ```;, All      ;Escapes ";"
}



Copy_to_Clipboard:
Clipboard = %Msgbox_Command%
IniRead, Reset_after_Clipboard, %A_ScriptDir%\Msgbox.ini, Clipboard, Reset after Clipboard, 0
if Reset_after_Clipboard = 1
   GoSub, Reset
return

GuiClose:
ExitApp

Open:
Gui, Show
return

Reset:
IfExist %A_ScriptDir%\Msgbox.ini
{
   IniRead, Title, %A_ScriptDir%\Msgbox.ini, Reset, Title, plk
   if Title = plk
      Title =
   IniRead, Text, %A_ScriptDir%\Msgbox.ini, Reset, Text, plk
   if Text = plk
      Text =
   IniRead, Modality, %A_ScriptDir%\Msgbox.ini, Reset, Modality, 1
   IniRead, Icon, %A_ScriptDir%\Msgbox.ini, Reset, Icon, 1
   IniRead, Button_Selection, %A_ScriptDir%\Msgbox.ini, Reset, Button, 1
   IniRead, Button_Selection_Help, %A_ScriptDir%\Msgbox.ini, Reset, Help Button, 0
   IniRead, Default, %A_ScriptDir%\Msgbox.ini, Reset, Default Button, 1
   IniRead, Timeout, %A_ScriptDir%\Msgbox.ini, Reset, Timeout, -1
   IniRead, Allignment1, %A_ScriptDir%\Msgbox.ini, Reset, Allignment_Right, 0
   IniRead, Allignment2, %A_ScriptDir%\Msgbox.ini, Reset, Allignment_RtL, 0
}
else
{
   Title =
   Text =
   Modality = 1
   Icon = 1
   Button_Selection = 1
   Button_Selection_Help = 0
   Default = 1
   Timeout = -1
   Allignment1 = 0
   Allignment2 = 0
}

GuiControl, , Title, %Title%
GuiControl, , Text, %Text%
GuiControl, , Modality%Modality%, 1
GuiControl, , Icon%Icon%, 1
GuiControl, , Button_Selection%Button_Selection%, 1
GuiControl, , Button_Selection_Help, %Button_Selection_Help%
GuiControl, , Default%Default%, 1
GuiControl, , Timeout, %Timeout%
GuiControl, , Allignment1, %Allignment1%
GuiControl, , Allignment2, %Allignment2%
return

GuiSize:
if A_EventInfo = 1
   Gui, Show, Hide
return
If something is added afterwards I'll choose the most rated GUI. You can also do suggestions (I'm not the design-boy :oops: ).
My favourite is Nr. 2.

Another question:
Does anyone use the changeable default-settings (via ini)?

Thalon

_________________
AHK-Icon-Changer
AHK-IRC
deutsches Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 11th, 2007, 5:28 am 
Offline

Joined: July 15th, 2006, 7:36 pm
Posts: 31
I vote #2 as well..

As for the ini file, I think your defaults are sane and most of my msgboxs change so defaults don't matter much.

Thanks for your work.. Sorry to be picking on ya... :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 11th, 2007, 11:07 am 
I've changed my default to "Always on top", because I use only them.
But I kept the other settings ...

You aren't picking!
I recommend constuctive critism :)

Thalon


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: sks and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group