Skip to content

Instantly share code, notes, and snippets.

@markisatacomputer
markisatacomputer / backgroundz.scpt
Last active March 7, 2017 13:32
osx webcam 2 bg
on run argv
tell application "System Events"
set desktopCount to count of desktops
repeat with desktopNumber from 1 to desktopCount
tell desktop desktopNumber
set picture to item 1 of argv
end tell
end repeat
end tell
--beep
@paulera
paulera / fn-toggle.scpt
Last active April 19, 2021 19:58
Script to toggle the FN Lock state in MacOS.
# toggle-fn.scpt
#
# This AppleScript toggles the FN key state.
#
# To assign a keyboard shortcut (long story short):
# Export this AppleScript to an app (a service to just run the script won't have accessibility privileges)
# ----> In the script editor, go to File -> Export, change format to "Application" and save. It will create a .app file.
# When you try to run for the first time, it will ask for access to Accessibility control. Allow it.
# Create a service in Automator to open the app.
# Create a keyboard shortcut to run the service created in Automator.
@codingChewie
codingChewie / no-whitespace-files.scpt
Last active March 26, 2021 16:27
AppleScript that will replace whitespace with underscores in a file's name within a given directory
(*
Date: 16-12-14
Developer: codingChewie
Purpose: Takes filenames with whitespace and replaces with underscore in a directory
Version: 1.0
Name: no-whitespace-files.scpt
Site: http://programmingmonkeys.com/
*)
on no_whitespace(theFolder, scriptTitle)
@sloanlance
sloanlance / Toggle Hidden Files.scpt
Last active February 3, 2017 15:43
AppleScript: Toggle visibility of hidden files and folders in Finder
-- Place this in ~/Library/Scripts to make it available in the AppleScript menu.
do shell script ¬
(POSIX path of ((path to me as text) & "::")) ¬
& "toggleHiddenFiles.sh"
@taiyoslime
taiyoslime / nowplaying.scpt
Last active May 15, 2020 19:34
iTunesで再生されてる曲を取得するやつ(Mac)
#!/usr/bin/osascript -l JavaScript
app = Application("com.apple.iTunes");
name = app.currentTrack().name()
artist = app.currentTrack().artist()
album = app.currentTrack().album()
duration = app.currentTrack().duration()
sec = duration / 60 | 0
min = duration % 60 | 0
if(min < 10) min = "0" + min
result = `${name} - ${artist}/${album} [${sec}:${min}]`
@andergmartins
andergmartins / resize.scpt
Created November 17, 2016 00:57
Resize files to multiple sizes and move to folders with the same name of the source file
set image_ext_list to {"jpg", "jpeg", "png"}
set size_list to {"64", "48", "32", "24", "16"}
set source_path to (choose folder "Select the folder with the base images" without invisbles) as text
set dest_path to (choose folder "Select the destination folder" without invisbles) as text
with timeout of 86400 seconds
tell application "Finder"
set image_files to (files of entire contents of (source_path as alias) whose name extension is in image_ext_list) as alias list
end tell
end timeout
set _Path to "<<enter path to your script folder here>>"
set scriptLaunch to text returned of (display dialog "Enter name of script to run" default answer "" buttons "OK" default button "OK")
if scriptLaunch contains "" then
error number -128
else if scriptLaunch contains scriptLaunch then
try
set scriptRun to _Path & "/" & scriptLaunch & ".scpt"
run script scriptRun
on error
display alert "Your script failed to launch."
@vacharanon
vacharanon / togglefinder.scpt
Created October 8, 2016 03:57
AppleScript to show/hide all files
display dialog "Show all files?" buttons {"Show", "Hide", "Cancel"}
set result to button returned of result
if result is equal to "Show" then
do shell script "defaults write com.apple.finder AppleShowAllFiles -boolean true"
do shell script "killall Finder"
else if result is equal to "Hide" then
do shell script "defaults delete com.apple.finder AppleShowAllFiles"
do shell script "killall Finder"
end if
@lodestone
lodestone / alfred-pinboard-journey.adoc
Created October 1, 2016 19:32
My Alfred Pinboard Workflow Journey
@JScott
JScott / unxip.scpt
Created September 16, 2016 16:41
For unarchiving Apple's bad decisions
-- http://stackoverflow.com/questions/37812664/end-of-central-directory-signature-not-found-when-installing-xcode-8-beta-xip/37857162#37857162
on run argv
tell application "Archive Utility" to open POSIX path of (item 1 of argv)
repeat
delay 5
if application "Archive Utility" is not running then exit repeat
end repeat
end run