Skip to content

Instantly share code, notes, and snippets.

@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 March 22, 2024 02:40
This lets you set up a pattern for arranging desktop icons, then generates an AppleScript for arranging desktop icons in that pattern.
use AppleScript version "2.5"
use scripting additions
use framework "Foundation"
use script "PrefsStorageLib" version "1.1.0"
set customLocation to ""
try
set pashuaLocation to getPashuaPath(customLocation)
set dialogConfiguration to my getDialogConfiguration(pashuaLocation)
@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