 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
sleepyy35
Joined: 22 Jul 2004 Posts: 193 Location: cedar city UT
|
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1687
|
Posted: Mon Dec 20, 2004 2:54 pm Post subject: |
|
|
nice. specially for newbies. _________________
 |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Mon Dec 20, 2004 3:29 pm Post subject: |
|
|
Guess what, a few days ago I thought about that ! Thx for sharing it.
Now to the other side of the coin
Would be nice to paste the generated code instead/additionaly to the clipboard.
The appeareance of the buttons needs some tweaking (yes, I'm a beancounter and I love symetric forms. No, not regarding women ... ) Currently the orientation of those buttons reminds me a little at a Pablo Picasso painting (just kidding)
Ooops - its a BETA. Forget my above nonsense  |
|
| Back to top |
|
 |
oldbug
Joined: 19 Dec 2004 Posts: 5
|
Posted: Mon Dec 20, 2004 6:36 pm Post subject: oldbug |
|
|
Very Good!!!
But if change Buttons on GroupBox and RadioButton, will more understandable...
GroupButtons:
OK
OK/Cancel
Abort/Retry/Ignore
Yes/No/Cancel
Yes/No
Retry/Cancel
GroupIcons:
Icon None
Icon Hand
Icon Question
Icon Exclamation
Icon Asterisk
GroupModal:
Application
System Modal
Task Modal |
|
| Back to top |
|
 |
sleepyy35
Joined: 22 Jul 2004 Posts: 193 Location: cedar city UT
|
Posted: Tue Dec 21, 2004 7:22 am Post subject: |
|
|
Thank you guys for the nice words i'm going to do more with it i like the idea of the clipboard and the groupboxs thanx for the ideas  _________________ ^sleepy^ |
|
| Back to top |
|
 |
ranomore
Joined: 06 Nov 2004 Posts: 170 Location: Salt Lake City, UT
|
Posted: Wed Dec 22, 2004 3:03 am Post subject: |
|
|
I think this is really cool--I'm always going back to the help file to remember the numbers for the different box types. Maybe add the number in () next to the name of the button, like Yes No (4) or System Modal (4096), since numbers can be combined to make different button combinations for boxes?
...I had to look at the help file to make sure I got the right numbers in my post...  |
|
| Back to top |
|
 |
oldbug
Joined: 19 Dec 2004 Posts: 5
|
Posted: Thu Dec 23, 2004 6:53 pm Post subject: oldbug |
|
|
Hi. Here is simple MsgBox generator.
there is more correct code (without use *.ini, *.tmp and AutoHotkey.exe) but he big ~15kb
| Code: | ;Code
;#################### if extension *.ahk is not registered
IfNotExist, %A_ScriptDir%\msg.ini
{
FileSelectFile, SelectDirAHK, 1, %A_ProgramFiles%, Select AutoHotkey.exe, AutoHotkey (AutoHotkey.exe)
if SelectDirAHK =
{
MsgBox, 4144, Exit, Cancel !
ExitApp
}
else
IniWrite, %SelectDirAHK%, msg.ini, AHK, Dir
}
IfExist, %A_ScriptDir%\msg.ini
{
IniRead, AhkPath, %A_ScriptDir%\msg.ini, AHK, Dir
}
IfNotExist, %AhkPath%
{
MsgBox, 4112, Error, AutoHotkey.exe not found !
FileDelete, %A_ScriptDir%\msg.ini
ExitApp
}
;#################### Form
Gui, Add, Button, gButtonClose x326 y360 w80 h33, Close
Gui, Add, Button, gButtonTest x226 y360 w80 h33, Clipboard
Gui, Add, GroupBox, x16 y127 w190 h145, Buttons
Gui, Add, Radio, vRadioOK x26 y147 w170 h20, OK
Gui, Add, Radio, vRadioOK_Cancel x26 y167 w170 h20, OK/Cancel
Gui, Add, Radio, vRadioAbort_Retry_Ignore x26 y187 w170 h20, Abort/Retry/Ignore
Gui, Add, Radio, vRadioYes_No_Cancel x26 y207 w170 h20, Yes/No/Cancel
Gui, Add, Radio, vRadioYes_No x26 y227 w170 h20, Yes/No
Gui, Add, Radio, vRadioRetry_Cancel x26 y247 w170 h20, Retry/Cancel
Gui, Add, GroupBox, x226 y127 w180 h220, Icon
Gui, Add, Radio, vRadioNone x236 y147 w110 h20, None
Gui, Add, Radio, vRadioHand x236 y187 w110 h20, Error
Gui, Add, Radio, vRadioQuestion x236 y227 w110 h20, Question
Gui, Add, Radio, vRadioExclamation x236 y267 w110 h20, Exclamation
Gui, Add, Radio, vRadioAsterisk x236 y307 w110 h20, Asterisk
Gui, Add, GroupBox, x16 y277 w190 h70, Modal
Gui, Add, Radio, vRadioTask x26 y297 w170 h20, Task
Gui, Add, Radio, vRadioSystem x26 y317 w170 h20, System
Gui, Add, Text, x16 y7 w60 h15, Title
Gui, Add, Text, x16 y50 w60 h15, Message
Gui, Add, Edit, vEditTitle x16 y27 w390 h20,
Gui, Add, Edit, vEditMessage x16 y67 w390 h50,
;testing Win98
Gui, add, Picture, icon6 x356 y140 w32 h32, user.exe
Gui, add, Picture, icon4 x356 y177 w32 h32, user.exe
Gui, add, Picture, icon3 x356 y217 w32 h32, user.exe
Gui, add, Picture, icon2 x356 y257 w32 h32, user.exe
Gui, add, Picture, icon5 x356 y297 w32 h32, user.exe
;for XP do not know ???( user32.dll - icon100 - 104)
Gui, Add, GroupBox, x16 y353 w190 h40, Default Button
Gui, Add, Radio, vRadio1st x26 y367 w40 h20, 1st
Gui, Add, Radio, vRadio2nd x96 y367 w40 h20, 2nd
Gui, Add, Radio, vRadio3rd x164 y367 w40 h20, 3rd
GuiControl,, RadioOK, 1
GuiControl,, RadioNone, 1
GuiControl,, RadioTask, 1
GuiControl,, Radio1st, 1
Gui, Show, x148 y10 h410 w425, MsgBox Code Generator (for AHK)
Return
;#################### Main
ButtonTest:
GuiControlGet, RadioOK
GuiControlGet, RadioOK_Cancel
GuiControlGet, RadioAbort_Retry_Ignore
GuiControlGet, RadioYes_No_Cancel
GuiControlGet, RadioYes_No
GuiControlGet, RadioRetry_Cancel
GuiControlGet, RadioNone
GuiControlGet, RadioHand
GuiControlGet, RadioQuestion
GuiControlGet, RadioExclamation
GuiControlGet, RadioAsterisk
GuiControlGet, RadioTask
GuiControlGet, RadioSystem
GuiControlGet, EditTitle
GuiControlGet, EditMessage
GuiControlGet, Radio2nd
GuiControlGet, Radio3rd
EnvSet, VarInfo, 0
;#################### Radio Modal
if RadioSystem = 1
{
VarInfo = 4096
}
if RadioTask = 1
{
VarInfo = 8192
}
;#################### Radio Buttons
if RadioOK = 1
{
EnvAdd, VarInfo, 0
}
if RadioOK_Cancel = 1
{
EnvAdd, VarInfo, 1
}
if RadioAbort_Retry_Ignore = 1
{
EnvAdd, VarInfo, 2
}
if RadioYes_No_Cancel = 1
{
EnvAdd, VarInfo, 3
}
if RadioYes_No = 1
{
EnvAdd, VarInfo, 4
}
if RadioRetry_Cancel = 1
{
EnvAdd, VarInfo, 5
}
;#################### Radio Icons
if RadioNone = 1
{
EnvAdd, VarInfo, 0
}
if RadioHand = 1
{
EnvAdd, VarInfo, 16
}
if RadioQuestion = 1
{
EnvAdd, VarInfo, 32
}
if RadioExclamation = 1
{
EnvAdd, VarInfo, 48
}
if RadioAsterisk = 1
{
EnvAdd, VarInfo, 64
}
;#################### Radio Default Button
if Radio2nd = 1
{
EnvAdd, VarInfo, 256
}
if Radio3rd = 1
{
EnvAdd, VarInfo, 512
}
;#################### Output
IniRead, AhkPath, %A_ScriptDir%\msg.ini, AHK, Dir
OutputVar = MsgBox`, %VarInfo%`, %EditTitle%`, %EditMessage%
Clipboard = %OutputVar%
FileAppend, %OutputVar%, %A_ScriptDir%\~msg.tmp
RunWait, %AhkPath% %A_ScriptDir%\~msg.tmp
IfExist, %A_ScriptDir%\~msg.tmp, FileDelete, %A_ScriptDir%\~msg.tmp
Return
;#################### Close
ButtonClose:
FileDelete, %A_ScriptDir%\~msg.tmp
ExitApp
GuiClose:
FileDelete, %A_ScriptDir%\~msg.tmp
ExitApp;#################### if extension *.ahk is not registered
IfNotExist, %A_ScriptDir%\msg.ini
{
FileSelectFile, SelectDirAHK, 1, %A_ProgramFiles%, Select AutoHotkey.exe, AutoHotkey (AutoHotkey.exe)
if SelectDirAHK =
{
MsgBox, 4144, Exit, Cancel !
ExitApp
}
else
IniWrite, %SelectDirAHK%, msg.ini, AHK, Dir
}
IfExist, %A_ScriptDir%\msg.ini
{
IniRead, AhkPath, %A_ScriptDir%\msg.ini, AHK, Dir
}
IfNotExist, %AhkPath%
{
MsgBox, 4112, Error, AutoHotkey.exe not found !
FileDelete, %A_ScriptDir%\msg.ini
ExitApp
}
;#################### Form
Gui, Add, Button, gButtonClose x326 y360 w80 h33, Close
Gui, Add, Button, gButtonTest x226 y360 w80 h33, Clipboard
Gui, Add, GroupBox, x16 y127 w190 h145, Buttons
Gui, Add, Radio, vRadioOK x26 y147 w170 h20, OK
Gui, Add, Radio, vRadioOK_Cancel x26 y167 w170 h20, OK/Cancel
Gui, Add, Radio, vRadioAbort_Retry_Ignore x26 y187 w170 h20, Abort/Retry/Ignore
Gui, Add, Radio, vRadioYes_No_Cancel x26 y207 w170 h20, Yes/No/Cancel
Gui, Add, Radio, vRadioYes_No x26 y227 w170 h20, Yes/No
Gui, Add, Radio, vRadioRetry_Cancel x26 y247 w170 h20, Retry/Cancel
Gui, Add, GroupBox, x226 y127 w180 h220, Icon
Gui, Add, Radio, vRadioNone x236 y147 w110 h20, None
Gui, Add, Radio, vRadioHand x236 y187 w110 h20, Error
Gui, Add, Radio, vRadioQuestion x236 y227 w110 h20, Question
Gui, Add, Radio, vRadioExclamation x236 y267 w110 h20, Exclamation
Gui, Add, Radio, vRadioAsterisk x236 y307 w110 h20, Asterisk
Gui, Add, GroupBox, x16 y277 w190 h70, Modal
Gui, Add, Radio, vRadioTask x26 y297 w170 h20, Task
Gui, Add, Radio, vRadioSystem x26 y317 w170 h20, System
Gui, Add, Text, x16 y7 w60 h15, Title
Gui, Add, Text, x16 y50 w60 h15, Message
Gui, Add, Edit, vEditTitle x16 y27 w390 h20,
Gui, Add, Edit, vEditMessage x16 y67 w390 h50,
;testing Win98
Gui, add, Picture, icon6 x356 y140 w32 h32, user.exe
Gui, add, Picture, icon4 x356 y177 w32 h32, user.exe
Gui, add, Picture, icon3 x356 y217 w32 h32, user.exe
Gui, add, Picture, icon2 x356 y257 w32 h32, user.exe
Gui, add, Picture, icon5 x356 y297 w32 h32, user.exe
;for XP do not know ???( user32.dll - icon100 - 104)
Gui, Add, GroupBox, x16 y353 w190 h40, Default Button
Gui, Add, Radio, vRadio1st x26 y367 w40 h20, 1st
Gui, Add, Radio, vRadio2nd x96 y367 w40 h20, 2nd
Gui, Add, Radio, vRadio3rd x164 y367 w40 h20, 3rd
GuiControl,, RadioOK, 1
GuiControl,, RadioNone, 1
GuiControl,, RadioTask, 1
GuiControl,, Radio1st, 1
Gui, Show, x148 y10 h410 w425, MsgBox Code Generator (for AHK)
Return
;#################### Main
ButtonTest:
GuiControlGet, RadioOK
GuiControlGet, RadioOK_Cancel
GuiControlGet, RadioAbort_Retry_Ignore
GuiControlGet, RadioYes_No_Cancel
GuiControlGet, RadioYes_No
GuiControlGet, RadioRetry_Cancel
GuiControlGet, RadioNone
GuiControlGet, RadioHand
GuiControlGet, RadioQuestion
GuiControlGet, RadioExclamation
GuiControlGet, RadioAsterisk
GuiControlGet, RadioTask
GuiControlGet, RadioSystem
GuiControlGet, EditTitle
GuiControlGet, EditMessage
GuiControlGet, Radio2nd
GuiControlGet, Radio3rd
EnvSet, VarInfo, 0
;#################### Radio Modal
if RadioSystem = 1
{
VarInfo = 4096
}
if RadioTask = 1
{
VarInfo = 8192
}
;#################### Radio Buttons
if RadioOK = 1
{
EnvAdd, VarInfo, 0
}
if RadioOK_Cancel = 1
{
EnvAdd, VarInfo, 1
}
if RadioAbort_Retry_Ignore = 1
{
EnvAdd, VarInfo, 2
}
if RadioYes_No_Cancel = 1
{
EnvAdd, VarInfo, 3
}
if RadioYes_No = 1
{
EnvAdd, VarInfo, 4
}
if RadioRetry_Cancel = 1
{
EnvAdd, VarInfo, 5
}
;#################### Radio Icons
if RadioNone = 1
{
EnvAdd, VarInfo, 0
}
if RadioHand = 1
{
EnvAdd, VarInfo, 16
}
if RadioQuestion = 1
{
EnvAdd, VarInfo, 32
}
if RadioExclamation = 1
{
EnvAdd, VarInfo, 48
}
if RadioAsterisk = 1
{
EnvAdd, VarInfo, 64
}
;#################### Radio Default Button
if Radio2nd = 1
{
EnvAdd, VarInfo, 256
}
if Radio3rd = 1
{
EnvAdd, VarInfo, 512
}
;#################### Output
IniRead, AhkPath, %A_ScriptDir%\msg.ini, AHK, Dir
OutputVar = MsgBox`, %VarInfo%`, %EditTitle%`, %EditMessage%
Clipboard = %OutputVar%
FileAppend, %OutputVar%, %A_ScriptDir%\~msg.tmp
RunWait, %AhkPath% %A_ScriptDir%\~msg.tmp
IfExist, %A_ScriptDir%\~msg.tmp, FileDelete, %A_ScriptDir%\~msg.tmp
Return
;#################### Close
ButtonClose:
FileDelete, %A_ScriptDir%\~msg.tmp
ExitApp
GuiClose:
FileDelete, %A_ScriptDir%\~msg.tmp
ExitApp |
|
|
| Back to top |
|
 |
polyethene
Joined: 11 Aug 2004 Posts: 5154 Location: /b/
|
|
| Back to top |
|
 |
jchristl
Joined: 13 Jan 2006 Posts: 29
|
Posted: Thu Mar 02, 2006 10:14 pm Post subject: |
|
|
| I think the first link is dead. Anyone have a copy on hand they could post here? |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6786 Location: France (near Paris)
|
Posted: Fri Mar 03, 2006 11:24 am Post subject: |
|
|
Mmm, the script posted by oldbug is interesting.
Note he pasted the code twice...
It is a bit outdated (using EnvAdd for example), but the GUI isn't so bad, once I changed to order of controls for a more natural tab order.
So, after dusting it off, here is the 2006 version:
| Code: | /*
MsgBox generator by oldbug
http://www.autohotkey.com/forum/viewtopic.php?t=1631&p=9742#9742
Updated/Improved by Philippe Lhoste (PhiLho)
*/
;#################### Form
Gui Add, Text, x16 y7 w60 h15, Title
Gui Add, Text, x16 y50 w60 h15, Message
Gui Add, Edit, vtitle x16 y27 w390 h20,
Gui Add, Edit, vmessage x16 y67 w390 h50,
Gui Add, GroupBox, x16 y127 w190 h145, Buttons
Gui Add, Radio, vbuttonOK Checked x26 y147 w170 h20, OK
Gui Add, Radio, vbuttonOK_Cancel x26 y167 w170 h20, OK/Cancel
Gui Add, Radio, vbuttonAbort_Retry_Ignore x26 y187 w170 h20, Abort/Retry/Ignore
Gui Add, Radio, vbuttonYes_No_Cancel x26 y207 w170 h20, Yes/No/Cancel
Gui Add, Radio, vbuttonYes_No x26 y227 w170 h20, Yes/No
Gui Add, Radio, vbuttonRetry_Cancel x26 y247 w170 h20, Retry/Cancel
Gui Add, GroupBox, x16 y277 w190 h70, Modal
Gui Add, Radio, vmodalTask Checked x26 y297 w170 h20, Task
Gui Add, Radio, vmodalSystem x26 y317 w170 h20, System
Gui Add, GroupBox, x16 y353 w190 h40, Default Button
Gui Add, Radio, vdefault1st Checked x26 y367 w40 h20, 1st
Gui Add, Radio, vdefault2nd x96 y367 w40 h20, 2nd
Gui Add, Radio, vdefault3rd x164 y367 w40 h20, 3rd
Gui Add, GroupBox, x226 y127 w180 h220, Icon
Gui Add, Radio, viconNone Checked x236 y147 w110 h20, None
Gui Add, Radio, viconHand x236 y187 w110 h20, Error
Gui Add, Radio, viconQuestion x236 y227 w110 h20, Question
Gui Add, Radio, viconExclamation x236 y267 w110 h20, Exclamation
Gui Add, Radio, viconAsterisk x236 y307 w110 h20, Asterisk
If A_OSType = WIN32_WINDOWS
{
; Win98
Gui Add, Picture, icon6 x356 y140 w32 h32, user.exe
Gui Add, Picture, icon4 x356 y177 w32 h32, user.exe
Gui Add, Picture, icon3 x356 y217 w32 h32, user.exe
Gui Add, Picture, icon2 x356 y257 w32 h32, user.exe
Gui Add, Picture, icon5 x356 y297 w32 h32, user.exe
}
Else
{
; WinXP
;~ Gui Add, Picture, icon50 x356 y140 w32 h32, shell32.dll
Gui Add, Picture, icon4 x356 y177 w32 h32, user32.dll
Gui Add, Picture, icon3 x356 y217 w32 h32, user32.dll
Gui Add, Picture, icon2 x356 y257 w32 h32, user32.dll
Gui Add, Picture, icon5 x356 y297 w32 h32, user32.dll
}
Gui Add, Button, gTestAndCopy Default x226 y360 w80 h33, Clipboard
Gui Add, Button, gGuiClose x326 y360 w80 h33, Close
Gui Show, x148 y10 h410 w425, MsgBox Code Generator (for AHK)
Return
;#################### Main
TestAndCopy:
Gui Submit, NoHide
;#################### Radio buttons
options =
( Join|
buttonOK=0
buttonOK_Cancel=1
buttonAbort_Retry_Ignore=2
buttonYes_No_Cancel=3
buttonYes_No=4
buttonRetry_Cancel=5
iconNone=0
iconHand=16
iconQuestion=32
iconExclamation=48
iconAsterisk=64
default1st=0
default2nd=256
default3rd=512
modalSystem=4096
modalTask=8192
)
option = 0
; Check for each radio button if it is set, looping on the variable names
Loop Parse, options, |
{
StringSplit option, A_LoopField, =
If (%option1% = 1)
{
option += option2
}
}
;#################### Message
If (InStr(message, "`n"))
{
; Multiline
If (StrLen(message) > 78)
{
; Long message: use a continuation section
message = `n(`n%message%`n)
}
Else
{
; Replace newlines by the corresponding AHK escape sequence
StringReplace message, message, `n, ``n, All
}
}
;#################### Output
output = MsgBox %option%`, %title%`, %message%
Clipboard = %output%
; Test
FileAppend %output%, %A_ScriptDir%\~msg.tmp
RunWait %A_AhkPath% "%A_ScriptDir%\~msg.tmp"
FileDelete %A_ScriptDir%\~msg.tmp
Return
;#################### Close
GuiClose:
GuiEscape:
FileDelete %A_ScriptDir%\~msg.tmp
ExitApp
|
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Last edited by PhiLho on Mon Sep 25, 2006 10:56 am; edited 1 time in total |
|
| Back to top |
|
 |
jchristl
Joined: 13 Jan 2006 Posts: 29
|
Posted: Sat Mar 04, 2006 12:06 am Post subject: |
|
|
| PhiLho wrote: | Mmm, the script posted by oldbug is interesting.
Note he pasted the code twice... | Yeah, I thought that was my mistake at first when I tested them out.
| PhiLho wrote: | It is a bit outdated (using EnvAdd for example), but the GUI isn't so bad, once I changed to order of controls for a more natural tab order.
So, after dusting it off, here is the 2006 version:
| Thanks. I kinda like these sorta things. Allows me to not use my head too much... if I want a quick message, I can just pound one out using these. |
|
| Back to top |
|
 |
Koro Guest
|
Posted: Sun Sep 24, 2006 1:12 am Post subject: a little thing... |
|
|
| Quote: | | Code: |
output = MsgBox %option%`, %title%`, %message%
Clipboard = %output%
; Test
FileAppend %output%, %A_ScriptDir%\~msg.tmp
RunWait %A_AhkPath% %A_ScriptDir%\~msg.tmp
FileDelete %A_ScriptDir%\~msg.tmp
Return
;#################### Close
GuiClose:
GuiEscape:
FileDelete %A_ScriptDir%\~msg.tmp
ExitApp
|
|
What is that file handling for? Anyway it gives an error if the path to the script has a name with spaces on it (like "documents and settings"). I deleted all the file handling and it works perfect tho. I guess that was some 'debug' thing?  |
|
| Back to top |
|
 |
Thalon
Joined: 12 Jul 2005 Posts: 632
|
Posted: Mon Sep 25, 2006 8:04 am Post subject: |
|
|
@sleepyy35
The zip-file is corrupt after downloading it
So, I can't test it...
Here is my version of a MessageBox Creator.
It is up to date (including also Help-Button and Allignment), but uses a higher GUI.
Thalon _________________ AHK-Icon-Changer
AHK-IRC
deutsches Forum |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6786 Location: France (near Paris)
|
Posted: Mon Sep 25, 2006 10:58 am Post subject: Re: a little thing... |
|
|
| Koro wrote: | What is that file handling for? Anyway it gives an error if the path to the script has a name with spaces on it (like "documents and settings"). I deleted all the file handling and it works perfect tho. I guess that was some 'debug' thing?  | No, it is just a kind of preview, ie. it shows the resulting real message box. Not essential, but nice.
I corrected my script to enclose the path to the generated script between double quotes in the RunWait, should work better. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|