old_contents:
on run argv
	tell application "iTunes"
		set p to first item of argv
		set a to (p as POSIX file)
		add a to playlist (second item of argv)
	end tell
end run

new_contents:
on run argv
	set posixFile to first item of argv
	set playlistName to second item of argv

	tell application "iTunes"
		set p to posixFile
		set a to (p as POSIX file)
		add a to playlist playlistName
	end tell
end run

subject: Add explanation of arguments in AppleScript scripts

license: mit

repos: bogem/nehm


old_contents:
-- execute_iterm.scpt
-- last change: 19 Jan 2013
---
-- this script require an argument that represent the command to execute

on run argv

    set command to (item 1 of argv)

    tell application "iTerm"

        try
            set mysession to current session of current terminal
        on error
            set myterm to (make new terminal)
            tell myterm
                launch session "Default"
                set mysession to current session
            end tell
        end try

        -- execute the command
        tell mysession
            write text command
        end tell

    end tell

end run

new_contents:
-- execute_iterm.scpt
-- last change: 19 Jan 2013
---
-- this script require an argument that represent the command to execute

on run argv

    set command to (item 1 of argv)

    tell application "iTerm"

        try
            set mysession to current session of current terminal
        on error
            set myterm to (make new terminal)
            tell myterm
                launch session "rspec"
                set mysession to current session
            end tell
        end try

        -- execute the command
        tell mysession
            write text command
        end tell

    end tell

end run

subject: Change session name to 'rspec'

message: Change session name to 'rspec'


old_contents:
tell application "Spotify"
  set cstate to "{"
  set cstate to cstate & "\"track_id\": \"" & current track's id & "\""
  set cstate to cstate & ",\"volume\": " & sound volume
  set cstate to cstate & ",\"position\": " & player position
  set cstate to cstate & ",\"state\": \"" & player state & "\""
  set cstate to cstate & "}"

  return cstate
end tell

new_contents:
on replace_chars(this_text, search_string, replacement_string)
  set AppleScript's text item delimiters to the search_string
  set the item_list to every text item of this_text
  set AppleScript's text item delimiters to the replacement_string
  set this_text to the item_list as string
  set AppleScript's text item delimiters to ""
  return this_text
end replace_chars

tell application "Spotify"
  -- force string coercion and locale format
  set position to "" & player position

  set cstate to "{"
  set cstate to cstate & "\"track_id\": \"" & current track's id & "\""
  set cstate to cstate & ",\"volume\": " & sound volume
  -- replace , with . when locale has , as decimal delimiter
  set cstate to cstate & ",\"position\": " & my replace_chars(position, ",", ".")
  set cstate to cstate & ",\"state\": \"" & player state & "\""
  set cstate to cstate & "}"

  return cstate
end tell

message:
Fix get state for locales that have commas as decimal delimiters

When your current set locale uses "," as decimal delimiter, AppleScript
will automatically use this when you convert the number to a string. This
will break the JSON parsing for the callback, as "," is invalid when not
in quotes.

repos: andrehaveman/spotify-node-applescript


old_contents:
on run
	tell application "BibDesk"
		try
			set alertResult to display alert ("Really remove all linked files and private notes from " & name of first document as string) & "?" buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel" as warning

			if button returned of alertResult is "OK" then
				save first document in "Filtered " & (name of first document as string) & ".bib"
				repeat with thePub in first document's publications
					set thePub's note to my splitNote(thePub's note)
					repeat with theFile in thePub's linked files
						remove theFile from thePub
					end repeat
				end repeat
				save first document
			end if
		on error -128
			display dialog "User cancelled."
		end try
	end tell
end run

to splitNote(theNoteText)
	try
		set oldDelims to AppleScript's text item delimiters
		set AppleScript's text item delimiters to {"---"}

		set theParts to every text item of theNoteText

		if length of theParts is greater than 1 then
			set outText to text 2 through end of last item of theParts
		else
			set outText to ""
		end if
		set AppleScript's text item delimiters to oldDelims
	on error
		set AppleScript's text item delimiters to oldDelims
	end try
	return outText
end splitNote

