Skip to content

Commit bb7ddb7

Browse files
authored
Refactor 019-mdMsgBox_Example.au3
1 parent ee041a7 commit bb7ddb7

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

examples/019-mdMsgBox_Example.au3

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@
1717
/Timer:0
1818
/TopMost:0
1919
/Parent:0
20+
/File:""
2021
#CE
2122

2223

23-
_Example1()
24+
;~ _Example1()
2425
;~ _Example2()
2526
;~ _Example3()
2627
;~ _Example4()
2728
;~ _Example5()
29+
_Example6()
2830

2931
;---------------------------------------------------------------------------------------
3032
Func _Example1()
@@ -41,7 +43,7 @@ Func _Example1()
4143

4244
; Call your compiled EXE
4345
; We pass Title, Text (Hex), Buttons and a custom Button Color
44-
Local $iExitCode = mdMsgBox('mdMsgBox.exe /Title:"' & $sTitle & '" /Text:' & $sHexText & ' /Buttons:"' & $sButtons & '" /TopMost:1 /Left:2200')
46+
Local $iExitCode = mdMsgBox('mdMsgBox.exe /Title:"' & $sTitle & '" /Text:' & $sHexText & ' /Buttons:"' & $sButtons & '" /TopMost:1')
4547

4648
Switch $iExitCode
4749
Case 0
@@ -112,6 +114,19 @@ Func _Example5()
112114
ConsoleWrite("User clicked: " & $iExitCode & @CRLF)
113115
EndFunc ;==>_Example5
114116

117+
Func _Example6()
118+
Local $sSelectedFile = FileOpenDialog("Select Markdown File", @ScriptDir, "Markdown Files (*.md;*.txt)", 1)
119+
If @error Then Return 0 ; if Cancel, Return
120+
Local $sTextParam = StringToBinary("### ❌ Error File not found", 4)
121+
Local $sCommand = 'mdMsgBox.exe /Title:"File Viewer" ' & _
122+
'/Text:' & $sTextParam & ' ' & _
123+
'/Buttons:"~Close" ' & _
124+
'/File:"' & $sSelectedFile & '" ' & _
125+
'/MaxWidth:800'
126+
Local $iExitCode = mdMsgBox($sCommand)
127+
Return $iExitCode
128+
EndFunc
129+
115130
Func mdMsgBox($sParam, $bWait = True) ; skip the compilation in the examples
116131
If $bWait Then
117132
Return ShellExecuteWait(@AutoItExe, '"' & @ScriptDir & '\019-mdMsgBox.au3" ' & $sParam)

0 commit comments

Comments
 (0)