Skip to content

Commit 3e56167

Browse files
authored
skip the compilation in the examples
1 parent 4ed2f45 commit 3e56167

1 file changed

Lines changed: 39 additions & 8 deletions

File tree

examples/019-mdMsgBox_Example.au3

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,32 @@
1+
; 019-mdMsgBox_Example.au3
2+
3+
#CS
4+
=== mdMsgBox parameters with default values ===
5+
/BkColor:0x2B2B2B ; (Dark slate gray)
6+
/TxtColor:0xE0E0E0 ; (Gainsboro)
7+
/FootColor:0x1E1E1E ; (Black)
8+
/MaxWidth:400
9+
/MaxHeight:800
10+
/Left:-1
11+
/Top:-1
12+
/Title:"Markdown MsgBox"
13+
/Text:""
14+
/Buttons:"OK"
15+
/BtnDefColor:0xD73443 ; (Crimson)
16+
/BtnColor:0x559FF2 ; (Cornflower blue)
17+
/Timer:0
18+
/TopMost:0
19+
/Parent:0
20+
#CE
21+
122

223
_Example1()
324
;~ _Example2()
425
;~ _Example3()
526
;~ _Example4()
627
;~ _Example5()
728

29+
;---------------------------------------------------------------------------------------
830
Func _Example1()
931
; === Caller Script Example ===
1032
Local $sTitle = "Markdown MsgBox"
@@ -15,11 +37,11 @@ Func _Example1()
1537
"* 2️⃣ **Parser:** Marked.js" & @CRLF & _
1638
"* 3️⃣ **Logic:** AutoIt Bridge"
1739
Local $sButtons = "1|2|3|~CANCEL"
18-
Local $sHexText = String(StringToBinary($sMarkdown, 4)) ; Convert to Hex for safe CLI passage
40+
Local $sHexText = StringToBinary($sMarkdown, 4) ; Convert to Hex for safe CLI passage
1941

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

2446
Switch $iExitCode
2547
Case 0
@@ -35,7 +57,7 @@ Func _Example2()
3557
Local $sIcon = _FA("exclamation-triangle", 0, 0xF1C40F, "beat", 1)
3658
Local $sMarkdown = "## " & $sIcon & " Warning" & @CRLF & "SQLite3.dll could not be loaded."
3759
Local $sHexText = StringToBinary($sMarkdown, 4)
38-
RunWait('mdMsgBox.exe /Title:"Error" /MaxWidth:300 /Text:' & $sHexText & ' /Buttons:~Cancel')
60+
mdMsgBox('mdMsgBox.exe /Title:"Error" /MaxWidth:300 /Text:' & $sHexText & ' /Buttons:~Cancel')
3961
EndFunc ;==>_Example2
4062

4163
Func _Example3()
@@ -46,7 +68,7 @@ Func _Example3()
4668
Local $sText = "## " & $sIconHeader & " Unsaved Data." & @CRLF & _
4769
"You have **unsaved changes**." & @CRLF & "Do you want to **exit without saving?**"
4870
Local $sHexText = StringToBinary($sText, 4)
49-
If RunWait('mdMsgBox.exe /Title:"Warning" /Text:' & $sHexText & ' /Buttons:~NO|YES /BtnDefColor:0x559FF2 /BtnColor:0xD73443') = 2 Then
71+
If mdMsgBox('mdMsgBox.exe /Title:"Warning" /Text:' & $sHexText & ' /Buttons:~NO|YES /BtnDefColor:0x559FF2 /BtnColor:0xD73443') = 2 Then
5072
ConsoleWrite("...exit without saving" & @CRLF)
5173
EndIf
5274

@@ -59,9 +81,10 @@ Func _Example4()
5981
"copy is in progress. Please wait."
6082
Local $sHexText = StringToBinary($sText, 4)
6183

62-
Run('mdMsgBox.exe /Title:"copy in progress" /BtnDefColor:0x3EB10D /Text:' & $sHexText & ' /Buttons:~Cancel')
84+
mdMsgBox('mdMsgBox.exe /Title:"copy in progress" /BtnDefColor:0x3EB10D /Text:' & $sHexText & ' /Buttons:~Cancel', False) ; <<-($bWait = False)-<<
85+
86+
Sleep(5000)
6387

64-
Sleep(15000)
6588
WinClose("copy in progress")
6689
EndFunc ;==>_Example4
6790

@@ -76,7 +99,7 @@ Func _Example5()
7699
"* is a **icon library** with **2,140 free** Icons." & @CRLF & _
77100
"* https://fontawesome.com/search?ic=free-collection " & $sIconClick
78101

79-
Local $sHexText = String(StringToBinary($sMarkdown, 4)) ; Convert to Hex for safe CLI passage
102+
Local $sHexText = StringToBinary($sMarkdown, 4) ; Convert to Hex for safe CLI passage
80103

81104
Local $sBtn1 = _FA("arrow-rotate-right", 0, "", "spin", 1) & "arrow"
82105
Local $sBtn2 = _FA("floppy-disk", 1, "", "fade", 1) & "floppy"
@@ -85,10 +108,18 @@ Func _Example5()
85108
Local $sButtons = StringToBinary($sBtn1 & "|" & $sBtn2 & "|" & $sBtn3 & "|" & $sBtn4, 4)
86109

87110
; Call your compiled EXE
88-
Local $iExitCode = RunWait('mdMsgBox.exe /Title:"' & $sTitle & '" /Text:' & $sHexText & ' /Buttons:"' & $sButtons & '" /MaxWidth:500')
111+
Local $iExitCode = mdMsgBox('mdMsgBox.exe /Title:"' & $sTitle & '" /Text:' & $sHexText & ' /Buttons:"' & $sButtons & '" /MaxWidth:500')
89112
ConsoleWrite("User clicked: " & $iExitCode & @CRLF)
90113
EndFunc ;==>_Example5
91114

115+
Func mdMsgBox($sParam, $bWait = True) ; skip the compilation in the examples
116+
If $bWait Then
117+
Return ShellExecuteWait(@AutoItExe, '"' & @ScriptDir & '\019-mdMsgBox.au3" ' & $sParam)
118+
Else
119+
Return ShellExecute(@AutoItExe, '"' & @ScriptDir & '\019-mdMsgBox.au3" ' & $sParam)
120+
EndIf
121+
EndFunc ;==>mdMsgBox_Exec
122+
92123
Func _FA($sIconName, $iStyle = 0, $hColor = "", $sEffect = "", $iSize = 0, $sExtra = "")
93124
; https://docs.fontawesome.com/web/style/animate/
94125
; $iStyle: 0="fa-solid", 1="fa-regular"

0 commit comments

Comments
 (0)