# Hide Desktop Icon
do shell script "defaults write com.apple.finder CreateDesktop -bool false;killall Finder"
# Auto Hide & Show MenuBar
tell application "System Preferences" to reveal the ¬
anchor named "main" of ¬
pane id "com.apple.preference.general"
tell application "System Events" to tell ¬
process "System Preferences" to tell ¬
window "general" to tell ¬
checkbox "Automatically hide and show the menu bar
" to ¬
perform action "AXPress"
quit application "System Preferences"
Chinese is my System Language,so I'm not gonna share my macro as exported files.
You may try this script in your own macro to make it work.
the only potential problem is “Automatically hide and show the menu bar”,which is translated by google from “自动隐藏和显示菜单栏”
Hi @suliveevil, since I avoid working with too many shortcuts, I have here again a possibility with a script.
The screenshot also includes date and time.
It's not from me, but here from the forum.
Thanks for sharing.
This macro is really awesome ! It takes far less time to work, great shell script.
I'm glad to use
do shell script "chflags -h hidden ~/Desktop/*"
rather than
defaults write com.apple.finder CreateDesktop -bool false;killall Finder
My macro is a little bit radical,which will hide your desktop and menubar(菜单栏) ,and it assume you set MenuBar Not AutoHide and the Dock AutoHide already.
Since I'm not very good with AppleScript, thanks all alone @Tom.
Thanks to KM you can very well merge single scripts to a macro and then you have to hide the docks and the menu bar too
The script to hide the menu bar is partly in a german macOS. Maybe there is someone here who can summarize this.
I merged my improvement with your code.
Now it is a full function AppleScript, just bind it to any trigger you want and run this AppleScript.
It will hide GUI scripting process, meanwhile you can do other things.
-- Clean ScreenCapture v1.1.0 - German
-- assume your default setting:Show Desktop Icon、MenuBar, AutoHideDock
-- Hide Desktop Icon
do shell script "chflags -h hidden ~/Desktop/*"
-- Toggle AutoHide MenuBar
tell application "System Preferences" to reveal the ¬
anchor named "main" of ¬
pane id "com.apple.preference.general"
tell application "System Events" to tell ¬
process "System Preferences" to tell ¬
window "Allgemein" to tell ¬
checkbox "Menüleiste automatisch ein- und ausblenden" to ¬
perform action "AXPress"
delay 0.2
-- use System Keyboard Shotcut:Shift + Command + 3
-- 1 Area screenshot,change key code 20 to 21(on Device it is 4) or 22(on Device it is 5)
-- 2 Capture Screenshot to Clipboard,add 【control down,】 in curly braces
tell application "System Events"
keystroke (key code 20 using {shift down, command down})
end tell
-- delay 10 seconds,you can change that at your wish
delay 10
-- Show Desktop Icon
do shell script "chflags -h nohidden ~/Desktop/*"
-- Toggle AutoHide MenuBar
tell application "System Preferences" to reveal the ¬
anchor named "main" of ¬
pane id "com.apple.preference.general"
tell application "System Events" to tell ¬
process "System Preferences" to tell ¬
window "Allgemein" to tell ¬
checkbox "Menüleiste automatisch ein- und ausblenden" to ¬
perform action "AXPress"
quit application "System Preferences"
Thank you so much for this great improvement
It works very well for me. Since I like to use the visible clipboard of the Yoink app for my screenshots, I changed the AppleScript a little bit.
This is how I use it: I created 6 macros to capture screen, because there are 6 system keyboard shortcuts.
A little bit silly silly but easy to remember simple to use:
Capture to file:
Shift+Control+3 to trigger macro in which keystroke system keyboard shortcut Shift+Command+3
Shift+Control+4 to trigger macro in which keystroke system keyboard shortcut Shift+Command+4
Shift+Control+5 to trigger macro in which keystroke system keyboard shortcut Shift+Command+5
Capture to Clipboard:
Shift+Control+Option+3 to trigger macro in which keystroke system keyboard shortcut Shift+Command+Option+3
Shift+Control+Option+4 to trigger macro in which keystroke system keyboard shortcut Shift+Command+Option+4
Shift+Control+Option+3 to trigger macro in which keystroke system keyboard shortcut Shift+Command+Option+5
If you wanna capture screen only with the frontmost app, you may try this:
-- System Keyboard Shortcut: Option+Command+H, Hide all apps but the frontmost app
tell application "System Events" to key code 4 using {option down, command down}