Skip to content

Instantly share code, notes, and snippets.

View kevin-funderburg's full-sized avatar
😆

Kevin Funderburg kevin-funderburg

😆
View GitHub Profile
# initialization file (not found)
@kevin-funderburg
kevin-funderburg / insert-dynamic-handler-description.applescript
Last active May 17, 2019 01:11
Insert a dynamically made Script Debugger clipping at the beginning of the current handler to describe said handler.
(*
===============================================================================
Insert Dynamic Handler Description
===============================================================================
Version: 1.0 Updated: 05/16/19 19:31:26 CST
By: Kevin Funderburg
PURPOSE:
@kevin-funderburg
kevin-funderburg / monthly-cleanups.applescript
Last active May 16, 2019 02:58
Clean up old files in ~/Downloads or ~/Desktop.
(*
===============================================================================
Monthly Cleanup
===============================================================================
Version: 1.10 Updated: 05/15/19 21:48:10 CST
By: Kevin Funderburg
PURPOSE:
@kevin-funderburg
kevin-funderburg / safari-duplicate-tab.applescript
Created May 15, 2019 22:05
Duplicate current Safari tab.
tell application "Safari"
tell front window
set theURL to URL of current tab
set current tab to make new tab with properties {URL:theURL}
end tell
end tell
@kevin-funderburg
kevin-funderburg / mail-make-message-url.applescript
Created May 15, 2019 22:03
Very useful, makes a direct link to the current message.
use scripting additions
tell application "Mail"
set selectedMessages to selection
set theMessage to item 1 of selectedMessages
set messageid to message id of theMessage
set urlText to "message://" & "%3c" & messageid & "%3e"
set the clipboard to urlText
end tell
@kevin-funderburg
kevin-funderburg / close-document-without-saving.applescript
Created May 15, 2019 21:58
Close front document of front app without saving.
tell application "System Events" to set frontapp to name of first process whose frontmost is true
tell application frontapp
tell front document
close saving no
end tell
end tell
@kevin-funderburg
kevin-funderburg / close-document-with-saving.applescript
Created May 15, 2019 21:57
Close front document of front app with saving.
tell application "System Events" to set frontapp to name of first process whose frontmost is true
tell application frontapp
tell front document
close saving yes
end tell
end tell
@kevin-funderburg
kevin-funderburg / close-all-documents-without-saving.applescript
Created May 15, 2019 21:55
Close all documents of front app without saving.
tell application "System Events" to set frontapp to name of first process whose frontmost is true
tell application frontapp to close every document without saving
@kevin-funderburg
kevin-funderburg / close-all-documents-with-saving.applescript
Created May 15, 2019 21:52
Save and close all open documents of front app.
tell application "System Events" to set frontapp to name of first process whose frontmost is true
tell application frontapp to close every document with saving
@kevin-funderburg
kevin-funderburg / close-unsaved-documents-of-front-app.applescript
Created May 15, 2019 21:49
Closes all the un-saved documents of the front app.
-- Note: This works in all the apps I’ve tried it in, so there may be others it doesn't
tell application "System Events" to set frontapp to name of first process whose frontmost is true
tell application frontapp
activate
repeat with i from (count of documents) to 1 by -1
set thisDocument to document i
try
if path of (get properties of thisDocument) = missing value or name of thisDocument contains "Untitled" then