A macOS service for those Xcode wizards π§ who sometimes just want to take the easy road. Generates a quirky formatted string with your file name and selected code, copies it straight to your clipboard, and magically opens a specified website.β¨
- π Formatted String Generation: Pops out a string like:
ARE YOU LAZY? FILENAME: {{FILE_NAME_FROM_XCODE}} SOURCECODE: {{SELECTED_CODE}}
- π Copy to Clipboard: Whoosh! Your text is now on the clipboard.
- π Open Website: Auto-surfing to
https://lazy.peerasak.com
.
- Launch
Automator
on your beloved Mac. - Choose
File
>New
and pickQuick Action
. - Top right corner: Make sure it receives
selected text
from our friend,Xcode
. - Search (left bar) for our handy tool
Run AppleScript
and drag it over.
Paste this magical incantation into the Run AppleScript
box:
on run {input, parameters}
-- Seek the name of the current file in Xcode
set fileName to ""
tell application "Xcode"
set fileName to name of the first source document
end tell
if fileName is "" then
set fileName to "UNKNOWN FILE"
end if
set output to "ARE YOU LAZY?" & linefeed & "FILENAME: \"" & fileName & "\"" & linefeed & "SOURCECODE: " & linefeed & input
return output
end run
- Post-AppleScript, look for
Copy to Clipboard
and drag below. - Find
Run Shell Script
, drag belowCopy to Clipboard
and use this to ride the web waves:
open "https://lazy.peerasak.com"
- Stash the Automator service with a catchy name like "Lazy Coder Extravaganza".
- Fire up Xcode, snag some text in any file.
- Right-click, sail to
Services
, and there you'll spot "Lazy Coder Extravaganza". Give it a tap.
All set! Whenever you're in Xcode, and the laziness beckons, just snatch your source code, right-click, and hit "Lazy Coder Extravaganza" from Services. Your zany text is now on the clipboard, and you're surfing the web. Enjoy the ride! π’