AppleScripts vs Shell Scripts

Peter, that does NOT work in AppleScript.

First, I run this macro to set and display the KM Variable:

MACRO:   Test Reading Emoji @Test

**Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+**
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

#### DOWNLOAD Macro File:
<a class="attachment" href="/uploads/default/original/3X/a/c/acce29d77386eb7ff93e853fa48b89f7d8a821cc.kmmacros">Test Reading Emoji @Test.kmmacros</a>
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**


---


<img src="/uploads/default/original/3X/2/4/2429ff14a20a68bae4ed828d8819aaac6ab4d895.png" width="490" height="513">

---

### Example Results
![image|316x264](upload://msqPcDrYOxeriwzP6NuCi9jjnBb.png) 

`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`

And then run this AppleScript 

![image|690x148](upload://lyMflFdwDVMASeEjziWfSUTM0HN.png) 

```applescript
set emojiSS to do shell script "echo $KMVAR_TEST__emoji"

return emojiSS
```

However, when I run this AppleScript 
```applescript
tell application "Keyboard Maestro Engine" to set emojiStr to getvariable "TEST__emoji"
```

it works fine:

![image|690x191](upload://61g7MLg9galwqvFWQO2VwsYVDER.png) 

Oh, and BTW, I think you grossly overstated the facts with:

[quote="peternlewis, post:6, topic:16174"]
One involves interprocess communication via AppleEvents (which is extremely slow), and the other involves firing off a sub-process (==which is extremely slow==).
[/quote]

since it ran in << 0.01 seconds.

So, I would again recommend to all AppleScript users:

[quote="JMichaelTX, post:5, topic:16174"]
Why would you ever want to call a Shell Script in AppleScript when there is a native AppleScript method for getting the data? Shell Scripts are almost always much slower.
[/quote]

Sometimes a shell script is the only solution.  But if you have another choice, use it.