JavaScript is not blocking and the next action runs right away

Hi there,
I'm trying to implement snippet manager like TextExpander.

When I type zst, it opens a prompt for text, I type "name" and it pastes

const [name, setName] = useState();

Everything seems fine, but when my JavaScript runs the applescript, the next action (Type Custom Text) just runs even before I type anything in the prompt.

I thought the next action would wait until I call returnToBTT() in the javascript. What did I do wrong here?
Thanks.

@eunjae did you manage to resolve this?

in an action sequence the only way to resolve this would currently be to add a delay as BTT currently can not wait for JS to complete before continuing with the next action (this is on my TODO list and might be added soon). Alternatively you could call a named trigger from your java script.

1 Like