new_contents:
on run
	tell application "BibDesk"
		try
			set alertResult to display alert ("Really remove all linked files and private notes from " & name of first document as string) & "?" buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel" as warning

			if button returned of alertResult is "OK" then
				set theDocument to first document

				save theDocument

				set theFile to (theDocument's file) as alias

				tell application "Finder"
					set theContainer to (container of theFile) as alias
					set newFile to make new file with properties {container:theFile, name:"Filtered " & ((name of theDocument) as string)}
				end tell
				return

				save first document in (newFile as file)
				repeat with thePub in first document's publications
					set thePub's note to my splitNote(thePub's note)
					repeat with theFile in thePub's linked files
						remove theFile from thePub
					end repeat
				end repeat
				save first document
			end if
		on error -128
			display dialog "User cancelled."
		end try
	end tell
end run

to splitNote(theNoteText)
	try
		set oldDelims to AppleScript's text item delimiters
		set AppleScript's text item delimiters to {"---"}

		set theParts to every text item of theNoteText

		if length of theParts is greater than 1 then
			set outText to (text 2 through end) of last item of theParts
		else
			set outText to ""
		end if
		set AppleScript's text item delimiters to oldDelims
	on error
		set AppleScript's text item delimiters to oldDelims
	end try
	return outText
end splitNote

subject: Simplify filterer code so it actually works.

repos: kurtraschke/htmlbib,kurtraschke/htmlbib


old_contents:
-- execute_iterm.scpt
-- last change: 19 Jan 2013
---
-- this script require an argument that represent the command to execute

on run argv

    set command to (item 1 of argv)

    tell application "iTerm"

        try
            set mysession to current session of current terminal
        on error
            set myterm to (make new terminal)
            tell myterm
                launch session "rspec"
                set mysession to current session
            end tell
        end try

        -- execute the command
        tell mysession
            write text command
        end tell

    end tell

end run

new_contents:
-- execute_iterm.scpt
-- last change: 19 Jan 2013
---
-- this script require an argument that represent the command to execute

on run argv

    set command to (item 1 of argv)
    tell application "iTerm"
      repeat with _terminal in terminals
        repeat with _session in (every session of _terminal whose name contains "rspec")
          tell the _session
            write text command
          end tell
        end repeat
      end repeat
    end tell
end run

subject: Change script for rspec command only

message: Change script for rspec command only


old_contents:
# AppleScript folder action for the pdfmatch command
#
# Open with script editor, compile and save to
# ~/Library/Workflows/Applications/Folder\ Actions/
#
# Then open the "Folder Actions Setup" application and add the work folder
# where your pdfmatch.json config lives and attach this script.
#
on adding folder items to this_folder after receiving these_files
	try
		repeat with each_file in these_files
			tell application "System Events"
				if name extension of each_file is "pdf" or "tif" or "tiff" or "jpeg" or "jpg" then
					# You might need to add your node binary to your $PATH. For example:
					# export PATH=/usr/local/bin:/usr/local/opt/node@6/bin:$PATH
					set output to (do shell script "export PATH=/usr/local/bin:/usr/local/opt/node@6/bin:$PATH && cd '" & POSIX path of this_folder & "' && pdfmatch '" & POSIX path of each_file & "' --delete 2>&1")
					#display alert output
				end if
			end tell
		end repeat
	on error err_string number error_number
		display alert "Error " & error_number & ": " & err_string
	end try
end adding folder items to

new_contents:
# AppleScript folder action for the pdfmatch command
#
# Open with script editor, compile and save to
# ~/Library/Workflows/Applications/Folder\ Actions/
#
# Then open the "Folder Actions Setup" application and add the work folder
# where your pdfmatch.json config lives and attach this script.
#
on adding folder items to this_folder after receiving these_files
	try
		repeat with each_file in these_files
			tell application "System Events"
				if name extension of each_file is "pdf" or "tif" or "tiff" or "jpeg" or "jpg" then
					# You might need to add your node binary to your $PATH. For example:
					# export PATH=/usr/local/bin:/usr/local/opt/node@6/bin:$PATH
					set output to (do shell script "cd '" & POSIX path of this_folder & "' && pdfmatch '" & POSIX path of each_file & "' --delete 2>&1")
					#display alert output
				end if
			end tell
		end repeat
	on error err_string number error_number
		display alert "Error " & error_number & ": " & err_string
	end try
end adding folder items to

subject: Remove my $PATH setting from default apple script


old_contents:
-- clears workflow cache, including album artwork and compiled scripts --

on loadConfig()
	return (load script POSIX file (do shell script "./resources/compile-config.sh"))
end loadConfig

on run query
	set config to loadConfig()
	try
		tell application "Finder"
			delete folder (workflowCacheFolder of config)
		end tell
	end try
end run

new_contents:
-- clears workflow cache, including album artwork and compiled scripts --

on loadConfig()
	return (load script POSIX file (do shell script "./resources/compile-config.sh"))
end loadConfig

on run query
	set config to loadConfig()
	try
		tell application "Finder"
			delete folder (workflowCacheFolder of config)
		end tell
		tell application "Music"
			delete user playlist (workflowPlaylistName of config)
		end tell
	end try
end run

message:
Delete Alfred Play Song playlist when clearing cache

This is becoming a helpful step when troubleshooting any issues.


old_contents:
set theFolder to POSIX path of ((the path to me as text) & "::")
set Controller to run script ("script s" & return & (read alias (POSIX file (theFolder & "/lib/controller.scpt")) as «class utf8») & return & "end script " & return & "return s")

set currentTrack to Controller's getCurrentSong()

set output to item 1 of currentTrack & " - " & item 2 of currentTrack

do shell script "echo " & quoted form of output

new_contents:
set theFolder to POSIX path of ((the path to me as text) & "::")
set Controller to run script ("script s" & return & (read alias (POSIX file (theFolder & "/lib/controller.scpt")) as «class utf8») & return & "end script " & return & "return s")

set currentTrack to Controller's getCurrentSong()

try
  set output to quoted form of (item 1 of currentTrack & " - " & item 2 of currentTrack)
on error
  set output to ""
end try

do shell script "echo " & output

subject: Set current song to empty string if nothing is playing

repos: atsuya/google-music-control


old_contents:
activate application "SystemUIServer"
tell application "System Events"
    tell process "SystemUIServer"
        set btMenu to (menu bar item 1 of menu bar 1 whose description contains "bluetooth")
        tell btMenu
            click
            try
                tell (menu item "Rosco's Headphones" of menu 1)
                    click
                    if exists menu item "Connect" of menu 1 then
                        click menu item "Connect" of menu 1
                        return "Connecting..."
                    else if exists menu item "Disconnect" of menu 1 then
                        click menu item "Disconnect" of menu 1
                        return "Disconnecting..."
                    end if
                end tell
            end try
        end tell
    end tell
    key code 53
    return "Device not found or Bluetooth turned off"
end tell

new_contents:
-- Source: https://www.reddit.com/r/MacOS/comments/i4czgu/big_sur_airpods_script/gck3gz3
-- Works on macOS 11 Big Sur

use framework "IOBluetooth"
use scripting additions

set DeviceName to "Rosco's Headphones"

