Osascript/Applescript: Uncheck “Displays have separate Spaces”
Standard Configuration of Mojave 10.14 in Mission Control is, that "Displays use separate spaces" is checked.
I want it unchecked...
Is there a way to do this with applescript/osascript?
This is what i tried but its not clicking on the checkbox..
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.expose"
tell application "System Events" to tell process "System Preferences" to
tell window "Mission Control"
repeat while not (exists of checkbox "Displays have separate Spaces")
delay 0.1
end repeat
click checkbox "Displays have separate Spaces"
end tell
quit application "System Preferences"
bash terminal applescript osascript mission-control
add a comment |
Standard Configuration of Mojave 10.14 in Mission Control is, that "Displays use separate spaces" is checked.
I want it unchecked...
Is there a way to do this with applescript/osascript?
This is what i tried but its not clicking on the checkbox..
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.expose"
tell application "System Events" to tell process "System Preferences" to
tell window "Mission Control"
repeat while not (exists of checkbox "Displays have separate Spaces")
delay 0.1
end repeat
click checkbox "Displays have separate Spaces"
end tell
quit application "System Preferences"
bash terminal applescript osascript mission-control
1
Your code as posted has two linefeeds that shouldn't be there, and one causes a compile error while the other causes Script Editor to want to quit. After fixing that and running the code, it stays in therepeat while not ...
loop (on macOS High Sierra anyway) because the target checkbox is not directly under the window but a part of a group. Addingto tell group 2
toto tell window "Mission Control"
fixes it. Since I'm not running macOS Mojave yet, I can't confirm if this fixes it there too, but it gives you a direction to look.
– user3439894
Nov 23 '18 at 11:56
1
BTW Under macOS High Sierra it requires a logout for the change to take effect, not sure if it's still required in macOS Mojave.
– user3439894
Nov 23 '18 at 12:07
Thank you very much!!! It is working with "to tell window "Mission Control" to tell group 2". And yes, Mojave still requires a restart :) !!! You can post it as an answer if u want, so i can accept it
– pr0cat
Nov 23 '18 at 12:54
add a comment |
Standard Configuration of Mojave 10.14 in Mission Control is, that "Displays use separate spaces" is checked.
I want it unchecked...
Is there a way to do this with applescript/osascript?
This is what i tried but its not clicking on the checkbox..
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.expose"
tell application "System Events" to tell process "System Preferences" to
tell window "Mission Control"
repeat while not (exists of checkbox "Displays have separate Spaces")
delay 0.1
end repeat
click checkbox "Displays have separate Spaces"
end tell
quit application "System Preferences"
bash terminal applescript osascript mission-control
Standard Configuration of Mojave 10.14 in Mission Control is, that "Displays use separate spaces" is checked.
I want it unchecked...
Is there a way to do this with applescript/osascript?
This is what i tried but its not clicking on the checkbox..
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.expose"
tell application "System Events" to tell process "System Preferences" to
tell window "Mission Control"
repeat while not (exists of checkbox "Displays have separate Spaces")
delay 0.1
end repeat
click checkbox "Displays have separate Spaces"
end tell
quit application "System Preferences"
bash terminal applescript osascript mission-control
bash terminal applescript osascript mission-control
edited Nov 23 '18 at 11:26
pr0cat
asked Nov 23 '18 at 11:01
pr0catpr0cat
535
535
1
Your code as posted has two linefeeds that shouldn't be there, and one causes a compile error while the other causes Script Editor to want to quit. After fixing that and running the code, it stays in therepeat while not ...
loop (on macOS High Sierra anyway) because the target checkbox is not directly under the window but a part of a group. Addingto tell group 2
toto tell window "Mission Control"
fixes it. Since I'm not running macOS Mojave yet, I can't confirm if this fixes it there too, but it gives you a direction to look.
– user3439894
Nov 23 '18 at 11:56
1
BTW Under macOS High Sierra it requires a logout for the change to take effect, not sure if it's still required in macOS Mojave.
– user3439894
Nov 23 '18 at 12:07
Thank you very much!!! It is working with "to tell window "Mission Control" to tell group 2". And yes, Mojave still requires a restart :) !!! You can post it as an answer if u want, so i can accept it
– pr0cat
Nov 23 '18 at 12:54
add a comment |
1
Your code as posted has two linefeeds that shouldn't be there, and one causes a compile error while the other causes Script Editor to want to quit. After fixing that and running the code, it stays in therepeat while not ...
loop (on macOS High Sierra anyway) because the target checkbox is not directly under the window but a part of a group. Addingto tell group 2
toto tell window "Mission Control"
fixes it. Since I'm not running macOS Mojave yet, I can't confirm if this fixes it there too, but it gives you a direction to look.
– user3439894
Nov 23 '18 at 11:56
1
BTW Under macOS High Sierra it requires a logout for the change to take effect, not sure if it's still required in macOS Mojave.
– user3439894
Nov 23 '18 at 12:07
Thank you very much!!! It is working with "to tell window "Mission Control" to tell group 2". And yes, Mojave still requires a restart :) !!! You can post it as an answer if u want, so i can accept it
– pr0cat
Nov 23 '18 at 12:54
1
1
Your code as posted has two linefeeds that shouldn't be there, and one causes a compile error while the other causes Script Editor to want to quit. After fixing that and running the code, it stays in the
repeat while not ...
loop (on macOS High Sierra anyway) because the target checkbox is not directly under the window but a part of a group. Adding to tell group 2
to to tell window "Mission Control"
fixes it. Since I'm not running macOS Mojave yet, I can't confirm if this fixes it there too, but it gives you a direction to look.– user3439894
Nov 23 '18 at 11:56
Your code as posted has two linefeeds that shouldn't be there, and one causes a compile error while the other causes Script Editor to want to quit. After fixing that and running the code, it stays in the
repeat while not ...
loop (on macOS High Sierra anyway) because the target checkbox is not directly under the window but a part of a group. Adding to tell group 2
to to tell window "Mission Control"
fixes it. Since I'm not running macOS Mojave yet, I can't confirm if this fixes it there too, but it gives you a direction to look.– user3439894
Nov 23 '18 at 11:56
1
1
BTW Under macOS High Sierra it requires a logout for the change to take effect, not sure if it's still required in macOS Mojave.
– user3439894
Nov 23 '18 at 12:07
BTW Under macOS High Sierra it requires a logout for the change to take effect, not sure if it's still required in macOS Mojave.
– user3439894
Nov 23 '18 at 12:07
Thank you very much!!! It is working with "to tell window "Mission Control" to tell group 2". And yes, Mojave still requires a restart :) !!! You can post it as an answer if u want, so i can accept it
– pr0cat
Nov 23 '18 at 12:54
Thank you very much!!! It is working with "to tell window "Mission Control" to tell group 2". And yes, Mojave still requires a restart :) !!! You can post it as an answer if u want, so i can accept it
– pr0cat
Nov 23 '18 at 12:54
add a comment |
1 Answer
1
active
oldest
votes
When running your code, it stays in the repeat while not ...
loop because the target checkbox is not directly under the window but a part of a group.
Adding to tell group 2
to to tell window "Mission Control"
fixes it.
Change:
tell application "System Events" to tell process "System Preferences" to tell window "Mission Control"
To:
tell application "System Events" to tell process "System Preferences" to tell window "Mission Control" to tell group 2
Note: When checking/unchecking the Displays have separate Spaces checkbox, it requires a logout for the change to take effect.
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53445442%2fosascript-applescript-uncheck-displays-have-separate-spaces%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
When running your code, it stays in the repeat while not ...
loop because the target checkbox is not directly under the window but a part of a group.
Adding to tell group 2
to to tell window "Mission Control"
fixes it.
Change:
tell application "System Events" to tell process "System Preferences" to tell window "Mission Control"
To:
tell application "System Events" to tell process "System Preferences" to tell window "Mission Control" to tell group 2
Note: When checking/unchecking the Displays have separate Spaces checkbox, it requires a logout for the change to take effect.
add a comment |
When running your code, it stays in the repeat while not ...
loop because the target checkbox is not directly under the window but a part of a group.
Adding to tell group 2
to to tell window "Mission Control"
fixes it.
Change:
tell application "System Events" to tell process "System Preferences" to tell window "Mission Control"
To:
tell application "System Events" to tell process "System Preferences" to tell window "Mission Control" to tell group 2
Note: When checking/unchecking the Displays have separate Spaces checkbox, it requires a logout for the change to take effect.
add a comment |
When running your code, it stays in the repeat while not ...
loop because the target checkbox is not directly under the window but a part of a group.
Adding to tell group 2
to to tell window "Mission Control"
fixes it.
Change:
tell application "System Events" to tell process "System Preferences" to tell window "Mission Control"
To:
tell application "System Events" to tell process "System Preferences" to tell window "Mission Control" to tell group 2
Note: When checking/unchecking the Displays have separate Spaces checkbox, it requires a logout for the change to take effect.
When running your code, it stays in the repeat while not ...
loop because the target checkbox is not directly under the window but a part of a group.
Adding to tell group 2
to to tell window "Mission Control"
fixes it.
Change:
tell application "System Events" to tell process "System Preferences" to tell window "Mission Control"
To:
tell application "System Events" to tell process "System Preferences" to tell window "Mission Control" to tell group 2
Note: When checking/unchecking the Displays have separate Spaces checkbox, it requires a logout for the change to take effect.
answered Nov 23 '18 at 12:59
user3439894user3439894
1,7472919
1,7472919
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53445442%2fosascript-applescript-uncheck-displays-have-separate-spaces%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
Your code as posted has two linefeeds that shouldn't be there, and one causes a compile error while the other causes Script Editor to want to quit. After fixing that and running the code, it stays in the
repeat while not ...
loop (on macOS High Sierra anyway) because the target checkbox is not directly under the window but a part of a group. Addingto tell group 2
toto tell window "Mission Control"
fixes it. Since I'm not running macOS Mojave yet, I can't confirm if this fixes it there too, but it gives you a direction to look.– user3439894
Nov 23 '18 at 11:56
1
BTW Under macOS High Sierra it requires a logout for the change to take effect, not sure if it's still required in macOS Mojave.
– user3439894
Nov 23 '18 at 12:07
Thank you very much!!! It is working with "to tell window "Mission Control" to tell group 2". And yes, Mojave still requires a restart :) !!! You can post it as an answer if u want, so i can accept it
– pr0cat
Nov 23 '18 at 12:54