Terminal/Osascript: Automatically hide and show menu bar












0















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



























    0















    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

























      0












      0








      0


      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 '18 at 9:36









      pr0catpr0cat

      535




      535
























          1 Answer
          1






          active

          oldest

          votes


















          1














          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 '18 at 9:37













          • Is it also possible to convert the applescript to terminal osascript?

            – pr0cat
            Nov 23 '18 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 '18 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',
          autoActivateHeartbeat: false,
          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









          1














          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 '18 at 9:37













          • Is it also possible to convert the applescript to terminal osascript?

            – pr0cat
            Nov 23 '18 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 '18 at 17:08
















          1














          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 '18 at 9:37













          • Is it also possible to convert the applescript to terminal osascript?

            – pr0cat
            Nov 23 '18 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 '18 at 17:08














          1












          1








          1







          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 '18 at 17:21

























          answered Nov 22 '18 at 20:54









          wch1zpinkwch1zpink

          1,2661414




          1,2661414













          • 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 '18 at 9:37













          • Is it also possible to convert the applescript to terminal osascript?

            – pr0cat
            Nov 23 '18 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 '18 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 '18 at 9:37













          • Is it also possible to convert the applescript to terminal osascript?

            – pr0cat
            Nov 23 '18 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 '18 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 '18 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 '18 at 9:37















          Is it also possible to convert the applescript to terminal osascript?

          – pr0cat
          Nov 23 '18 at 9:48





          Is it also possible to convert the applescript to terminal osascript?

          – pr0cat
          Nov 23 '18 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 '18 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 '18 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.




          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

          'app-layout' is not a known element: how to share Component with different Modules

          android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

          WPF add header to Image with URL pettitions [duplicate]