Applescript to automatically fullscreen Madmapper for installations

19 Sep Applescript to automatically fullscreen Madmapper for installations

This is a simple Applescript that I used with a long running installation that required Madmapper for doing some precise mapping. More info on keeping long running installations going is here: http://blairneal.com/blog/installation-up-4evr/

This script would be used on reboot to both open your Syphon enabled app and to open your madmapper file, open it, select fullscreen, and then hit OK on the dialog box.

It requires you to set your own file path in the script for your madmapper file and application file.

To use the code below:

1. Open Applescript and paste it into a new file

2. Change the filepaths and resolution so they match how it appears in your setup (ie resolution may be 3840×720 instead)

2. Go to “File -> Export” and select “Application” as your file format

3. In System Preferences -> Users & Groups -> Login items drop your applescript application in there to automatically launch on boot

 

You can also add in pauses (for things to load) and other checks with applescript if necessary.

This script will fail if for some reason the resolution has changed on boot or something – if the text doesn’t match exactly how it is in the Output menu of madmapper, it won’t work.

NOTE: I personally do not recommend using Madmapper for long running installations – there are occasional issues with it losing keyboard focus and it can appear as if your machine has locked you out if accessing it remotely. It’s also typically best practice to try and keep everything simplified into one application so you can minimize weird occurrences. In the case that we had to use this, there was not enough development time to add in the mapping code that was necessary.

 

 

tell application "Finder" to open POSIX file "YourInstallationApp.app" --add your absolute file path to your application

delay 10 --wait 5 seconds while your app loads up

tell application "Finder" to open POSIX file "/Users/you/yourmadmapperfile.map" --absolute filepath to your madmapper file

do_menu("MadMapper", "Output", "Fullscreen On Mainscreen: 1920x1200") --change this line to your determined resolution

on do_menu(app_name, menu_name, menu_item)
	try
		-- bring the target application to the front
		tell application app_name
			activate
		end tell
		delay 3 --wait for it to open
		tell application "System Events"
			tell process app_name
				tell menu bar 1
					tell menu bar item menu_name
						tell menu menu_name
							click menu item menu_item
							delay 3 --wait for Is fullscreen OK? box to appear
							tell application "System Events" to keystroke return
						end tell
					end tell
				end tell
			end tell
		end tell

		return true
	on error error_message
		return false
	end try
end do_menu
  • Pingback: Blair Neal | How to keep an installation up forever – Part 2()

  • Graham Thorne

    I use a similar script using Isadora and 99% of the time it works. But every now and again the app I created that runs the code doesn’t run. So it doesn’t go full screen or something. Its very rare but not 100% reliable I find.

  • Alejandro Crawford

    in madmapper preferences /misc u can check a box for “fullscreen when opening a project at startup” not sure if this is a new feature tho

    • Blair Neal

      Oh sweet – that does sound like a new feature. I guess this one is still applicable if you’re running multiple displays and need to zero in on one of them – I think this worked better on MadMapper 1.4, but after 1.5 they changed some things about how that menu worked that I wasn’t as much of a fan of