Skip to content

Instantly share code, notes, and snippets.

@loshlee
loshlee / Make Executable.scpt
Created January 14, 2025 20:27
Add or remove executability for macOS AppleScript Droplet source (multiple items allowed)
on open the_items
my execabilify(the_items)
end open
on execabilify(fl)
repeat with i in fl
try
do shell script "chmod " & "755" & space & quoted form of POSIX path of i with administrator privileges
on error the error_message number the error_number
display dialog "Error: " & the error_number & ". " & the error_message buttons {"Cancel"} default button 1
@loshlee
loshlee / Create Video Excerpt.scpt
Last active January 13, 2025 05:03
AppleScript Droplet source to create a video excerpt from a dropped video file
property tmpfile : "/tmp/execme.command"
on open the_items
my build_archive(the_items)
end open
on build_archive(the_items)
set the_item to item 1 of the_items as alias
set _start to (text returned of (display dialog "Start time of preserved segment:" default answer "00:00:00"))
@loshlee
loshlee / MediainfoDrop.scpt
Last active July 31, 2024 21:54
This is the source for an AppleScript droplet that you can create yourself on a Mac using Script Editor to save the script as an application. (The rest of this description is included in a comment at the beginning of the script source.)
(*
This is the source for an AppleScript droplet that you can create yourself on a Mac using Script Editor to save the script as an application. It will use Terminal to return basic media info for a file that you drop onto its icon. Media-info must be installed on your Mac System, of course. It can be installed using Homebrew. This targets media-info as installed by Homebrew on a Silicon Mac system. You may find it necessary to change "/opt/homebrew/bin/mediainfo" to "/usr/local/bin/mediainfo" if you use it on an Intel Mac where Homebrew was used to install media-info. Important: Remember, to make the resulting document function as an AppleScript Droplet app, you must save the script as an Application using Script Editor.
*)
property temppath : "/private/tmp/"
property startnum : 0
property newline : ASCII character 10
property tmpfile : "/tmp/execme.command"
on open the_items
my mediaInfo(the_items)
@loshlee
loshlee / Desktop Wrap using Pashua.scpt
Last active August 22, 2026 23:54
This lets you set up a pattern for arranging desktop icons, then generates an AppleScript for arranging desktop icons in that pattern.
-- begin AppleScript
use AppleScript version "2.7"
use scripting additions
use framework "Foundation"
use prefsstoragelib : script "PrefsStorageLib"
set customLocation to ""
try
set pashuaLocation to getPashuaPath(customLocation)
@loshlee
loshlee / Sort and cat VOBs to desktop.applescript
Created May 9, 2023 00:36
Select VOBs from a ripped DVD's VIDEO_TS folder that comprise the title you want, drop it on the application saved from this script as source, and you'll have a single VOB concatenated and saved to your Desktop.
on run
display dialog "Drop some VOB files onto me to combine them into one mpeg file." buttons {"OK"} default button 1 with icon note giving up after 10
end run
on open itms
set y to itms
if y = {} then
display dialog "Please, choose files/folders before running this script..." buttons {"OK"} default button 1 with icon note giving up after 10
error number -128
else
@loshlee
loshlee / DVDBackup.applescript
Created May 8, 2023 23:56
Save the AppleScript as an Application using Script Editor to create a droppable AppleScript Application for backing up a DVD.
property temppath : "/private/tmp/"
property startnum : 0
property newline : ASCII character 10
property tmpfile : "/tmp/execme.command"
on open the_items
my build_DVD(the_items)
end open
on build_DVD(the_items)
@loshlee
loshlee / two-pass-detelecine-aggr-crop-mp4-out.applescript
Last active February 29, 2024 23:22
Mac AppleScript sources for passing options to and executing 'two-pass-transcode.rb' by Lisa Melton (https://github.com/lisamelton/more-video-transcoding).
## This AppleScript can be used to create a macOS application to pass options to and execute Lisa Melton's video transcoding Ruby script (two-pass-transcode.rb).
## It is configured with additional constructs for detelecine, aggressive cropping, and converting output to .mp4.
## (See https://github.com/lisamelton/more-video-transcoding)
use AppleScript version "2.5"
use scripting additions
property temppath : "/private/tmp/"
property tmpfile : "/tmp/execme.command"
@loshlee
loshlee / Slate Manager
Last active April 18, 2023 07:58
I use this AppleScript to launch Slate with the last used configuration, edit a slate configuration from a collection of .slate or .slate.js files using BBEdit (demo mode), or activate one of the collected configuration files in macOS. Slate is a souped up Window Manager (https://github.com/jigish/slate)
set default_settings to "# This is a sample .slate file.
# If no ~/.slate file exists, this is the file that will be used.
# Action summary
# ⌃⌥⌘0 - Show window locations for current screen
# ⌃⌥⌘1 - Move and resize front window to upper left corner
# ⌃⌥⌘2 - Move and resize front window to upper right corner
# ⌃⌥⌘3 - Move and resize front window to lower left corner
# ⌃⌥⌘4 - Move and resize front window to lower right corner
# ⌃⌘1 - Move and resize front window to left Half