Shortcut to play last used applescript

Hello everyone

Is it possible to detect which applescript has been most recently used? And then play the applescript again via a shortcut key. This would be like the last filter command in Photoshop, except with an applescript.

The reason for this is that often I will use the same script over and again when doing a job and it is inconvenient to have to click back in the menu again to run it.

Thanks in advance
Dave

Model: Macbook Pro
Browser: Safari 537.36
Operating System: Mac OS X (10.12.5)

No. But go here:

https://red-sweater.com/fastscripts/

and download FastScripts. It will then let you assign a shortcut to your script.

Free for a limited number of shortcuts, cheap for an unlimited supply. Plus it’s better in several other ways.

I presume you have some limited set of frequently used Applescripts. Maybe all in one folder. Or if they’re scattered, you could make a new folder and alias them there.

You could write a script that reads the names of the scripts in that folder, and presents a list asking you which one you want to run. Once selected, it would run it, and write out the path for the selected script to a text file.

Write a second script that just runs whatever script that text file says. I think that gets you the functionality you want, right? As long as you used the first script I suggested to run the script the first time around.

If that won’t work - say you need to run scripts from Script Editor, Script Debugger, Fastscripts, the Scripts Menu, etc, and still have your “repeat script” script work. Put a handler into all your scripts that update the text file with the path to themselves. Then the script that reads that text file and runs whatever script it points to will always re-run the last script.

I also second that Fastscripts is awesome and essential for anyone using a lot of scripts.

  • Tom.

Thanks t.spoon and Shane

I use Fastscripts and agree that it is really excellent and easy to use.

T.spoon – you’re idea of getting each script to write its own path to a text file sounds like it will work so I will give that a go. If successful I’ll post it here.

If you’re not successful, also post it here, because I’m sure I can script that functionality quickly and would be glad to help.

  • Tom.