Before updating to macOS Catalina, which drops support for 32-bit apps, I'm exporting my spark scripts. I'm not sure whether spark will be available as 64-bit version. https://github.com/Jean-Daniel/Spark
Last active
February 17, 2020 23:13
-
-
Save fiedl/05b952649b2fd1a2149974cfbd772ef6 to your computer and use it in GitHub Desktop.
Before updating to Catalina, export spark scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do shell script "source /Users/fiedl/.zsh/oh-my-zsh-customization/plugins/fiedl/bin/lcars" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cmd+Option+L | |
tell application "System Events" to start current screen saver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
tell application "Finder" to set the this_folder ¬ | |
to (folder of the front window) as alias | |
on error -- no open folder windows | |
set the this_folder to path to desktop folder as alias | |
end try | |
set thefilename to "Neue Datei.md" | |
-- text returned of (display dialog "Create file named:" default answer "filename.txt") | |
set thefullpath to POSIX path of this_folder & thefilename | |
do shell script "touch \"" & thefullpath & "\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# F6 | |
# https://forum.keyboardmaestro.com/t/applescript-click-dock-item-and-trigger-a-menu-item/6773 | |
tell application "System Events" | |
tell application process "Dock" | |
tell list 1 | |
tell UI element "ScanSnap Manager" | |
perform action "AXShowMenu" | |
tell menu "ScanSnap Manager" | |
tell menu item "Duplex-Scan" | |
perform action "AXPress" | |
end tell | |
end tell | |
end tell | |
end tell | |
end tell | |
end tell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# F13 | |
# https://forum.keyboardmaestro.com/t/applescript-click-dock-item-and-trigger-a-menu-item/6773 | |
tell application "System Events" | |
tell application process "Dock" | |
tell list 1 | |
tell UI element "ScanSnap Manager" | |
perform action "AXShowMenu" | |
tell menu "ScanSnap Manager" | |
tell menu item "Simplex Scan" | |
perform action "AXPress" | |
end tell | |
end tell | |
end tell | |
end tell | |
end tell | |
end tell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set activeApp to (path to frontmost application as Unicode text) | |
tell application activeApp | |
# get current window width. | |
# the width will stay the same. we just recalculate the height | |
# of the window to match the 16:9 aspect ratio. | |
set window_bounds to the bounds of the first window | |
set x1 to item 1 of the window_bounds | |
set y1 to item 2 of the window_bounds | |
set x2 to item 3 of the window_bounds | |
set y2 to item 4 of the window_bounds | |
set window_width to (x2 - x1) | |
# calculate the new height. | |
set new_window_height to 9.0 / 16.0 * window_width | |
# set the window height. | |
set new_y2 to (new_window_height + y1) | |
set item 4 of the window_bounds to the new_y2 | |
set the bounds of the first window to the window_bounds | |
#{x, y, window_width, new_window_height} | |
#display dialog "width: " & window_width | |
#display dialog "new height: " & new_window_height | |
end tell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set activeApp to (path to frontmost application as Unicode text) | |
-- Screen Resolution | |
tell application "Finder" | |
set screenResolution to bounds of window of desktop | |
end tell | |
set screenWidth to item 3 of screenResolution | |
set screenHeight to item 4 of screenResolution | |
if (screenWidth > 2500) then | |
set numberOfPresets to 3 | |
else | |
set numberOfPresets to 2 | |
end if | |
if (screenWidth > 2560) then | |
-- dual monitor. just use the large one. | |
set screenWidth to 2560 | |
set numberOfPresets to 3 | |
end if | |
-- position preset counter | |
property positionPreset : 0 | |
set positionPreset to positionPreset + 1 | |
if positionPreset > numberOfPresets then | |
set positionPreset to 1 | |
end if | |
tell application activeApp | |
-- Window Position | |
set current_position to the bounds of the first window | |
set current_xposition to item 1 of current_position | |
activate | |
set goldenRatio to 0.618 | |
--set win to the first window | |
set win to the first window whose visible is true | |
-- External Display Display: 2560 | |
if screenWidth = 2560 then | |
-- Use 1/3 1/3 1/3 configuration. | |
if positionPreset is 2 then | |
set the bounds of win to {1 / 3 * screenWidth, 0, 2 / 3 * screenWidth, screenHeight} | |
else if positionPreset is 3 then | |
set the bounds of win to {2 / 3 * screenWidth, 0, 3 / 3 * screenWidth, screenHeight} | |
else if positionPreset is 1 then | |
set the bounds of win to {0 / 3 * screenWidth, 0, 1 / 3 * screenWidth, screenHeight} | |
end if | |
-- Retina 15 inch display | |
else | |
if positionPreset is 1 then | |
set the bounds of win to {goldenRatio * screenWidth, 0, screenWidth, screenHeight} | |
else if positionPreset is 2 then | |
set the bounds of win to {0, 0, goldenRatio * screenWidth, screenHeight} | |
end if | |
end if | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment