Script to automate cleanup before starting a screencast

I am looking for AppleScript or JXA script to automate certain tasks, which are manually done before starting a screencast. Listing down couple of tasks here:

  1. Hide the Menu bar on the top (Hide, not Auto hide)
    Cleanup all the icons in the menu bar, something similar to Bartender app
  2. Hide the Dock in the bottom (Hide, not auto hide)
    have only certain apps listed in dock (Configurable)
  3. Hide the icons on the Desktop and probably set a specific wallpaper(configurable)
  4. Set the screen resolution to a specific dimension(configurable)
  5. Start recording using screenflow



3replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • It would be interesting if there's something user created to do that. I don't think it would be AppleScript since some of those functions are probably not supported in the OS. There may be ways to control that through Terminal (Unix) commands and someone might script those functions.

    Reply Like
  • Hello, I've not touched my mac for about a month... xD


    1. Sorry I am no help here. I've not upgraded to El-Capitan yet so I have no idea how to hide the menu bar. It seems like something which was added in El-Capitan, correct me if I'm wrong.


    2. You can't completely hide the dock. As far as I know, the dock holds a lot of core functionality for Mac OS X. If you are already hiding it then show us how! While doing so show us how you do number 1 also :) However if you want to hide it for longer you can use something similar to this Unix command:

    defaults write autohide-delay -float 5 && killall Dock

    This is the same as autohide, however the dock is kept hidden for 5 seconds while your cursor is at the bottom of the screen. When finished remember to use this unix command:

    defaults delete autohide-delay

    Otherwise you will have a hidden dock for a long time.


    3. I didn't know that hiding desktop icons was possible, but apparently it is with this unix command:

    defaults write CreateDesktop false; killall Finder


    and of course:

    defaults write CreateDesktop true; killall Finder


    will reveal your icons again. All this is according to this website however I have been unsuccessful in getting the above commands to work myself.


    Setting a specific wallpaper - You should be able to do this in JXA with something like this:



    However, you may need to turn 'path/to/file.png' into a POSIX file path, which you make by wrapping it in a Path object:



     4. Do you mean screenflows screen resolution or the mac's screen resolution? If the latter you might want to use this.

    Otherwise UI Automation will have to be undertaken to do this. If you want to go down that route then this will be your bible, and was how I was automating ScreenFlow also:


    5. To start recording with ScreenFlow the best way is with the keyboard shortcut:

    se = Application('System Events')
    se.keystroke('2', { using: [ 'shift down', 'command down' ] })
    Reply Like 1
  • Also note it may be a hell of a lot easier if you setup a Virtual Machine... Then all you'd have to do is open your VM and everything is set up and ready to go.

    Reply Like
reply to topic
Like Follow
  • 1 yr agoLast active
  • 3Replies
  • 194Views
  • 4 Following