Terminal/Osascript: Automatically hide and show menu bar











up vote
0
down vote

favorite
1












Is there a way to enable "Automatically hide and show menu bar" checkbox via applscript/osascript or just terminal?



Current OS: macOS Mojave 10.14



I read things like LSUIPresentationMode and tried different things with osascript already










share|improve this question


























    up vote
    0
    down vote

    favorite
    1












    Is there a way to enable "Automatically hide and show menu bar" checkbox via applscript/osascript or just terminal?



    Current OS: macOS Mojave 10.14



    I read things like LSUIPresentationMode and tried different things with osascript already










    share|improve this question
























      up vote
      0
      down vote

      favorite
      1









      up vote
      0
      down vote

      favorite
      1






      1





      Is there a way to enable "Automatically hide and show menu bar" checkbox via applscript/osascript or just terminal?



      Current OS: macOS Mojave 10.14



      I read things like LSUIPresentationMode and tried different things with osascript already










      share|improve this question













      Is there a way to enable "Automatically hide and show menu bar" checkbox via applscript/osascript or just terminal?



      Current OS: macOS Mojave 10.14



      I read things like LSUIPresentationMode and tried different things with osascript already







      shell terminal applescript osascript






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 22 at 9:36









      pr0cat

      535




      535
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          This AppleScript code should work for you



          if application "System Preferences" is running then quit application "System Preferences"
          repeat until application "System Preferences" is not running
          delay 0.1
          end repeat
          tell application "System Preferences" to reveal pane id "com.apple.preference.general"

          tell application "System Events" to tell process "System Preferences" to tell window "General"
          repeat while not (exists of checkbox "Automatically hide and show the menu bar")
          delay 0.1
          end repeat
          click checkbox "Automatically hide and show the menu bar"
          end tell

          quit application "System Preferences"






          As per the request from a comment to my answer for the original post, this following code is a conversion from AppleScript to shell script… and can be run in the Terminal.app and should produce the same results



          printf 'aWYgYXBwbGljYXRpb24gIlN5c3RlbSBQcmVmZXJlbmNlc
          yIgaXMgcnVubmluZyB0aGVuIHF1aXQgYXBwbGljYXRpb24gIlN5c3RlbSBQcmVmZ
          XJlbmNlcyIKcmVwZWF0IHVudGlsIGFwcGxpY2F0aW9uICJTeXN0ZW0gUHJlZmVyZ
          W5jZXMiIGlzIG5vdCBydW5uaW5nCiAgICBkZWxheSAwLjEKZW5kIHJlcGVhdAp0Z
          WxsIGFwcGxpY2F0aW9uICJTeXN0ZW0gUHJlZmVyZW5jZXMiIHRvIHJldmVhbCBw
          YW5lIGlkICJjb20uYXBwbGUucHJlZmVyZW5jZS5nZW5lcmFsIgoKdGVsbCBhcHBsa
          WNhdGlvbiAiU3lzdGVtIEV2ZW50cyIgdG8gdGVsbCBwcm9jZXNzICJTeXN0ZW0gUH
          JlZmVyZW5jZXMiIHRvIHRlbGwgd2luZG93ICJHZW5lcmFsIgogICAgcmVwZWF0IH
          doaWxlIG5vdCAoZXhpc3RzIG9mIGNoZWNrYm94ICJBdXRvbWF0aWNhbGx5IGhp
          ZGUgYW5kIHNob3cgdGhlIG1lbnUgYmFyIikKICAgICAgICBkZWxheSAwLjEKICAgI
          GVuZCByZXBlYXQKICAgIGNsaWNrIGNoZWNrYm94ICJBdXRvbWF0aWNhbGx5IG
          hpZGUgYW5kIHNob3cgdGhlIG1lbnUgYmFyIgplbmQgdGVsbAoKcXVpdCBhcHBsa
          WNhdGlvbiAiU3lzdGVtIFByZWZlcmVuY2VzIiA='|base64 -D|osascript





          share|improve this answer























          • I let it run for like 5minutes, sadly nothing happened besides opening the system preferences and general tab. Edit: I got it working, by changing the System Language to "Enlgish" (had German)... Although when i convert the Checkbox Title to the German one, it doesnt check it. I guess the primary language has to be english? Is it a bug?
            – pr0cat
            Nov 23 at 9:37












          • Is it also possible to convert the applescript to terminal osascript?
            – pr0cat
            Nov 23 at 9:48










          • @pr0cat I have this little utility app called AS2Shell.app which converts AppleScript to a shell script which can be run in the Terminal. I will add that conversion for you to my answer to your post
            – wch1zpink
            Nov 23 at 17:08











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427819%2fterminal-osascript-automatically-hide-and-show-menu-bar%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          This AppleScript code should work for you



          if application "System Preferences" is running then quit application "System Preferences"
          repeat until application "System Preferences" is not running
          delay 0.1
          end repeat
          tell application "System Preferences" to reveal pane id "com.apple.preference.general"

          tell application "System Events" to tell process "System Preferences" to tell window "General"
          repeat while not (exists of checkbox "Automatically hide and show the menu bar")
          delay 0.1
          end repeat
          click checkbox "Automatically hide and show the menu bar"
          end tell

          quit application "System Preferences"






          As per the request from a comment to my answer for the original post, this following code is a conversion from AppleScript to shell script… and can be run in the Terminal.app and should produce the same results



          printf 'aWYgYXBwbGljYXRpb24gIlN5c3RlbSBQcmVmZXJlbmNlc
          yIgaXMgcnVubmluZyB0aGVuIHF1aXQgYXBwbGljYXRpb24gIlN5c3RlbSBQcmVmZ
          XJlbmNlcyIKcmVwZWF0IHVudGlsIGFwcGxpY2F0aW9uICJTeXN0ZW0gUHJlZmVyZ
          W5jZXMiIGlzIG5vdCBydW5uaW5nCiAgICBkZWxheSAwLjEKZW5kIHJlcGVhdAp0Z
          WxsIGFwcGxpY2F0aW9uICJTeXN0ZW0gUHJlZmVyZW5jZXMiIHRvIHJldmVhbCBw
          YW5lIGlkICJjb20uYXBwbGUucHJlZmVyZW5jZS5nZW5lcmFsIgoKdGVsbCBhcHBsa
          WNhdGlvbiAiU3lzdGVtIEV2ZW50cyIgdG8gdGVsbCBwcm9jZXNzICJTeXN0ZW0gUH
          JlZmVyZW5jZXMiIHRvIHRlbGwgd2luZG93ICJHZW5lcmFsIgogICAgcmVwZWF0IH
          doaWxlIG5vdCAoZXhpc3RzIG9mIGNoZWNrYm94ICJBdXRvbWF0aWNhbGx5IGhp
          ZGUgYW5kIHNob3cgdGhlIG1lbnUgYmFyIikKICAgICAgICBkZWxheSAwLjEKICAgI
          GVuZCByZXBlYXQKICAgIGNsaWNrIGNoZWNrYm94ICJBdXRvbWF0aWNhbGx5IG
          hpZGUgYW5kIHNob3cgdGhlIG1lbnUgYmFyIgplbmQgdGVsbAoKcXVpdCBhcHBsa
          WNhdGlvbiAiU3lzdGVtIFByZWZlcmVuY2VzIiA='|base64 -D|osascript





          share|improve this answer























          • I let it run for like 5minutes, sadly nothing happened besides opening the system preferences and general tab. Edit: I got it working, by changing the System Language to "Enlgish" (had German)... Although when i convert the Checkbox Title to the German one, it doesnt check it. I guess the primary language has to be english? Is it a bug?
            – pr0cat
            Nov 23 at 9:37












          • Is it also possible to convert the applescript to terminal osascript?
            – pr0cat
            Nov 23 at 9:48










          • @pr0cat I have this little utility app called AS2Shell.app which converts AppleScript to a shell script which can be run in the Terminal. I will add that conversion for you to my answer to your post
            – wch1zpink
            Nov 23 at 17:08















          up vote
          1
          down vote



          accepted










          This AppleScript code should work for you



          if application "System Preferences" is running then quit application "System Preferences"
          repeat until application "System Preferences" is not running
          delay 0.1
          end repeat
          tell application "System Preferences" to reveal pane id "com.apple.preference.general"

          tell application "System Events" to tell process "System Preferences" to tell window "General"
          repeat while not (exists of checkbox "Automatically hide and show the menu bar")
          delay 0.1
          end repeat
          click checkbox "Automatically hide and show the menu bar"
          end tell

          quit application "System Preferences"






          As per the request from a comment to my answer for the original post, this following code is a conversion from AppleScript to shell script… and can be run in the Terminal.app and should produce the same results



          printf 'aWYgYXBwbGljYXRpb24gIlN5c3RlbSBQcmVmZXJlbmNlc
          yIgaXMgcnVubmluZyB0aGVuIHF1aXQgYXBwbGljYXRpb24gIlN5c3RlbSBQcmVmZ
          XJlbmNlcyIKcmVwZWF0IHVudGlsIGFwcGxpY2F0aW9uICJTeXN0ZW0gUHJlZmVyZ
          W5jZXMiIGlzIG5vdCBydW5uaW5nCiAgICBkZWxheSAwLjEKZW5kIHJlcGVhdAp0Z
          WxsIGFwcGxpY2F0aW9uICJTeXN0ZW0gUHJlZmVyZW5jZXMiIHRvIHJldmVhbCBw
          YW5lIGlkICJjb20uYXBwbGUucHJlZmVyZW5jZS5nZW5lcmFsIgoKdGVsbCBhcHBsa
          WNhdGlvbiAiU3lzdGVtIEV2ZW50cyIgdG8gdGVsbCBwcm9jZXNzICJTeXN0ZW0gUH
          JlZmVyZW5jZXMiIHRvIHRlbGwgd2luZG93ICJHZW5lcmFsIgogICAgcmVwZWF0IH
          doaWxlIG5vdCAoZXhpc3RzIG9mIGNoZWNrYm94ICJBdXRvbWF0aWNhbGx5IGhp
          ZGUgYW5kIHNob3cgdGhlIG1lbnUgYmFyIikKICAgICAgICBkZWxheSAwLjEKICAgI
          GVuZCByZXBlYXQKICAgIGNsaWNrIGNoZWNrYm94ICJBdXRvbWF0aWNhbGx5IG
          hpZGUgYW5kIHNob3cgdGhlIG1lbnUgYmFyIgplbmQgdGVsbAoKcXVpdCBhcHBsa
          WNhdGlvbiAiU3lzdGVtIFByZWZlcmVuY2VzIiA='|base64 -D|osascript





          share|improve this answer























          • I let it run for like 5minutes, sadly nothing happened besides opening the system preferences and general tab. Edit: I got it working, by changing the System Language to "Enlgish" (had German)... Although when i convert the Checkbox Title to the German one, it doesnt check it. I guess the primary language has to be english? Is it a bug?
            – pr0cat
            Nov 23 at 9:37












          • Is it also possible to convert the applescript to terminal osascript?
            – pr0cat
            Nov 23 at 9:48










          • @pr0cat I have this little utility app called AS2Shell.app which converts AppleScript to a shell script which can be run in the Terminal. I will add that conversion for you to my answer to your post
            – wch1zpink
            Nov 23 at 17:08













          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          This AppleScript code should work for you



          if application "System Preferences" is running then quit application "System Preferences"
          repeat until application "System Preferences" is not running
          delay 0.1
          end repeat
          tell application "System Preferences" to reveal pane id "com.apple.preference.general"

          tell application "System Events" to tell process "System Preferences" to tell window "General"
          repeat while not (exists of checkbox "Automatically hide and show the menu bar")
          delay 0.1
          end repeat
          click checkbox "Automatically hide and show the menu bar"
          end tell

          quit application "System Preferences"






          As per the request from a comment to my answer for the original post, this following code is a conversion from AppleScript to shell script… and can be run in the Terminal.app and should produce the same results



          printf 'aWYgYXBwbGljYXRpb24gIlN5c3RlbSBQcmVmZXJlbmNlc
          yIgaXMgcnVubmluZyB0aGVuIHF1aXQgYXBwbGljYXRpb24gIlN5c3RlbSBQcmVmZ
          XJlbmNlcyIKcmVwZWF0IHVudGlsIGFwcGxpY2F0aW9uICJTeXN0ZW0gUHJlZmVyZ
          W5jZXMiIGlzIG5vdCBydW5uaW5nCiAgICBkZWxheSAwLjEKZW5kIHJlcGVhdAp0Z
          WxsIGFwcGxpY2F0aW9uICJTeXN0ZW0gUHJlZmVyZW5jZXMiIHRvIHJldmVhbCBw
          YW5lIGlkICJjb20uYXBwbGUucHJlZmVyZW5jZS5nZW5lcmFsIgoKdGVsbCBhcHBsa
          WNhdGlvbiAiU3lzdGVtIEV2ZW50cyIgdG8gdGVsbCBwcm9jZXNzICJTeXN0ZW0gUH
          JlZmVyZW5jZXMiIHRvIHRlbGwgd2luZG93ICJHZW5lcmFsIgogICAgcmVwZWF0IH
          doaWxlIG5vdCAoZXhpc3RzIG9mIGNoZWNrYm94ICJBdXRvbWF0aWNhbGx5IGhp
          ZGUgYW5kIHNob3cgdGhlIG1lbnUgYmFyIikKICAgICAgICBkZWxheSAwLjEKICAgI
          GVuZCByZXBlYXQKICAgIGNsaWNrIGNoZWNrYm94ICJBdXRvbWF0aWNhbGx5IG
          hpZGUgYW5kIHNob3cgdGhlIG1lbnUgYmFyIgplbmQgdGVsbAoKcXVpdCBhcHBsa
          WNhdGlvbiAiU3lzdGVtIFByZWZlcmVuY2VzIiA='|base64 -D|osascript





          share|improve this answer














          This AppleScript code should work for you



          if application "System Preferences" is running then quit application "System Preferences"
          repeat until application "System Preferences" is not running
          delay 0.1
          end repeat
          tell application "System Preferences" to reveal pane id "com.apple.preference.general"

          tell application "System Events" to tell process "System Preferences" to tell window "General"
          repeat while not (exists of checkbox "Automatically hide and show the menu bar")
          delay 0.1
          end repeat
          click checkbox "Automatically hide and show the menu bar"
          end tell

          quit application "System Preferences"






          As per the request from a comment to my answer for the original post, this following code is a conversion from AppleScript to shell script… and can be run in the Terminal.app and should produce the same results



          printf 'aWYgYXBwbGljYXRpb24gIlN5c3RlbSBQcmVmZXJlbmNlc
          yIgaXMgcnVubmluZyB0aGVuIHF1aXQgYXBwbGljYXRpb24gIlN5c3RlbSBQcmVmZ
          XJlbmNlcyIKcmVwZWF0IHVudGlsIGFwcGxpY2F0aW9uICJTeXN0ZW0gUHJlZmVyZ
          W5jZXMiIGlzIG5vdCBydW5uaW5nCiAgICBkZWxheSAwLjEKZW5kIHJlcGVhdAp0Z
          WxsIGFwcGxpY2F0aW9uICJTeXN0ZW0gUHJlZmVyZW5jZXMiIHRvIHJldmVhbCBw
          YW5lIGlkICJjb20uYXBwbGUucHJlZmVyZW5jZS5nZW5lcmFsIgoKdGVsbCBhcHBsa
          WNhdGlvbiAiU3lzdGVtIEV2ZW50cyIgdG8gdGVsbCBwcm9jZXNzICJTeXN0ZW0gUH
          JlZmVyZW5jZXMiIHRvIHRlbGwgd2luZG93ICJHZW5lcmFsIgogICAgcmVwZWF0IH
          doaWxlIG5vdCAoZXhpc3RzIG9mIGNoZWNrYm94ICJBdXRvbWF0aWNhbGx5IGhp
          ZGUgYW5kIHNob3cgdGhlIG1lbnUgYmFyIikKICAgICAgICBkZWxheSAwLjEKICAgI
          GVuZCByZXBlYXQKICAgIGNsaWNrIGNoZWNrYm94ICJBdXRvbWF0aWNhbGx5IG
          hpZGUgYW5kIHNob3cgdGhlIG1lbnUgYmFyIgplbmQgdGVsbAoKcXVpdCBhcHBsa
          WNhdGlvbiAiU3lzdGVtIFByZWZlcmVuY2VzIiA='|base64 -D|osascript






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 23 at 17:21

























          answered Nov 22 at 20:54









          wch1zpink

          1,0951414




          1,0951414












          • I let it run for like 5minutes, sadly nothing happened besides opening the system preferences and general tab. Edit: I got it working, by changing the System Language to "Enlgish" (had German)... Although when i convert the Checkbox Title to the German one, it doesnt check it. I guess the primary language has to be english? Is it a bug?
            – pr0cat
            Nov 23 at 9:37












          • Is it also possible to convert the applescript to terminal osascript?
            – pr0cat
            Nov 23 at 9:48










          • @pr0cat I have this little utility app called AS2Shell.app which converts AppleScript to a shell script which can be run in the Terminal. I will add that conversion for you to my answer to your post
            – wch1zpink
            Nov 23 at 17:08


















          • I let it run for like 5minutes, sadly nothing happened besides opening the system preferences and general tab. Edit: I got it working, by changing the System Language to "Enlgish" (had German)... Although when i convert the Checkbox Title to the German one, it doesnt check it. I guess the primary language has to be english? Is it a bug?
            – pr0cat
            Nov 23 at 9:37












          • Is it also possible to convert the applescript to terminal osascript?
            – pr0cat
            Nov 23 at 9:48










          • @pr0cat I have this little utility app called AS2Shell.app which converts AppleScript to a shell script which can be run in the Terminal. I will add that conversion for you to my answer to your post
            – wch1zpink
            Nov 23 at 17:08
















          I let it run for like 5minutes, sadly nothing happened besides opening the system preferences and general tab. Edit: I got it working, by changing the System Language to "Enlgish" (had German)... Although when i convert the Checkbox Title to the German one, it doesnt check it. I guess the primary language has to be english? Is it a bug?
          – pr0cat
          Nov 23 at 9:37






          I let it run for like 5minutes, sadly nothing happened besides opening the system preferences and general tab. Edit: I got it working, by changing the System Language to "Enlgish" (had German)... Although when i convert the Checkbox Title to the German one, it doesnt check it. I guess the primary language has to be english? Is it a bug?
          – pr0cat
          Nov 23 at 9:37














          Is it also possible to convert the applescript to terminal osascript?
          – pr0cat
          Nov 23 at 9:48




          Is it also possible to convert the applescript to terminal osascript?
          – pr0cat
          Nov 23 at 9:48












          @pr0cat I have this little utility app called AS2Shell.app which converts AppleScript to a shell script which can be run in the Terminal. I will add that conversion for you to my answer to your post
          – wch1zpink
          Nov 23 at 17:08




          @pr0cat I have this little utility app called AS2Shell.app which converts AppleScript to a shell script which can be run in the Terminal. I will add that conversion for you to my answer to your post
          – wch1zpink
          Nov 23 at 17:08


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427819%2fterminal-osascript-automatically-hide-and-show-menu-bar%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

          Calculate evaluation metrics using cross_val_predict sklearn

          Insert data from modal to MySQL (multiple modal on website)