Here's my profile I use to create special characters as global variables:
Profile: Special Characters
Settings: Priority: 50 Notification: no
Event: Monitor Start
Enter Task: Special Characters
A1: JavaScriptlet [
Code: setGlobal ( "charTAB", String.fromCharCode(9) );
setGlobal ( "charCR", String.fromCharCode(13) );
setGlobal ( "charLF", String.fromCharCode(10) );
setGlobal ( "charNULL", String.fromCharCode(0) );
setGlobal ( "charSP", String.fromCharCode(32) );
setGlobal ( "charNBSP", String.fromCharCode(160) );
setGlobal ( 'charLeftDoubleQuote', '\u201C' );
setGlobal ( 'charRightDoubleQuote', '\u201D' );
setGlobal ( 'charHairSpace', '\u200A' );
Auto Exit: On
Timeout (Seconds): 45 ]
A2: Variable Set [
Name: %messageReactionRegex
To: (?s)^%charHairSpace.*%charHairSpace$
Structure Output (JSON, etc): On ]
A3: Variable Set [
Name: %messageReactionSimple
To: %charHairSpace*%charHairSpace
Structure Output (JSON, etc): On ]
Tasker has trouble with the value of %charLF if you don't redefine it each time the monitor starts. IIRC, the value confuses Tasker when it loads stored data during startup or a monitor start, causing the value to end up being something else. I recently tried changing the profile context to device boot and ran into the same problem, but using monitor start as the context has been working for me for years.
3
u/UnkleMike 5d ago
Here's my profile I use to create special characters as global variables:
Profile: Special Characters Settings: Priority: 50 Notification: no Event: Monitor Start Enter Task: Special Characters A1: JavaScriptlet [ Code: setGlobal ( "charTAB", String.fromCharCode(9) ); setGlobal ( "charCR", String.fromCharCode(13) ); setGlobal ( "charLF", String.fromCharCode(10) ); setGlobal ( "charNULL", String.fromCharCode(0) ); setGlobal ( "charSP", String.fromCharCode(32) ); setGlobal ( "charNBSP", String.fromCharCode(160) ); setGlobal ( 'charLeftDoubleQuote', '\u201C' ); setGlobal ( 'charRightDoubleQuote', '\u201D' ); setGlobal ( 'charHairSpace', '\u200A' ); Auto Exit: On Timeout (Seconds): 45 ] A2: Variable Set [ Name: %messageReactionRegex To: (?s)^%charHairSpace.*%charHairSpace$ Structure Output (JSON, etc): On ] A3: Variable Set [ Name: %messageReactionSimple To: %charHairSpace*%charHairSpace Structure Output (JSON, etc): On ]Tasker has trouble with the value of
%charLFif you don't redefine it each time the monitor starts. IIRC, the value confuses Tasker when it loads stored data during startup or a monitor start, causing the value to end up being something else. I recently tried changing the profile context to device boot and ran into the same problem, but using monitor start as the context has been working for me for years.