here is a tiny program i made to auto script msgboxs
i think you might have to right click then save target as to download
http://sleepyssin-fr... ... reator.zip
Auto script for msgboxs
Started by
sleepyy35
, Dec 20 2004 04:53 AM
13 replies to this topic
nice. specially for newbies.
#2
-
Posted 20 December 2004 - 01:54 PM
CleanNews.in : Bite sized latest news headlines from India with zero bloat
Guess what, a few days ago I thought about that ! Thx for sharing it.
Now to the other side of the coin :wink:
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 ... :lol: ) Currently the orientation of those buttons reminds me a little at a Pablo Picasso painting (just kidding) 8)
Ooops - its a BETA. Forget my above nonsense :wink:
Now to the other side of the coin :wink:
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 ... :lol: ) Currently the orientation of those buttons reminds me a little at a Pablo Picasso painting (just kidding) 8)
Ooops - its a BETA. Forget my above nonsense :wink:
#3
-
Posted 20 December 2004 - 02:29 PM
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
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
#4
-
Posted 20 December 2004 - 05:36 PM
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 :lol:
#5
-
Posted 21 December 2004 - 06:22 AM
^sleepy^
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... :lol:
...I had to look at the help file to make sure I got the right numbers in my post... :lol:
#6
-
Posted 22 December 2004 - 02:03 AM
Hi. Here is simple MsgBox generator.
there is more correct code (without use *.ini, *.tmp and AutoHotkey.exe) but he big ~15kb
there is more correct code (without use *.ini, *.tmp and AutoHotkey.exe) but he big ~15kb
;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
#7
-
Posted 23 December 2004 - 05:53 PM
Cool, I've made one myself some time ago: http://get.filehosting.org/au16932.exe you could use some features that my one has. 8)
#8
-
Posted 23 December 2004 - 08:49 PM
I think the first link is dead. Anyone have a copy on hand they could post here?
#9
-
Posted 02 March 2006 - 09:14 PM
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: :-)
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: :-)
/* 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
#10
-
Posted 03 March 2006 - 10:24 AM
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Yeah, I thought that was my mistake at first when I tested them out.Mmm, the script posted by oldbug is interesting.
Note he pasted the code twice...
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.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: :-)
#11
-
Posted 03 March 2006 - 11:06 PM
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?
#12
-
Posted 24 September 2006 - 12:12 AM
No, it is just a kind of preview, ie. it shows the resulting real message box. Not essential, but nice.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?
I corrected my script to enclose the path to the generated script between double quotes in the RunWait, should work better.
#14
-
Posted 25 September 2006 - 09:58 AM
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")