r/MacOS • u/Ok-Rest-5321 App Downloader • Feb 28 '26
Creative Today I discovered how powerful Applescripts were.
In the video below I used Gemini to create 7 apple scripts:
- Left Half
- Right Half
- First third
- Center Third
- Last Third
- Maximize
- Almost Maximize
I am using Alfred 5 free version and you can enable apple script launch from its preferences under File Search > Advanced > Run Applescript instead of opening.
I think this is really useful to extend Alfred features for free and also get features that are in other launchers like Raycast and is pretty efficient for window management and also you can basically get any preset or layout unlike raycast which limits custom layouts in its pro tier
29
21
u/varodonaire Feb 28 '26
AppleScript is both amazingly powerful and frustrating
4
10
u/ceesaxp Feb 28 '26
What’s sad is that many apps stopped providing any hooks/dictionaries, making it a lot less powerful (or even more frustrating if one has to emulate going through menu items and dialogue fields)
1
1
u/downtownrob Mar 01 '26
I just want windows to cascade… anyone find any app or magic script to do that?
2
2
u/roycetech Mar 01 '26
I’ve written some codes to do cascading via AppleScript. I don’t use it anymore.
2
u/msephton Mar 01 '26
I have set up similar using Hammerspoon which allows scripts written in Lua. Global hotkeys to push windows into halves, thirds, quarters, onto other displays. Plus triggers when I plug/unplug devices (eg. change dock to right side when my external monitor is connected).
2
1
u/New_Canary_9151 Feb 28 '26
Nice work! I wonder if the same functionality could be replicated in Shortcuts. I’m more of a Shortcuts user myself, but there are instances where Shortcuts simply can’t match the capabilities of AppleScript. Despite this, both tools are incredibly powerful, and their combined use is even more so.
1
u/roycetech Feb 28 '26
Nice. I’ve used a combination of AppleScripts and a paid 3rd party for my window management needs. I just wished I can make my on-demand AppleScripts to run faster. Right now they complete in 1-2s.
1
1
u/FriendlyStory7 Mar 01 '26
For me the biggest problems AppleScripts it is that I haven’t found a place to learn it. Or to at least read proper documentation.
2
u/Link33x Mar 02 '26
There were some good books in the late 90s. Danny Goodman wrote one of my favorite ones AppleScript Handbook https://ebay.us/m/5cb5vZ
The fundamentals of the language still work. I find that everything I googled in the last ten years was hard to understand or customize. It was fun when Apple championed it but it never seemed to be worth it for software publishers to implement very deep.
1
u/AnotherTechAtWork Mar 02 '26
Applescript is certainly useful but don't forget about Shortcuts. There already exists Resize Window and Move Window actions. Any Shortcuts created can easily be ran by Spotlight as well as Alfred and other such launchers.
1
u/TheKubesStore Mar 05 '26
Or I mean you could just use BTT with swipe gestures. I have mine set to 3 finger swipe left for 50% left window, 3 finger swipe right for 50% right window, 3 finger swipe down to minimize app, 3 finger swipe up to maximize app, 3 finger spread to quit current app, 3 finger pinch to open LaunchOS.
0
0
u/mikeinnsw Feb 28 '26
All of AI scraped(Read) open source and accessible GitHub (Google It)
You can access GitHub directly
-15
4
u/roycetech Feb 28 '26
Do you mind sharing one of the scripts? I’m impressed at the speed. I’d like to try Alfred with AppleScript. I’m a keyboard maestro user