[Mac] applescript to restore open Recent/Last Project

The ability to automatically launch the last project used, or to launch Cubase to the recent file dialog was lost in Cubase 7, so I wrote this script to regain that.

You launch the script, and let it launch Cubase.

If Cubase is already running, the script just brings it to the front and exits itself; otherwise it holds down the command key until the Open Recent Documents dialog appears, or the last project is opened (frontmost or not), or until it times out.

I made a feature request that this dialog box, which is invoked by holding down the command key while cubase launches:

be enabled in prefs. Then Curteye asked if it couldn’t be done with applescript. I hadn’t thought of trying that. Well, it could, with a small caveat, the computer will behave just as if you were holding the command key down manually while Cubase is launching.

if application "Cubase 7" is running then
	tell application "Cubase 7"
		activate --bring cubase to front if it's running already, then exit script.
	end tell
	tell application "Cubase 7" to launch
	tell application "System Events"
		key down command --press command key
		set timer to 1 --to permit script to timeout gracefully
			delay 1 --wait 1 second
			if (window 1 of process "Cubase 7" exists) then
				exit repeat
			end if
			set timer to timer + 1 --increment timer value
			if timer > 90 then --script will release command key after 90 seconds in case Cubase couldn't launch or something else goes wrong You can adjust this value to suit. My system has an SSD, Cubase launches in about 8 seconds.
				exit repeat
			end if
		end repeat
		key up command --release command key
		tell application "Cubase 7"
			activate --bring cubase to front
		end tell
		--keystroke return
	end tell
end if

The Applescript editor comes with Mac OS, it’s in /Applications/Utilities/

Open it, paste the code above into a new document and run it. If you want it to open your most recent Project, change the third to last line from

–keystroke return


keystroke return.

Removing the two hyphens uncomments and activates that line.

From the Applescript editor you can export it as an application that you launch as you would any other. (I exported two, one for last project, one for recent files dialog.)

Here is the zipped app too, it just opens the Recent file dialog.
Launch Cubase to Recent Files Dialog.app.zip (53.5 KB)

A real stealth hit with a bullet, eh? :laughing:

Aloha Steve and tanx for that.
I’ll give it a try in a couple of days.