#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)^( \d|\d\d) "
Local $sString = " 1 (function(inDesignMode) {" & @CRLF & _
" 2 'use strict';" & @CRLF & _
" 3 ObjC.import('stdlib');" & @CRLF & _
" 4 " & @CRLF & _
" 5 function getPluginParameter(name) {" & @CRLF & _
" 6 var envName = "KMPARAM_" + name.replace(/ /g, "_");" & @CRLF & _
" 7 var result;" & @CRLF & _
" 8 " & @CRLF & _
" 9 if (!inDesignMode) {" & @CRLF & _
"10 result = $.getenv(envName);" & @CRLF & _
"11 return result ? result.trim() : "";" & @CRLF & _
"12 }" & @CRLF & _
"13 " & @CRLF & _
"14 var designingParams = {" & @CRLF & _
"15 KMPARAM_Sort_Order: "newest first"," & @CRLF & _
"16 KMPARAM_Timestamp_Format: "date + time + duration"" & @CRLF & _
"17 };" & @CRLF & _
"18 " & @CRLF & _
"19 result = designingParams[envName];" & @CRLF & _
"20 if (result === undefined)" & @CRLF & _
"21 throw Error("Unknown Plugin Parameter Name '" + name + "' while in designing mode");" & @CRLF & _
"22 return result;" & @CRLF & _
"23 }" & @CRLF & _
"24 " & @CRLF & _
"25 function execute() {" & @CRLF & _
"26 var sortOrder = getPluginParameter("Sort Order");" & @CRLF & _
"27 var timestampFormat = getPluginParameter("Timestamp Format");" & @CRLF & _
"28 " & @CRLF & _
"29 return "Sort Order: '" + sortOrder + "'\nTimestamp Format: '" + timestampFormat + "'";" & @CRLF & _
"30 }" & @CRLF & _
"31 " & @CRLF & _
"32 if (inDesignMode) {" & @CRLF & _
"33 return execute();" & @CRLF & _
"34 } else {" & @CRLF & _
"35 try {" & @CRLF & _
"36 return execute();" & @CRLF & _
"37 } catch (e) {" & @CRLF & _
"38 return e.message;" & @CRLF & _
"39 }" & @CRLF & _
"40 }" & @CRLF & _
"41 })(true);"
Local $sSubst = ""
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm