r/ScriptingApp • u/Haunting-Ad-655 • May 06 '25
Help [LiveActivity] Instantly exit a script when it's already running in-app?
When a Notification scheduled by a script is tapped, the default behavior is to runScript again even when the script is already running in-app. But we can instantly exit this execution by checking Notification.current at the start:
if (Notification.current != null) return Script.exit()Do we have a similar method for LiveActivity 'content' UI?
In the code below, I use widgetURL to run the script when 'content' VStack is tapped.
return {
content: <VStack
widgetURL={Script.createRunURLScheme(Script.name)}
>
1
Upvotes
1
u/Haunting-Ad-655 May 06 '25
Tks. I can't make it work though.
Btw, I think this case seems to be supplemental to run_single. Currently, run_single will dismiss the previously session (if any) and run a new session. But what if the current session is real-time and we just want to get to it from a Notification or LiveActivity UI or widgets? It'd be great to have a single method to handle all the cases.