run scpt without waiting for result?

Is there a way to run a script without waiting for result?

I hoping to run a curl process in the background but I dont want to wait for it to finish before progressing…

for instance if below is my main script


use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
set thePath to POSIX file "/Users/xx/Desktop/counter.scpt"
run script thePath
display dialog "this dialog runs after completion of run script"

and this is my sub script


use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
set Counter to 1
repeat 10 times
	display dialog Counter as text giving up after 2
	set Counter to Counter + 1
end repeat

I dont see the main dialog until after the run process is complete.

Cheers

It will be some strange thing as this. I don’t know why do you need it:


use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
set thePath to POSIX file "/Users/xx/Desktop/counter.scpt"

ignoring application responses
	tell me
		set Counter to 1
		repeat 10 times
			display dialog Counter as text giving up after 2
			set Counter to Counter + 1
		end repeat
	end tell
end ignoring

display dialog "this dialog runs after completion of run script"

I basically have a window that takes a text response and updates a field in a googlesheet or airtable which takes a few seconds to run but I want to send more field updates without waiting for the response from the web app.

So script a is the window and script b sends the update requests.

Well, you can save your sub script as application with name “Counter”. Then run your main script:


use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

ignoring application responses
	run application "Counter" -- or, activate application "Counter"
end ignoring

display dialog "this dialog runs after completion of run script"

One way to have a script do things without waiting for a response is to spin off a new thread for each of the things you don’t want to wait on. See this thread:
https://macscripter.net/viewtopic.php?pid=134353#p134353