The script could be used as an included script or you could just copy and paste it directly into your script. Somewhere toward the bottom of your script would be good place to put it so it's out of the way. It's unlikely you'll need to make any changes to it if you're using it for the intended purpose. Note the first few lines can be unremarked to provide a sample usage.
If you're interested, I've put more technical reading at the bottom of the post.
Questions or comments?
Hope this is useful,
Dick
Code: Select all
//Unremark the following two lines for example usage:
//GoSub>AskDialog,Is Macro Scheduler the most useful software you've ever worked with?,ResultVariable,300,20
//MDL>ResultVariable
//Usage:
//GoSub>AskDialog,Message Text,Result Variable,[Xposition],[Yposition]
SRT>AskDialog
Let>AskDialogDoneFlag=0
If>BuildAskDialogFlag={"BuildAskDialogFlag"}
Dialog>AskDialog
object AskDialog: TForm
Alphablend = True
AlphaBlendValue = 0
AutoSize = True
BorderIcons = []
Caption = 'Confirm'
ClientHeight = 100
ClientWidth = 150
Position = poScreenCenter
object Panel1: TPanel
Left = 0
Top = 0
Width = 150
Height = 100
Caption = ''
BevelOuter = bvNone
end
object Label1: TLabel
Left = 54
Top = 13
Width = 32
Height = 13
Caption = ''
end
object MSButton1: tMSButton
Left = 9
Top = 60
Width = 62
Height = 24
Caption = '&Yes'
TabOrder = 1
Default = True
end
object MSButton2: tMSButton
Left = 77
Top = 60
Width = 62
Height = 24
Caption = '&No'
TabOrder = 2
end
object MSImage1: tMSImage
Left = 11
Top = 12
Width = 33
Height = 33
Transparent = True
Picture.Data = {
0954506E67496D61676589504E470D0A1A0A0000000D49484452000000210000
00210802000000D88655380000000674524E5300FF00800040332B9A0D000007
0E4944415478DAB5967B7014F51DC07FB7BBB77BBB7B7BBBB7F7CAC346124690
201DB1C4B4995251A833B6D387ADD5F287603345696D6899C0940E1481A95A05
4B29445B105A1CAD32210892D4E018B10FAB36A9A902C9B4C184BBE4C25D728F
ECDDEEDDBEB7BFBD4784696AC096EFDDECFCE6EEFBFD7D7EDFE76F1DD6B665E0
1A8BE34A1823CD2F92388AA11F599916907590CA489A9868E8DCF03F31922DC7
9CA803C59C18E67420087094AD2CCBD00DD3D055DDCCCADA646C7CC98996AB66
247FD00177B63F054110C77FEA4080A61B9AAE6B9A2E88F2E8D8E8EDAFB55E29
23D5D2E1C45D048143826386CD2F13CDB0244557154D5195C191B13B4FAD9B9D
11FF5E3BE5662892401DC00200861EFAA099A07F70A2FBAD8820A92EA7794335
B5B4A16EEE755CF100504D520CE88AA628E18B89DB3A1FFA38C6F8DA768AA63D
6E121AEBA6FDC510206495F58FBFF2FCF1C1FA85373850E4DCDBEF012DCE063C
EB1FFE46EB9A65A6094814381190918D9490D734657038FAD5D33F9C99115973
84A61996215104E4356058768E5114B43EFAF2337BBAFD0BEBBB0F3E50E1A3EE
7EE8406FDF30C09C40161EFFD9EA96FB1B2519500470A32091B3318A925F74F8
DE191843AB0E536ED6C7314E0CB10126285691ACE837ADF869426480A6FDE8C1
CFEFDEB87CFBD36F6C7BEC0408CE03890B3737D41DDBBF8622314D076E0AB831
309654C5AC184B0B2B5E69BE8CF1FEB70EC01CB02CC7B284AC143CB08069FF0F
72925ABB74AB8155004D696AACE97C76E5D1AE330F6E7C0ED0738018AF9B1B78
A9ADB9A69296556039004703D5B06271F1C3F0583211FFEE07DB2F61DC779076
73BC9F4551542B685B96FD850C58578FECE979BD2F5D555DD3B400D9B276C96F
5EEC6DDDF21260EB8098B8B1BEF285BDAB833CA168C0320182018606F149E542
3892CBCBF7FE695D89716AC56E1822AF37C0F11E9840C3B019A05051B68603C8
B21189E7612987788C6590D61D1D870FBD435C3FDF52957BBE34EFC94D5FCCC9
A533410B920239519B4CA463B18BB1E1B3EBA2CFDA8CEE3B76310CE30F8460A8
20C3AED74232E0B98A0EC10687830422212F1A17EFFE4E5B3CEDBC75E9EDB595
C8C32BE705781226A3285007C380A2AAC9C9547A2A151D195837D256F0E38E5D
04E50ED80C0E2AD9C72F44A978AEA237C5B58B00CF1FFBC7E6ADC7172F5FBEEA
9B0D4D0B5196716A1A285A14D560B854594D2413B22846CE9F69B9B0CF66742E
DB49926E7F30E4E1BCA534146C8AFB4E2F0A8133EF5AF55C5230766EF9F26D0D
21CB72400F2E05C005741A329289445E9A1AFAA07753F27736E348E3131CEBE6
FD2196E78B056B16372D961628C51A06213C9E858CE6FB966C6969CC8885FA2E
3B0ACA0782F1CCE7F2423A31313179F62F5DBB5D6FD88C43B73CEA63488F37C0
0782388E978E5F7E4EFB8442C658B6E591CEEFAFFAEC5796D78AB9C2EF66D909
50AA43389285A9B428A446A3D1C137DB0F549CB319ED9F7B4C560D96F3FB4215
1E0F379D83A2A559EE15E8A0030599AC4191281C049A5170029422552C10A824
E795746A529C4A0C9C1D480EF61CAA192EF5C7BE055B7DACDBC3077D8190CBE5
32AC72A0CA1509230003FDD6BBE7FF35345655E96B6AAA2770D434CA9D54F6D8
308CCC542A934EA604A1F7CD577FEFFFE3473DD8B6602B86586E8F17F6A1D71F
74E2443108A57C5AF670EA3AF5FEF6CD4F015D052676D7B7BFBEF9C7F7C08A9A
CE077C18A699B501294914864727075E7DBABB51BA6C5EEDA8DA10E048DAE365
79D88C419CC0CD728DD9E31D05EB37EEEF7BFB0C7057835C9AE488DF1ED8140A
50BA566A581D5E88423A934E48E25432A3BC7B72FFA94F476798BBDBAB36F08C
8BF6F01EAF8FE17882A41187A3586370FAEEF87947CFC977D8BA456E9A42CCF4
9E9DAB690AB77BD6824DA74859013A91B31DC99DFBDB69EB62FFF1CF483330F6
D6AC8D29B4CF43523443D22CC5B024EDC670178220701887A3C2DE7D5D6C45ED
B22F2C7661C2CD378514D5D454359F93725256CE6560D3A5B2EA3FFBFFAC84FF
DA75ABFC5FEFA85F05579ECFBA7D3CE7A169A78BC25D348613303D3849C15AD0
4DF8E2006F61FB0296B239312B40809A9734359F15A5784A08FFFD3567367CB2
41BE74CF19EEDAC373EEEF1BCEA27C2D47C30B1D85056B62048AE1F07277C1F0
312CCD7A0D431792093193821EE89A9E92D4F1A1FEEC485FC08DBE70E3E4ECF7
79519E70DD39309AB5E82017A8841BA30E042A3B719CF1F25E7F255CA7931393
13F18BD148261913067B3837F1F22DD28C5BCDF27EF56BFFD72263B129C5A1A8
3A4673FEEB17111EBFBFB206C789F878A4FFF52362E4BDEAAAAA8373463F6693
2B7A4F9C96A742CD1253E7F656302C3F1A090F9CD87574417456ABAB6340F9C9
A7B6310CE70D560E87C747BA7F79747EF8FFCFE858DCDA3382D6D5CD1D4FE586
FFF08BE3F5A3B39A5C3503CA3373D69CCD5D47D0FC875D4F9EB8460C286DD50F
F48EEAD2D0E9F6F9D7201F9F40FE0D1DA3C4EE67F099AE0000000049454E44AE
426082}
end
end
EndDialog>AskDialog
EndIf
AddDialogHandler>AskDialog,MSButton1,OnClick,AskDialogYes
AddDialogHandler>AskDialog,MSButton2,OnClick,AskDialogNo
AddDialogHandler>AskDialog,,OnClose,AskDialogNo
Let>BuildAskDialogFlag=0
Show>AskDialog
SetDialogProperty>AskDialog,Label1,Caption,AskDialog_var_1
GetDialogProperty>AskDialog,,ClientWidth,AskDiaWide
SetDialogProperty>AskDialog,,AutoSize,False
Add>AskDiaWide,20
If>AskDiaWide<170
Let>AskDiaWide=170
Else
Let>AskButton1X={round(9+((%AskDiaWide%-150)/2))}
Let>AskButton2X={round(77+((%AskDiaWide%-150)/2))}
SetDialogProperty>AskDialog,MSButton1,Left,AskButton1X
SetDialogProperty>AskDialog,MSButton2,Left,AskButton2X
EndIf
SetDialogProperty>AskDialog,Panel1,Visible,False
SetDialogProperty>AskDialog,,ClientWidth,AskDiaWide
SetDialogProperty>AskDialog,,Position,poScreenCenter
SetDialogProperty>AskDialog,,Left,AskDialog_var_3
SetDialogProperty>AskDialog,,Top,AskDialog_var_4
SetDialogProperty>AskDialog,,AlphaBlendValue,255
Label>Loop
If>AskDialogDoneFlag=1
Goto>AskDialogEnd
EndIf
Goto>Loop
SRT>AskDialogYes
CloseDialog>AskDialog
Let>%AskDialog_var_2%=YES
Let>AskDialogDoneFlag=1
END>AskDialogYes
SRT>AskDialogNo
CloseDialog>AskDialog
Let>%AskDialog_var_2%=NO
Let>AskDialogDoneFlag=1
END>AskDialogNo
Label>AskDialogEnd
Let>AskDialogDoneFlag=0
Let>AskDialog_var_1=
Let>AskDialog_var_2=
Let>AskDialog_var_3=
Let>AskDialog_var_4=
END>AskDialog
2) If you study the script you may notice that the GoSub>AskDialog's second parameter is a scripter assignable result variable. There is a trick to get the subroutine to return a value to a scripter's variable assignment. The trick is more fully explained HERE. But the bottom line is that we assign the result of the dialog selection to the "value" of the "AskDialog_var_2" variable by putting percents around the "AskDialog_var_2" variable.
The line looks like: Let>%AskDialog_var_2%=YES and Let>%AskDialog_var_2%=NO. Since the value of "AskDialog_var_2" as assigned by the GoSub>AskDialog subroutine call is "ResultVariable" (in the sample GoSub line), The new value of "ResultVariable" becomes either "YES" or "NO".