Activate or open the script

Is there a way I can call my script/app when I am in another app?

I have a script/app that works well. I use it frequently with Apple Pages. To activate it I have to go to the Dock, click the app, and go back to Pages. It is not a big deal but when I do that many, many times I think it could be very useful to be able to call my script/app only with the keyboard while I am in Pages. I mean, without leaving the keyboard. Is that possible to do?

NMG. There are a number of approaches that will allow you to do what you want, and one is to use an Automator Quick Action. This is a bit cumbersome but is probably adequate with just a few scripts. There are many web postings that explain how this is done and the following is just one:

https://www.addictivetips.com/mac-os/run-an-applescript-with-a-keyboard-shortcut-on-macos/

Another approach is to use a utility designed for this purpose, one example of which is FastScripts. This utility is free for use with up to 10 shortcuts and is $24.95 afterwards. I’m sure there are many other similar utilities.

https://redsweater.com/fastscripts/

You specify a keyboard-only approach but, just to be complete, a mouse-based option is to enable the script menu by way of Script Editor preferences.

I do not understand. What do you mean by that?

NMG. Do the following:

  1. open Script Editor
  2. open Preferences
  3. select the General tab
  4. put check marks next to “Show Script menu in menu bar” and “Show Computer scripts”
  5. click on the new Scripts Menu icon in the menu bar and you will see Computer scripts plus your own scripts (if there are any)

On macOS Big Sur, It is no longer necessary to have to resort to UI Scripting by activating Script Editor then opening its preferences etc.
This following AppleScript code will do the trick.

tell application "AppleScript Utility"
	if not Script menu enabled then
		set Script menu enabled to true
		set application scripts position to top
		set show Computer scripts to true
	else
		set application scripts position to top
		set show Computer scripts to true
	end if
end tell

Thank you all for the help!