No internet connection
  1. Home
  2. How to

Applescript help

By Nicolai Linck @Nicolai_Linck7
    2023-01-06 11:36:26.274Z2023-01-06 14:19:45.878Z

    Hi. Im trying to copy an applescript that show/hides the menubar into soundflow, but when trying to run it nothing happens.

    The Applescript code look like this:

    tell application "System Events"
    	tell dock preferences to set autohide menu bar to not autohide menu bar
    end tell
    

    The soundflow scrip like this:

    sf.system.execAppleScript({
        script: "tell application \"System Events\" \tell dock preferences to set autohide menu bar to not autohide menu bar end tell",
    });
    

    Any suggestions?
    Best N

    Solved in post #2, click to view
    • 2 replies
    1. Hi Nicolai,

      Do it like this:

      sf.system.execAppleScript({
          script: `
      tell application "System Events"
          tell dock preferences to set autohide menu bar to not autohide menu bar
      end tell
      `
      });
      

      If you use the backtick symbol ` like this, your string can span multiple lines and include double quotes and single quotes, which the AppleScript needs.

      ReplySolution
      1. N
        In reply toNicolai_Linck7:
        Nicolai Linck @Nicolai_Linck7
          2023-01-06 13:51:59.577Z

          It works.. Thanks Christian!