Skip to content

Commit ee041a7

Browse files
authored
Update 019-mdMsgBox.au3
1 parent f53a0d3 commit ee041a7

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

examples/019-mdMsgBox.au3

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,12 @@ Func _CmdLine_Parsing()
9898
$g_sTitle = StringReplace($sCmd, "/Title:", "")
9999
Case StringInStr($sCmd, "/Text:")
100100
Local $sHex = StringReplace($sCmd, "/Text:", "")
101-
$g_sText = BinaryToString($sHex, 4) ; 4 = UTF8
101+
; If the string starts with 0x, it is Hex, otherwise it is plain text
102+
If StringLeft($sHex, 2) = "0x" Then
103+
$g_sText = BinaryToString($sHex, 4)
104+
Else
105+
$g_sText = StringRegExpReplace($sHex, '^["'']|["'']$', '')
106+
EndIf
102107
Case StringInStr($sCmd, "/Buttons:")
103108
Local $sHexBtn = StringReplace($sCmd, "/Buttons:", "")
104109
; If the string starts with 0x, it is Hex, otherwise it is plain text
@@ -121,7 +126,7 @@ Func _CmdLine_Parsing()
121126
Case StringInStr($sCmd, "/File:")
122127
$g_sFile = StringReplace($sCmd, "/File:", "")
123128
; We remove any extra quotes if the user entered /File:"path"
124-
$g_sFile = StringReplace($g_sFile, '"', "")
129+
$g_sFile = StringRegExpReplace($g_sFile, '^["'']|["'']$', '')
125130
EndSelect
126131
Next
127132
EndIf

0 commit comments

Comments
 (0)