Have the app open

I have created a script with the Script Editor. I have exported it: File > Export > File Format > Application. I have left it in the Applications folder. I have also drag the icon to the Dock.

It works well but it seems that is not acting like other applications: Safari, Pages… In the Dock, it has not the regular dot under the active applications. If I use the shortcut command tap to see the opened applications it is not there either.

Does it mean that it is not open? How to change that?

It pretty much depends on the setting you choose when you exported it, the main script you have, and the function of this app you envision.

If you want your application to stay open you have to set “stay open” option (during the export step). But then you also need to include a “on idle / end idle” code, otherwise it will stay open but without doing anything.
The simplest code would be:

on idle
return 3
end idle

With this, the application will stay open and “beeping” every 3 seconds.

Thank you.

I have copy-paste your idle code to a new Script Editor, clicked to the run button and nothing happens. I hear no beep. There must be something I do not understand?

It works only as stay-open application, and not as script. So, save it as stay-open application, then run it to test.

Script equivalent of stay-open application is infinite repeat loop, but it consumes more CPU resources:

	beep 5
	set theResult to display dialog "Quit Now?" giving up after 1
	if button returned of theResult is "OK" then return
end repeat

As we sad above, effective approach is using on idle wrapper and saving all as stay-open application:

on idle
	-- your original script goes here
	return 3
end idle

Ok. Now it works. Thank you