on getFirstMatchingDevice(deviceName)
    repeat with device in (current application's IOBluetoothDevice's pairedDevices() as list)
        if (device's nameOrAddress as string) contains deviceName then return device
    end repeat
end getFirstMatchingDevice

on toggleDevice(device)
    if not (device's isConnected as boolean) then
        device's openConnection()
        return "Connecting " & (device's nameOrAddress as string)
    else
        device's closeConnection()
        return "Disconnecting " & (device's nameOrAddress as string)
    end if
end toggleDevice

return toggleDevice(getFirstMatchingDevice(DeviceName))

subject: Update headphone connect script for Big Sur

repos: rkalis/dotfiles,rkalis/dotfiles


old_contents:
-- plays selected song or playlist directly (the Play Song v1 behavior)
-- for songs, this behavior continues playing music after the song finishes

on loadConfig()
	return (load script POSIX file (do shell script "./resources/compile-config.sh"))
end loadConfig

on run query
	set config to loadConfig()

	set typeAndId to parseResultQuery(query as text) of config
	set theType to type of typeAndId
	set theId to id of typeAndId

	tell application "iTunes"

		if theType is "song" then

			set theSong to getSong(theId) of config
			play theSong

		else if theType is "playlist" then

			set thePlaylist to getPlaylist(theId) of config
			play thePlaylist

		else

			log "Unknown type: " & theType

		end if

	end tell
end run

new_contents:
-- plays selected song or playlist directly (the Play Song v1 behavior)
-- for songs, this behavior continues playing music after the song finishes

on loadConfig()
	return (load script POSIX file (do shell script "./resources/compile-config.sh"))
end loadConfig

on run query
	set config to loadConfig()

	set typeAndId to parseResultQuery(query as text) of config
	set theType to type of typeAndId
	set theId to id of typeAndId

	tell application "iTunes"

		if theType is "song" then

			set theSong to getSong(theId) of config
			play theSong

		else if theType ends with "playlist" then

			set thePlaylist to getPlaylist(theId) of config
			play thePlaylist

		else

			log "Unknown type: " & theType

		end if

	end tell
end run

message:
Fix bug where Apple Music playlists could not be played

The bug in question was a regression introduced in c309730.


old_contents:
-- This Applescript changes all of the icon labels on the disk image to
--  a different color.
-- Usage: osascript set-labels.applescript <volume-name>
-- where <volume-name> is the volume name of the disk image.

on run argv
	tell application "Finder"
		set diskname to item 1 of argv
		set file_list to every file in disk diskname
		repeat with i in file_list
			if the name of i is "Applications" then
				set the position of i to {368, 135}
			else if the name of i ends with ".app" then
				set the position of i to {134, 135}
			end if
		-- The magic happens here: This will set the label color of
		--  the file icon. Change the 7 to change the color: 0 is no
		--  label, then red, orange, yellow, green, blue, purple, or gray.
			set the label index of i to 7
		end repeat
	end tell
end run

new_contents:
-- This Applescript changes all of the icon labels on the disk image to
--  a different color.
-- Usage: osascript set-labels.applescript <volume-name>
-- where <volume-name> is the volume name of the disk image.

on run argv
	tell application "Finder"
		set diskname to item 1 of argv
		tell disk diskname
			set file_list to every file
			repeat with i in file_list
				if the name of i is "Applications" then
					set the position of i to {368, 135}
				else if the name of i ends with ".app" then
					set the position of i to {134, 135}
				end if
			-- The magic happens here: This will set the label color of
			--  the file icon. Change the 7 to change the color: 0 is no
			--  label, then red, orange, yellow, green, blue, purple, or gray.
				set the label index of i to 7
			end repeat
			update without registering applications
			delay 4
		end tell
	end tell
end run

subject: Make Mac disk image packager set application icon location more reliably.


old_contents:
on run {input}
  try
    do shell script "$HOME/Dropbox\\ \\(Personal\\)/projects/plover-tools/plover-dictionary-lookup/dictlook -x " & "\"" & input & "\""
    display dialog result buttons {"OK"} default button 1
  on error
    display dialog "No such luck." buttons {"OK"} default button 1
    beep
  end try
end run

new_contents:
on run {input}
  try
    do shell script "$HOME/Dropbox\\ \\(Personal\\)/projects/plover-tools/plover-dictionary-lookup/dictlook -x " & "\"" & input & "\""
    display dialog result default answer "" buttons {"OK"} default button 1
  on error
    display dialog "No such luck." buttons {"OK"} default button 1
    beep
  end try
end run

subject: Add practice text area to lookup dialog

message: Add practice text area to lookup dialog

license: unlicense

repos: dimonster/plover-dictionary-lookup


old_contents:
set close_vagrant to "z puppet; git pull; vagrant halt -f;"

-- close vagrant
tell application "iTerm"
	activate
	set myterm to (make new terminal)
	tell myterm
		launch session "Default"
		set mysession to current session
	end tell

	tell mysession
		write text close_vagrant
	end tell

	delay 5
end tell

-- quit iTerm
ignoring application responses
	tell application "iTerm"
		quit
	end tell
end ignoring

delay 2
tell application "System Events" to keystroke return

new_contents:
set close_vagrant to "z puppet; vagrant halt -f;"

-- close vagrant
tell application "iTerm"
	activate
	set myterm to (make new terminal)
	tell myterm
		launch session "Default"
		set mysession to current session
	end tell

	tell mysession
		write text close_vagrant
	end tell

	delay 5
end tell

-- quit iTerm
ignoring application responses
	tell application "iTerm"
		quit
	end tell
end ignoring

delay 2
tell application "System Events" to keystroke return

subject: Remove git pull from closing Vagrant

message: Remove git pull from closing Vagrant

repos: smathson/dotfiles


old_contents:
set myTabs to {"http://app.getsentry.com/", "http://app.ubervu.com/", "http://github.com/uberVU/thehole/issues/assigned/palcu?direction=desc&labels=&milestone=&page=1&sort=updated&state=open/", "https://mail.google.com/mail/u/1/?shva=1#inbox", "https://drive.google.com/a/ubervu.com/#folders/0BzycGIkC5P50TXBlcTZoRXZ5VUE"}
tell application "Google Chrome"
	activate
	repeat with i in myTabs
		open location i
	end repeat
end tell

new_contents:
set myTabs to {"http://app.getsentry.com/", "http://github.com/uberVU/thehole/issues/assigned/palcu?direction=desc&labels=&milestone=&page=1&sort=updated&state=open/", "https://mail.google.com/mail/u/1/?shva=1#inbox", "https://drive.google.com/a/hootsuite.com/#folders/0BwuFsHJDxJWPYmxXQ1VQVlN6T2M"}
tell application "Google Chrome"
	activate
	repeat with i in myTabs
		open location i
	end repeat
end tell

subject: Change tabs to open at work

message: Change tabs to open at work


old_contents:
set broker to "h8.opera.com"
set workers to {"h6.opera.com", "h8.opera.com", "h9.opera.com", "h10.opera.com"}
tell application "iTerm"
    activate
    set myterm to (make new terminal)
    tell myterm
        set number of columns to 80
        set number of rows to 50
        repeat with workerhost in workers
            set worker to (make new session at the end of sessions)
            tell worker
                set name to workerhost
                set foreground color to "white"
                set background color to "black"
                set transparency to 0.1
                exec command "/bin/sh -i"
                write text "ssh root@" & workerhost & " 'tail -f /var/log/celeryd.log'"
            end tell
        end repeat
        set rabbit to (make new session at the end of sessions)
        tell rabbit
            set name to "rabbit.log"
            set foreground color to "white"
            set background color to "black"
            set transparency to 0.1
            exec command "/bin/sh -i"
            write text "ssh root@" & broker & " 'tail -f /var/log/rabbitmq/rabbit.log'"
        end tell
        tell the first session
            activate
        end tell
    end tell
end tell

new_contents:
set broker to "h8.opera.com"
set workers to {"h6.opera.com", "h8.opera.com", "h9.opera.com", "h10.opera.com"}
set clock to "h6.opera.com"
tell application "iTerm"
    activate
    set myterm to (make new terminal)
    tell myterm
        set number of columns to 80
        set number of rows to 50
        repeat with workerhost in workers
            set worker to (make new session at the end of sessions)
            tell worker
                set name to workerhost
                set foreground color to "white"
                set background color to "black"
                set transparency to 0.1
                exec command "/bin/sh -i"
                write text "ssh root@" & workerhost & " 'tail -f /var/log/celeryd.log'"
            end tell
        end repeat
        set celerybeat to (make new session at the end of sessions)
        tell celerybeat
            set name to "celerybeat.log"
            set foreground color to "white"
            set background color to "black"
            set transparency to 0.1
            exec command "/bin/sh -i"
            write text "ssh root@" & clock & " 'tail -f /var/log/celerybeat.log'"
        end tell
        set rabbit to (make new session at the end of sessions)
        tell rabbit
            set name to "rabbit.log"
            set foreground color to "white"
            set background color to "black"
            set transparency to 0.1
            exec command "/bin/sh -i"
            write text "ssh root@" & broker & " 'tail -f /var/log/rabbitmq/rabbit.log'"
        end tell
        tell the first session
            activate
        end tell
    end tell
end tell

subject: Update the watch workers applescript to watch the celerybeat log file.


old_contents:
(*
  Script object to make calling a defined function easier while in the
  iTunes and System Events name space.
*)
script remoteSpeakerFinder
  -- Given a list of buttons, find the remote speakers button
  -- by finding the first button with a name that isn't in a
  -- rejection list.
  on findCorrectButton (in_buttons)
    set buttons_to_skip to {"Burn Disc"}

    repeat with a_button in in_buttons
      try -- some buttons don't have names
        set the_name to name of a_button
        if buttons_to_skip does not contain {the_name} then
          return the_name
        end if
      end try
    end repeat

    return 16 -- default response
  end findCorrectButton
end script

(*
  Tell iTunes to use the "Mobile" set of remote speakers.
*)
tell application "System Events"
  tell process "iTunes"
     set the_buttons to (get buttons of window 1)
     set the_speaker_button to (remoteSpeakerFinder's findCorrectButton(the_buttons))

     -- Switch to the speakers in my bedroom
     set frontmost to true
     click button the_speaker_button of window 1
     key code 115                -- Home Key (first speaker in list)
     key code 125                -- Down Arrow
     key code 125                -- Down Arrow
     key code 36                 -- Return Key
  end tell
end tell

new_contents:
(*
  Script object to make calling a defined function easier while in the
  iTunes and System Events name space.
*)
script remoteSpeakerFinder
  -- Given a list of buttons, find the remote speakers button
  -- by finding the first button with a name that isn't in a
  -- rejection list.
  on findCorrectButton (in_buttons)
    set buttons_to_skip to {"Burn Disc"}

    repeat with a_button in in_buttons
      try -- some buttons don't have names
        set the_name to name of a_button
        if buttons_to_skip does not contain {the_name} then
          return the_name
        end if
      end try
    end repeat

    return 16 -- default response
  end findCorrectButton
end script

(*
  Tell iTunes to use the "Mobile" set of remote speakers.
*)
tell application "System Events"
  tell process "iTunes"
     set the_buttons to (get buttons of window 1)
     set the_speaker_button to (remoteSpeakerFinder's findCorrectButton(the_buttons))

     -- Switch to the speakers in my bedroom
     set frontmost to true
     click button the_speaker_button of window 1
     key code 115                -- Home Key (first speaker in list)
     key code 125                -- Down Arrow
     key code 125                -- Down Arrow
     key code 36                 -- Return Key

     -- Wait for iTunes to connect to the speakers
     delay 5
  end tell
end tell

subject: Work around an issue with iTunes 9 that causes it to delay a connection to remote speakers

repos: pjones/emacsrc


old_contents:
set myTabs to {"http://app.getsentry.com/", "http://github.com/uberVU/thehole/issues/assigned/palcu?direction=desc&labels=&milestone=&page=1&sort=updated&state=open/", "https://mail.google.com/mail/u/1/?shva=1#inbox", "https://drive.google.com/a/hootsuite.com/#folders/0BwuFsHJDxJWPYmxXQ1VQVlN6T2M"}
tell application "Google Chrome"
	activate
	repeat with i in myTabs
		open location i
	end repeat
end tell

new_contents:
set myTabs to {"https://github.com/search?utf8=%E2%9C%93&q=assignee%3Apalcu+state%3Aopen&type=Issues&ref=searchresults", "https://mail.google.com/mail/u/1/?shva=1#inbox", "https://drive.google.com/a/hootsuite.com/#folders/0BwuFsHJDxJWPYmxXQ1VQVlN6T2M"}
tell application "Google Chrome"
	activate
	repeat with i in myTabs
		open location i
	end repeat
end tell

subject: Update URLs that open at the office

message: Update URLs that open at the office


old_contents:
try
	get application id "com.stairways.keyboardmaestro.engine"
on error err_msg number err_num
	return "Keyboard Maestro not found. First install it and then use this workflow."
end try

tell application id "com.stairways.keyboardmaestro.engine"
	gethotkeys with asstring
end tell

new_contents:
try
	get application id "com.stairways.keyboardmaestro.engine"
on error err_msg number err_num
	return "Keyboard Maestro not found. First install it and then use this workflow."
end try

tell application id "com.stairways.keyboardmaestro.engine"
	gethotkeys with asstring and getall
end tell

subject: Update script to get ALL macros instead of just hotkeyed macros.


old_contents:
set open_vagrant to "z puppet; vagrant up;"

tell application "iTerm"
	activate
	try
		set mysession to current session of current terminal
	on error
		set myterm to (make new terminal)
		tell myterm
			launch session "Default"
			set mysession to current session
		end tell
	end try

	tell mysession
		write text open_vagrant
	end tell
end tell

new_contents:
set open_vagrant to "z puppet; vagrant up;"
set update_master to "/Users/alex/.homesick/repos/palcu/dotfiles/scripts/update_master.sh;"

tell application "iTerm"
	activate
	try
		set mysession to current session of current terminal
	on error
		set myterm to (make new terminal)
		tell myterm
			launch session "Default"
			set mysession to current session
		end tell
	end try

	tell mysession
        write text update_master
		write text open_vagrant
	end tell
end tell

subject: Add update script to open vagrant applescript