Skip to content

Instantly share code, notes, and snippets.

@midore
midore / gist:61328
Created February 10, 2009 09:39
dialog-lib, call.applescript:<http://gist.github.com/61329>
script scp_dialog
on cased given mytitle:t, message:m, button:b, myicon:i, givefter:g, type:type, ans:a, mylist:l
if type is "default" then default(t, m, b)
if type is "default_withicon" then default_withicon(t, m, b, i)
if type is "giveafter" then giveafter(t, m, b, i, g)
if type is "inputtext" then inputtext(t, m, b, a)
if type is "chooselist" then chooselist(t, m, l)
end cased
@midore
midore / gist:61329
Created February 10, 2009 09:40
applescript, dialog-lib <http://gist.github.com/61328>
script call_scp
on load_lib_file(f)
# load "dialog.scpt" as object
load script (alias f)
end load_lib_file
on path_lib_dialog()
# path to "dialog.scpt" of current directory
tell application "Finder"
set pstr to (path to me) as alias
OS X リソースフォークを削除する
# for AppleScript at github
About file.applescrit
file.applescrpt は AppleScript で書かれたコンパイル以前のテキストファイル。
file.scpt はコンパイル済みファイル。
github にfile.scpt を push するとブラウジングできない。従って file.applescrpt を
push することになる。file.applescrpt を push する場合の利点について考えてみると。。。
仮に、AppleScript Version が異なるマシンにコピーされた時、コンパイルが通るか通らない
# coding: utf-8
# --------------------
# backup.rb
# Ruby 1.8.7 Mac OS X 10.6.7
# --------------------
require 'pathname'
module HomeDir
def selectfiles
#---------------------------------------------------------------------
# General user
#---------------------------------------------------------------------
myid=`id -u`
myd=`date "+%Y-%m-%d-%H-%M"`
#-------------------------
# Defaults write
#-------------------------
# Admin User
#-------------------------
myd=`date "+%Y-%m-%d-%H-%M-%S"`
# ovverride.plist
#-------------------------
sudo cat /var/db/launchd.db/com.apple.launchd/overrides.plist > ~/$myd-root-ovverrides.txt
sudo lsof -i > ~/$myd-root-lsof.txt
# blued
@midore
midore / mybridge.rb
Created November 20, 2011 01:24
practice macruby
framework "ScriptingBridge"
module MyBridge
class ITunes
attr_reader :lib, :lib_music
def initialize
@i = SBApplication.applicationWithBundleIdentifier("com.apple.iTunes")
@lib = @i.sources[0].libraryPlaylists[0]
@lib_music = @playlist = @i.sources[0].userPlaylists[0]
end
@midore
midore / remove-same-song.rb
Created November 21, 2011 10:37
remove filetracks
framework "ScriptingBridge"
# https://gist.github.com/1382271
module MyBridge
class RemoveSameSong
def initialize
i = SBApplication.applicationWithBundleIdentifier("com.apple.iTunes")
i.run
@filetracks = i.sources[0].userPlaylists[0].fileTracks
@h = Hash.new
# shutdown.scpt
#
# Mac OS X Lion 10.7.2
# AppleScript's version
# => "2.2.1"
# application "Finder"'s version
# => "10.7.1"
## https://gist.github.com/1382281
@midore
midore / disable-bluetooth.sh
Created October 11, 2012 03:49
disable-bluetooth
#!/bin/bash
# disable bluetooth
# OS X 10.8.2
# 2012-10-08
home=$HOME
bk=$home/backup-bluetooth-extentions
mkdir $bk