Consistent naming

Consistent naming

on newPresentation(themeName)
	tell application "Keynote"
		activate
		-- FIXME: Make this selectable?
		set targetWidth to 1024 -- 1440 <-- higher resolution
		set targetHeight to 768 -- 1080 <-- higher resolution

		set props to {document theme:theme (themeName as string), width:targetWidth, height:targetHeight}

		set thisDocument to make new document with properties props
		return id of thisDocument
	end tell
end newPresentation

on openPresentation(posixPath)
	tell application "Keynote"
		open posixPath
	end tell
end openPresentation

on savePresentation(docId, posixPath)
	tell application "Keynote"
		activate
        set theDocument to document id docId
		save theDocument in POSIX file posixPath
        delete theDocument
        open posixPath
	end tell
end savePresentation

on closePresentation(docId)
	tell application "Keynote"
		activate
        set theDocument to document id docId
		close theDocument
	end tell
end savePresentation

on createSlide(docId, masterSlideName)
	tell application "Keynote"
		tell document id docId
			set thisSlide to make new slide with properties {base slide:master slide masterSlideName}
		end tell
	end tell
end createSlide

on deleteAllSlides(docId)
	tell application "Keynote"
		tell document id docId to delete every slide
	end tell
end deleteAllSlides

on finalize(docId)
	tell application "Keynote"
		tell document id docId to delete slide 1
	end tell
end finalize

on themeMasters(docId)
	--	  tell application "Keynote" to get the name of every master slide of thisDocument
	tell application "Keynote"
		set names to the name of every master slide of document id docId
		return names
	end tell
end themeMasters

on addImage(docId, slideIndex, n, filepath)
  tell application "Keynote"
	tell slide slideIndex of document id docId
		-- TO REPLACE A PLACEHOLDER OR EXISTING IMAGE:
		set thisPlaceholderImageItem to image n
		-- change the value of the “file name” property of the image to be an HFS file reference to the replacement image file
	    set macPath to POSIX file filepath as Unicode text
		set file name of thisPlaceholderImageItem to ¬
			alias macPath
	end tell
  end tell
end addImage

on addTitle(docId, slideIndex, thisSlideTitle)
	tell application "Keynote"
    	tell slide slideIndex of document id docId
			set the object text of the default title item to thisSlideTitle
		end tell
	end tell
end addTitle

on addBody(docId, slideIndex, thisSlideBody)
	tell application "Keynote"
    	tell slide slideIndex of document id docId
            set the object text of the default body item to thisSlideBody
		end tell
	end tell
end addTitle

on addPresenterNotes(docId, slideIndex, theNotes)
	tell application "Keynote"
    	tell slide slideIndex of document id docId
			set presenter notes to theNotes
		end tell
	end tell
end addPresenterNotes

on addText(docId, slideIndex, itemIndex, theText)
  tell application "Keynote"
  	tell slide slideIndex of document id docId
		set thisPlaceholderItem to text item itemIndex
		set object text of thisPlaceholderItem to theText
	end tell
  end tell
end addText

on newPresentation(themeName)
	tell application "Keynote"
		activate
		-- FIXME: Make this selectable?
		set targetWidth to 1024 -- 1440 <-- higher resolution
		set targetHeight to 768 -- 1080 <-- higher resolution

		set props to {document theme:theme (themeName as string), width:targetWidth, height:targetHeight}

		set thisDocument to make new document with properties props
		return id of thisDocument
	end tell
end newPresentation

on openPresentation(posixPath)
	tell application "Keynote"
		open posixPath
	end tell
end openPresentation

on savePresentation(docId, posixPath)
	tell application "Keynote"
		activate
        set theDocument to document id docId
		save theDocument in POSIX file posixPath
        delete theDocument
        open posixPath
	end tell
end savePresentation

on closePresentation(docId)
	tell application "Keynote"
		activate
        set theDocument to document id docId
		close theDocument
	end tell
end savePresentation

on createSlide(docId, masterSlideName)
	tell application "Keynote"
		tell document id docId
			set thisSlide to make new slide with properties {base slide:master slide masterSlideName}
		end tell
	end tell
end createSlide

on deleteAllSlides(docId)
	tell application "Keynote"
		tell document id docId to delete every slide
	end tell
end deleteAllSlides

on finalize(docId)
	tell application "Keynote"
		tell document id docId to delete slide 1
	end tell
end finalize

on themeMasters(docId)
	--	  tell application "Keynote" to get the name of every master slide of thisDocument
	tell application "Keynote"
		set names to the name of every master slide of document id docId
		return names
	end tell
end themeMasters

on addImage(docId, slideIndex, n, filepath)
  tell application "Keynote"
	tell slide slideIndex of document id docId
		-- TO REPLACE A PLACEHOLDER OR EXISTING IMAGE:
		set thisPlaceholderImageItem to image n
		-- change the value of the “file name” property of the image to be an HFS file reference to the replacement image file
	    set macPath to POSIX file filepath as Unicode text
		set file name of thisPlaceholderImageItem to ¬
			alias macPath
	end tell
  end tell
end addImage

on addTitle(docId, slideIndex, thisSlideTitle)
	tell application "Keynote"
    	tell slide slideIndex of document id docId
			set the object text of the default title item to thisSlideTitle
		end tell
	end tell
end addTitle

on addBody(docId, slideIndex, thisSlideBody)
	tell application "Keynote"
    	tell slide slideIndex of document id docId
            set the object text of the default body item to thisSlideBody
		end tell
	end tell
end addTitle

on addPresenterNotes(docId, slideIndex, theNotes)
	tell application "Keynote"
    	tell slide slideIndex of document id docId
			set presenter notes to theNotes
		end tell
	end tell
end addPresenterNotes

on addText(docId, slideIndex, n, theText)
  tell application "Keynote"
  	tell slide slideIndex of document id docId
		set thisPlaceholderItem to text item n
		set object text of thisPlaceholderItem to theText
	end tell
  end tell
end addText


convert textfile

convert textfile

JsOsaDAS1.001.00bplist00Vscript_var app = Application("Unity");
app.activate();
delay(0.15);
sys = Application("System Events");
sys.keystroke("p", { using: "command down"});jscrޭ


changed canvas size (taking the iPad status bar into account)

-- export all layers to image files
-- Copyright (c) 2011, Charles-Axel Dein

-- Settings
property exportFileExtension : "png"
property CANVAS_ORIGIN = {200, 220}
property CANVAS_SIZE = {1024, 748} -- this is landscape orientation
-- End of Settings

tell application "OmniGraffle Professional 5"
	set theWindow to front window
	set theDocument to document of theWindow
	set theFilename to name of theDocument
	-- remove .graffle
	set theFilename to texts 1 thru ((offset of "." in theFilename) - 1) of theFilename

	set export_folder to (choose folder with prompt "Pick the destination folder") as string
	set export_folder to export_folder & theFilename & ":"

	-- create folder
	do shell script "mkdir -p " & quoted form of POSIX path of export_folder

	set canvasCount to count of canvases of theDocument

	set i to 0
	repeat with canvasNumber from 1 to canvasCount
		set theCanvas to canvas canvasNumber of theDocument
		set canvas_name to name of theCanvas
		set canvas of theWindow to theCanvas
		set layerCount to count of layers of theCanvas

		-- hide all layers, except those beginning with "*"
		-- also check if there is only one layer to be exported
		repeat with layerNumber from 1 to layerCount
			set theLayer to layer layerNumber of theCanvas
			set number_of_layer_to_be_exported to 0

			if theLayer is prints and class of theLayer is not shared layer then
				set layer_name to name of theLayer as string
				if character 1 of layer_name is not "*" then
					set visible of theLayer to false
					set number_of_layer_to_be_exported to number_of_layer_to_be_exported + 1
				else
					set visible of theLayer to true
				end if
			end if

		end repeat

		set area type of current export settings to manual region
		set draws background of current export settings to false
		set include border of current export settings to false
		set origin of current export settings to CANVAS_ORIGIN
		set size of current export settings to CANVAS_SIZE

		repeat with layerNumber from 1 to layerCount
			set theLayer to layer layerNumber of theCanvas

			if (theLayer is prints) and (class of theLayer is not shared layer) then
				set layer_name to name of theLayer as string
				set filename to canvas_name & " - " & layer_name & "." & exportFileExtension
				set export_filename to export_folder & filename

				-- show the layer, export, then hide the layer
				if character 1 of layer_name is not "*" then
					set visible of theLayer to true
					save theDocument in export_filename
					set visible of theLayer to false
				end if

			end if

		end repeat

	end repeat
end tell

-- export all layers to image files
-- Copyright (c) 2011, Charles-Axel Dein

-- Settings
property exportFileExtension : "png"
property CANVAS_ORIGIN = {200, 220}
property CANVAS_SIZE = {1024, 768}
-- End of Settings

tell application "OmniGraffle Professional 5"
	set theWindow to front window
	set theDocument to document of theWindow
	set theFilename to name of theDocument
	-- remove .graffle
	set theFilename to texts 1 thru ((offset of "." in theFilename) - 1) of theFilename

	set export_folder to (choose folder with prompt "Pick the destination folder") as string
	set export_folder to export_folder & theFilename & ":"

	-- create folder
	do shell script "mkdir -p " & quoted form of POSIX path of export_folder

	set canvasCount to count of canvases of theDocument

	set i to 0
	repeat with canvasNumber from 1 to canvasCount
		set theCanvas to canvas canvasNumber of theDocument
		set canvas_name to name of theCanvas
		set canvas of theWindow to theCanvas
		set layerCount to count of layers of theCanvas

		-- hide all layers, except those beginning with "*"
		-- also check if there is only one layer to be exported
		repeat with layerNumber from 1 to layerCount
			set theLayer to layer layerNumber of theCanvas
			set number_of_layer_to_be_exported to 0

			if theLayer is prints and class of theLayer is not shared layer then
				set layer_name to name of theLayer as string
				if character 1 of layer_name is not "*" then
					set visible of theLayer to false
					set number_of_layer_to_be_exported to number_of_layer_to_be_exported + 1
				else
					set visible of theLayer to true
				end if
			end if

		end repeat

		set area type of current export settings to manual region
		set draws background of current export settings to false
		set include border of current export settings to false
		set origin of current export settings to CANVAS_ORIGIN
		set size of current export settings to CANVAS_SIZE

		repeat with layerNumber from 1 to layerCount
			set theLayer to layer layerNumber of theCanvas

			if (theLayer is prints) and (class of theLayer is not shared layer) then
				set layer_name to name of theLayer as string
				set filename to canvas_name & " - " & layer_name & "." & exportFileExtension
				set export_filename to export_folder & filename

				-- show the layer, export, then hide the layer
				if character 1 of layer_name is not "*" then
					set visible of theLayer to true
					save theDocument in export_filename
					set visible of theLayer to false
				end if

			end if

		end repeat

	end repeat
end tell


Finish incomplete removal of third_party/js/es5conform in r5616.

git-svn-id: eb21526166532bd3afc2c1499c0cf105ce815f5a@5617 360991c0-9f3b-0410-ba87-8b362a00edf4

FasdUAS 1.101.10
k
l
	OS X ECMAScript 5 Conformance Test Suite Generator

	Run from Terminal by : osascript build.scpt
	- Accepted Arguments
		- /dynamic
		- /toplevel

	Brian Antonelli <brian.antonelli@gmail.com>

	OS X ECMAScript 5 Conformance Test Suite Generator

	Run from Terminal by : osascript build.scpt
	- Accepted Arguments
		- /dynamic
		- /toplevel

	Brian Antonelli <brian.antonelli@gmail.com>

l

p0scriptz0topleveltopLevel 0statictestloadstaticTestLoad

l
l our main() our main()
i
I
.aevtoappnull****
o0argv
k#
Q !"
 r#$
#l%
%n&'
&1

leng
'o0argv
$o0foo
!R
.ascrerr ********
"l()*
(r+,
+J
,o0argv))# for running from the script editor*--F for running from the script editor./
.l/01
0l232 get our current path344* get our current path156
5O"78
7e!9
9n!:;
:m

cfol
;l<
<I=
.earsffdralis afdr
=f
8m>>MACSalisrMacintosh HD]H+t
Finder.appu$ò	 CoreServicesRó3"t0/3Macintosh HD:System:Library:CoreServices:Finder.app
Finder.appMacintosh HD&System/Library/CoreServices/Finder.app/6?@
?r#&AB
A1#$

rslt
Bo0myfoldermyFolder@CD
Cl''EFE get our current folderFGG. get our current folderDHI
HO'1JK
Je+0L
Lc+0MN
Mn+.OP
Om,.

ctnr
Pl+,Q
Qo+,0myfoldermyFolder
Nm./

utxt
Km'(RRMACSalisrMacintosh HD]H+t
Finder.appu$ò	 CoreServicesRó3"t0/3Macintosh HD:System:Library:CoreServices:Finder.app
Finder.appMacintosh HD&System/Library/CoreServices/Finder.app/IST
Sr25UV
U123

rslt
Vo0
mainfolder
mainFolderTWX
Wl66YZY  get the test cases folderZ[[4 get the test cases folderX\]
\r6;^_
^b69`a
`o670
mainfolder
mainFolder
am78bbccTestCases:
_o 0startingfolderstartingFolder]de
dr<?fg
fm<=
boovfals
go0topleveltopLevelehi
hr@Cjk
jm@A
boovtrue
ko 0statictestloadstaticTestLoadilm
lrDJno
nJDF
oo0scriptzmpq
plKKqrs
rlKKtut(" check for user provided argumentsuvvD check for user provided argumentsswx
wYKyz{
yZX|}~
|lXb
=Xb
nX^
4Y^

cobj
o\]0i
oXY0argv
m^a/toplevel
}reh
mef
boovtrue
o0topleveltopLevel~
lku
=ku
nkq
4lq

cobj
oop0i
okl0argv
mqt/dynamic
rx{
mxy
boovfals
o 0statictestloadstaticTestLoad0i
zmNO
{lOS
nOS
1PR

leng
oOP0argvx
l
l82 determine whether to do a test group or test cased determine whether to do a test group or test case
O
Z
l
I
.coredoexboolobj
4

cfol
o 0startingfolderstartingFolder
n
I0
find_tests
o 0startingfolderstartingFolder
f
n
I0add_test
o 0startingfolderstartingFolder
f
mMACSalisrMacintosh HD]H+t
Finder.appu$ò	 CoreServicesRó3"t0/3Macintosh HD:System:Library:CoreServices:Finder.app
Finder.appMacintosh HD&System/Library/CoreServices/Finder.app/
l
l'! open the output file for writingB open the output file for writing
Q
k
r
l
b
l
c
o0myfoldermyFolder
m

TEXT
mtest.html
o0target_file_path
r
I
.rdwropenshorfile
l
4

file
o0target_file_path

perm
m
boovtrue
o	0phile
l" overwrite the previous file8 overwrite the previous file
I
.rdwrseofnull****
l
o	0phile

set2
m
l write down to the file. write down to the file
I~}~0write_header|
o{{	0phile|}
Izyz0
write_contentx
oww	0philexy
Ivuv0write_footert
oss	0philetur
Iqp
q.rdwrclosnull****
lon
omm	0phileonpr
Rlkj
l.ascrerr ********kj
Qi
Ihg
h.rdwrclosnull****
lfe
odd	0philefeg
Rcba
c.ascrerr ********bai
l`_^`_^
l]]WQ this will allow you to choose which app to test with (only works if run via gui) this will allow you to choose which app to test with (only works if run via gui)
l\\~set theApp to choose application with title "Installed Applications" with prompt "Select an application to test with" as aliasset theApp to choose application with title "Installed Applications" with prompt "Select an application to test with" as alias
l[ZY[ZY
lX	XF@ open the test file with the system's default registered program

 open the test file with the system's default registered program
O!

I WV
W.aevtodocnullalis
oUU0target_file_pathV
mMACSalisrMacintosh HD]H+t
Finder.appu$ò	 CoreServicesRó3"t0/3Macintosh HD:System:Library:CoreServices:Finder.app
Finder.appMacintosh HD&System/Library/CoreServices/Finder.app/T
l""SRQSRQT
lPONPON
lMLKMLK
lJJ(" recursively collects test scriptsD recursively collects test scripts
i
IIHI0
find_tests G
 oFF	0fpathGH
O!"
!k##$%
$r	&'
&c()
(oEE	0fpath
)mD
D
TEXT
'oCC	0fpath%*+
*l

B,-B,E? get all of the items in the current folder (ignore invisibles)-..~ get all of the items in the current folder (ignore invisibles)+/0
/r
12
1I
A34
A.earslfdrutxt@file
3o
@@	0fpath4?5>
?
lfiv
5m
=
=boovfals>
2o<<	0itemz067
6r89
8J;;
9o::0
subfolders7:;
:r<=
<m9
9boovfals
=o880	foundfile	foundFile;>?
>l765765?@A
@XUB4C
Bk-PDDEF
Er-6GH
Gc-4IJ
Ib-2KL
Kb-0MN
Ml-.O32
Oo-.11	0fpath32
No./000i
Lm01PPQQ:
Jm23/
/
alis
Ho..0myitemmyItemFRS
Rl77-TU-TF@ we want to process all of the files first, so queue the foldersUVV we want to process all of the files first, so queue the foldersSW,
WZ7PXY+Z
Xl7<[*)
[=7<\]
\l7:^('
^n7:_`
_18:&
&
kind
`o78%%0myitemmyItem('
]m:;aabbFolder*)
Yr?Ccd
co?@$$0myitemmyItem
dnef
e;AB
fo@A##0
subfolders+
ZkFPgghi
hlFF"jk"j
 add the testkll add the testimn
mnFLop
oIGL!q !0add_testqr
roGH0myitemmyItem
pfFGns
srMPtu
tmMN
boovtrue
uo0	foundfile	foundFile,40i
Co !	0itemzAvw
vlVVwxy
xlVVz{zD> if the folder contained any files then add a null dilemeter		{||| if the folder contained any files then add a null dilemeter		y}~
}ZVd
oVW0	foundfile	foundFile
nZ`
I[`0add_test
m[\

null
fZ[~
lee

lee2, now process all of the folders, recursivelyX now process all of the folders, recursively
Xe

nu{
Iv{		0
find_tests
ovw0i
fuv
0i
ohi0
subfolders
l
"mMACSalisrMacintosh HD]H+t
Finder.appu$ò	 CoreServicesRó3"t0/3Macintosh HD:System:Library:CoreServices:Finder.app
Finder.appMacintosh HD&System/Library/CoreServices/Finder.app/
l
l
l)# processes and stores a test scriptF processes and stores a test script
i
I0add_test
o0script_path
kV
lHB only process the test if we aren't adding the null dilemeter test only process the test if we aren't adding the null dilemeter test
ZQ
l
>
o0script_path
m

null
kM
l get the unixy path& get the unixy path
r

c
n
1

psxp
o0script_path
m

TEXT
o0script_path
l
l+% check if we are relative or absoluteJ check if we are relative or absolute
r
I
.sysooffslongnull

psof
mTestCases/

psin
o0script_path
o0base
r
m
o
0prefix
ZG
l!
@!
o0base
m
k$C
l$$3- chomp everything before our TestCases folderZ chomp everything before our TestCases folder
r$5
c$3
n$1
7%1

cha
o)+0base
l,0
n,0
1.0

leng
o,.0script_path
o$%0script_path
m12

TEXT
o0script_path
l66VP if this is run from the SimpleTestHarness folder then we'll need to jump up one if this is run from the SimpleTestHarness folder then we'll need to jump up one
Z6C
l69
=69
o670topleveltopLevel
m78
boovfals
r<?
m<=../
o
0prefix
lHH,& generate our final path to the scriptL generate our final path to the script
rHM
bHK
oHI
0prefix
	oIJ0script_path
o0script_path

lRR

lRR store the script path, store the script path

rRV
lRS
oRS0script_path
n
;TU
oST0scriptz
l
l
l(" write the header to our test fileD write the header to our test file !
 i"#
"I$0write_header$%
%o	0phile
#k/&&'(
'I)*
.rdwrwritnull****
)m++,,
<html>
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=8"/>
*-

refn
-o	0phile(./
.l/01
0r23
2m	4455
3o
0prefix167
6Z89
8l:
:=;<
;o
0topleveltopLevel
<m

boovtrue
9r=>
=m??@@$SimpleTestHarness/
>o
0prefix7AB
AI%CD
.rdwrwritnull****
CbEF
EbGH
GmIIJJL		<script type="text/javascript" src="
Ho
0prefix
FmKKLL"sth.js"></script>DM

refn
Mo !	0phileBNO
Nl&&OPQ
PI&-RS
.rdwrwritnull****
Rm&'TTUU
		<script>var ES5Harness = activeSth;</script>
	</head>
	<body>
		<script>
			var aryTestCasePaths = [
SV

refn
Vo()	0phileQW
Wl..!XY
XlYZ[
Zl[\]
\l^_^  write the test references_``4 write the test references]ab
aicd
cIe0
write_contentef
fo	0phile
dY3ghi
gZ
.jkl
jl
m~}
m>
no
nn
pq
p4|r
|
cobj
ro{{0i
qo
zz0scriptz
omy
y
null~}
kI$xst
x.rdwrwritnull****
sbuv
ubwx
wmyyzz
				"
xl{wv
{n|}
|4u~
u
cobj
~ott0i
}oss0scriptzwv
vm",
trq
r
refn
o pp	0phileq
lI'.o
o.rdwrwritnull****
m'(				null,
nm
n
refn
o)*ll	0philem0i
hmkk
ilji
n
1h
h
leng
ogg0scriptzjib
lfedfed
lcbacba
l`` write the footer" write the footer
i
I_^_0write_footer]
o\\	0phile]^
k
I[
[.rdwrwritnull****
m
			];
ZY
Z
refn
oXX	0phileY
lWVUWVU
lTTJD if they specified static test then don't include all of the scripts if they specified static test then don't include all of the scripts
Z5SR
lQP
>
o	OO 0statictestloadstaticTestLoad
m
N
NboovtrueQP
k1
r
m"."
oMM
0prefix
ZLK
lJI
=
oHH0topleveltopLevel
mG
GboovtrueJI
r
m&"SimpleTestHarness"
oFF
0prefixLK
I 'E
E.rdwrwritnull****
m !B		sht_loadtests(aryTestCasePaths,DC
D
refn
o"#BB	0phileCA
I(1@
@.rdwrwritnull****
b(+
o()??
0prefix
m)*);>=
>
refn
o,-<<	0phile=ASR
l66;:9;:9
I6=8
8.rdwrwritnull****
m67
		</script>
76
7
refn
o8955	0phile6
l>>432432
l>>11)# otherwise include each test scriptF otherwise include each test script
Z>u0/
l>A.-
=>A
o>?,, 0statictestloadstaticTestLoad
m?@+
+boovtrue.-
YDq*)
ZQl('
lQW&%
>QW
nQU
4RU$
$
cobj
oST##0i
oQR""0scriptz
mUV!
!
null&%
IZh
 .rdwrwritnull****
bZb
bZ`
mZ[L		<script type="text/javascript" src="
l[_
n[_
4\_

cobj
o]^0i
o[\0scriptz
m`a"></script>

refn
ocd	0phile('*0i
mGH
lHL
nHL
1IK

leng
oHI0scriptz)0/
lvv
lvv
 kick it off!

 kick it off!
Iv

.rdwrwritnull****
mvy
		<script>ES5Harness.startTesting();</script>
	</body>
</html>

refn
oz{

	0phile
l
.aevtoappnull****0
find_tests0add_test0write_header0
write_content0write_footer
.aevtoappnull****0argv0argv0i%>b

leng0foo
.earsffdralis afdr

cfol

rslt0myfoldermyFolder

ctnr

utxt0
mainfolder
mainFolder 0startingfolderstartingFolder0topleveltopLevel 0statictestloadstaticTestLoad0scriptz

cobj
.coredoexboolobj 0
find_tests0add_test

TEXT0target_file_path

file

perm
.rdwropenshorfile	0phile

set2
.rdwrseofnull****0write_header0
write_content0write_footer
.rdwrclosnull****
.aevtodocnullalis$
,EWXjvEO
)j,EUOEO,&UOEO%EOfEOeEOjvE`O8k,Ekha/aeEYa/afEYh[OYO*/j)k+Y)k+UOVa&a%E`O*a_/aelE`O_ajlO*_k+ O*_k+!O*_k+"O_j#WX_j#WXhO	_j$UOP0
find_tests	0fpath	0fpath	0itemz0
subfolders0	foundfile	foundFile0i0myitemmyItemPa

TEXT

lfiv
.earslfdrutxt@file

kocl

cobj
.corecnte********

alis

kind0add_test

null0
find_tests&EOflEOjvEOfEO7[lkh%%&EO,	6FY)k+OeE[OYO)k+YhO[lkh)k+
[OYOPU0add_test  0script_path0script_path0base
0prefix

null

psxp

TEXT

psof

psin
.sysooffslongnull

cha

leng0topleveltopLevel0scriptzWL,&EO*EOEOj$[\[Z\Z,2&EOfEYhYhO%EYhO6F#!"0write_header##	0phile!	0phile
0prefix"	+4?IKT

refn
.rdwrwritnull****0topleveltopLevel0lOEOeEYhO%%lOlOPd$%0
write_content&&	0phile$	0phile0i%	y0scriptz

leng

cobj

null

refn
.rdwrwritnull****42k,Ekh//%%lY	l[OY'(0write_footer))	0phile'	0phile
0prefix0i(

refn
.rdwrwritnull**** 0statictestloadstaticTestLoad0topleveltopLevel0scriptz

leng

cobj

nulllOe(EOeEYhOlO%lYhOlOe2,k,Ekh//%%lYh[OYYhOalascr
ޭ


Removed informational notice from iCal script

FasdUAS 1.101.10
k
lQK	An applescript that shows today's events from iCal as growl notifications.
l

a[	The script shows how to register and use multiple types of notifications from Applescript:
l

l		"Today's Events"
l			and
l!		"In-Script Notifications"
lD>			are the two notification types that this script registers.
l@: 			The types of notification are separated functionally.
l|v 			So the user can disable the first informational note from the prefpane without disabling the main notifications.
l!!tn-------------------------------------------------------------------------------------------------------------- "#
"l$$tn--------------------------------------------------------------------------------------------------------------#%&
%l&'(
'l()*
)l++A;	Register with growl and show the "gathering" notification.*,-
,l.
.r/0
/J1123
2m44Today's Events35
5m66In-Script Notification
0o 0myallnoteslistmyAllNotesList-78
7l
9
9r
:;
:m<<-'AppleScript iCal today's Event Notifier
;o0appnameappName8=>
=l?
?O@A
@l	B
BIC
.registernullnullCDE

appl
Do0appnameappNameEFG

anot
Fo 0myallnoteslistmyAllNotesListGHI

dnot
Ho 0myallnoteslistmyAllNotesListIJ

iapp
JmKK
iCal
AmLL2null߀LGrowlHelperApp.appP(`z@)(|ː{GRRRalisMacintosh HDgH+LGrowlHelperApp.appLȞV	 	ResourcesfȂ6LLLDDYMacintosh HD:Library:PreferencePanes:Growl.prefPane:Contents:Resources:GrowlHelperApp.app&GrowlHelperApp.appMacintosh HDLLibrary/PreferencePanes/Growl.prefPane/Contents/Resources/GrowlHelperApp.app/>MN
MlNOP
Ol%Q
Qr%RS
RI#
.misccurdldt null
So0nowPTU
Tl&/V
Vr&/WX
W\&+YZ
Yo&'0now
Zl'*[
[n'*\]
\1(*

time
]o'(0now
Xo0thismorningthisMorningU^_
^l0?`
`r0?ab
a\0;cd
c[09ef
eo030thismorningthisMorning
f]38gh
gm34
h147

days
dm9:
bo0thiseveningthisEvening_ij
il@Ek
kr@Elm
lm@A
boovfals
mo0foundonefoundOnejno
nlopq
plFEr
rOFEst
skLDuuvw
vlLLxxZT	Catch events that start today or that started before today, but have not yet ended.wy
yXLDz{
zXd?|}
|k:~~
r
m
boovtrue
o0foundonefoundOne
O
k
r
1

wr1s
o0thedatetheDate
Q
r
l
b
b
1

wr11
m	 -
n
1

tstr
o0thedatetheDate
o"0theeventsummarytheEventSummary
R
.ascrerr ********
r
b
m
no summary -
n
1

tstr
o0thedatetheDate
o"0theeventsummarytheEventSummary
l
Q
k
r
1

wr12
o*0theeventdescriptiontheEventDescription
I
.ascrcmnt********
o*0theeventdescriptiontheEventDescription
R
.ascrerr ********
r
mno description
o*0theeventdescriptiontheEventDescription
o0	thisevent	thisEvent
l
O:
l	 9
I 9
.notifygrnullnull

name
m$'Today's Events

titl
o*-"0theeventsummarytheEventSummary

desc
o03*0theeventdescriptiontheEventDescription

appl
o450appnameappName
mL0	thisevent	thisEvent
}lg
6g
lgl
ngl
2hl

wrev
ogh0thiscalendarthisCalendar
lo
Go
lp
Fp
@q|
1rv

wr1s
ow{0thismorningthisMorning
B}
1~

wr1s
o0thiseveningthisEvening
l
F
@
1

wr5s
o0now
B
1

wr1s
o0thismorningthisMorning0thiscalendarthisCalendar
{2OT

wres
tmFInull߀iiCal.app@P<(`z@)(|ː{wrbtalisDMacintosh HDgH+iiCal.app?Y	 Applicationsf?Ki"Macintosh HD:Applications:iCal.appiCal.appMacintosh HDApplications/iCal.app/q
l
lFo
ZFo
HFJ
oFI0foundonefoundOne
OMk
l	Qj~
IQj}|
}.notifygrnullnull|{
{
name
mUXIn-Script Notificationz
z
titl
m[^No iCal events todayy
y
desc
madGo outside and play!xw
x
appl
oefvv0appnameappNamew~
mMNLu
ltstsurrq
q.aevtoappnull****ponm
p.aevtoappnull****
ko,7=OT^ipllonkjk0thiscalendarthisCalendarj0	thisevent	thisEvent146i<hLgfedKcba`_^]\[ZYXWVUTSRQPONMLKJIHGi 0myallnoteslistmyAllNotesListh0appnameappName
g
appl
f
anot
e
dnot
d
iappc
b.registernullnull
a.misccurdldt null`0now
_
time^0thismorningthisMorning
]
days\0thiseveningthisEvening[0foundonefoundOne
Z
wres
Y
kocl
X
cobj
W.corecnte********
V
wrev
U
wr1s
T
wr5sS0thedatetheDate
R
wr11
Q
tstrP"0theeventsummarytheEventSummaryON
M
wr12L*0theeventdescriptiontheEventDescription
K.ascrcmnt********
J
name
I
titl
H
desc
G.notifygrnullnullmplvEOEO*UO*j
EO,E`O_k_ kE`OfE`Oa*a-[aalkhڠa-a[[[a,\Z_;\[a,\Z_=A\[[a,\Z;\[a,\Z_=AB1[aalkheE`O_*a,E`O*a,a%_a ,%E`!WX"#a$_a ,%E`!O*a%,E`&O_&j'WX"#a(E`&UO*a)a*a+_!a,_&-U[OYs[OYUO_#*a)a.a+a/a,a0-UYhascrޭ

FasdUAS 1.101.10
k
lQK	An applescript that shows today's events from iCal as growl notifications.
l

a[	The script shows how to register and use multiple types of notifications from Applescript:
l

l		"Today's Events"
l			and
l!		"In-Script Notifications"
lD>			are the two notification types that this script registers.
l@: 			The types of notification are separated functionally.
l|v 			So the user can disable the first informational note from the prefpane without disabling the main notifications.
l!!tn-------------------------------------------------------------------------------------------------------------- "#
"l$$tn--------------------------------------------------------------------------------------------------------------#%&
%l&'(
'l()*
)l*+,
+l--A;	Register with growl and show the "gathering" notification.,./
.l20
0O212
1k13345
4l567
6O89
8k::;<
;r=>
=J??@A
@m	BBToday's EventsAC
Cm
DDIn-Script Notification
>o 0myallnoteslistmyAllNotesList<E
EIF
.registernullnullFGH

appl
GmII-'AppleScript iCal today's Event NotifierHJK

anot
Jo 0myallnoteslistmyAllNotesListKLM

dnot
Lo 0myallnoteslistmyAllNotesListMN

iapp
NmOO
iCal
9mPP2null߀LGrowlHelperApp.appP()P(|0GRRRalisMacintosh HDgH+LGrowlHelperApp.appLȞV	 	ResourcesfȂ6LLLDDYMacintosh HD:Library:PreferencePanes:Growl.prefPane:Contents:Resources:GrowlHelperApp.app&GrowlHelperApp.appMacintosh HDLLibrary/PreferencePanes/Growl.prefPane/Contents/Resources/GrowlHelperApp.app/7QR
QlRS
SI1T
.notifygrnullnullTUV

name
Ul	 !W
Wm !XXIn-Script NotificationVYZ

titl
Yl	"#[
[m"#\\Please WaitZ]^

desc
]l	&)_
_m&)``^XGathering today's events from iCal... (n.b. Events which are repeats will not be shown!)^a

appl
am*-bb-'AppleScript iCal today's Event Notifier
2mP/cd
cldef
el3<g
gr3<hi
hI38
.misccurdldt null
io0nowfjk
jl=Ll
lr=Lmn
m\=Hop
oo=@0now
pl@Gq
qn@Grs
r1CG

time
so@C0now
no0thismorningthisMorningktu
tlMTv
vIMTw
.ascrcmnt********
wlMPx
xoMP0thismorningthisMorninguyz
ylUd{
{rUd|}
|\U`~
~[U^
oUX0thismorningthisMorning
]X]
mXY
1Y\

days
m^_
}o0thiseveningthisEveningz
lel
Iel
.ascrcmnt********
leh
oeh0thiseveningthisEvening
l
l	Gather today's events
lm
Om
ks
lss
rs}
csy
Jsu
mux

list
o0
currentevents
currentEvents
X~U
OP
kO
lZT	Catch events that start today or that started before today, but have not yet ended.
XO
OJ
kI
I
.ascrcmnt********
l
mCURRENT EVENT!
r
1

wr1s
o0thestarttheStart
r
n
1

tstr
o0thestarttheStart
o0thestarttimetheStartTime
r
/
c
+
K
'0
eventtitle
eventTitle
n
1

wr11
o0	thisevent	thisEvent$0eventdescriptioneventDescription
n
1

wr12
o0	thisevent	thisEvent0	starttime	startTime
o #0thestarttimetheStartTime
m'*

reco
o0myrecordmyRecord
r0=
c09
J05
o030myrecordmyRecord
m58

list
o0newlistnewList
r>I
b>E
o>A0
currentevents
currentEvents
oAD0newlistnewList
o0
currentevents
currentEvents
o0	thisevent	thisEvent0	thisevent	thisEvent
l
6
2

wrev
l
G
l
F
@
1

wr1s
o0thismorningthisMorning
B
1

wr1s
o0thiseveningthisEvening
l
F
@
1

wr5s
o0now
B
1~
~
wr1s
o}}0thismorningthisMorning
o||0thiscalthisCal0thiscalthisCal
2{
{
wres
lVVzyzy
lVVxx	Show the events.
lVVwvwv
ZVut
lVcs
=Vc
nVa
m]ar
r
nmbr
nV]
2Y]q
q
cobj
oVYpp0
currentevents
currentEvents
maboos
Of
l	jn
Ijml
m.notifygrnullnulllk
k
name
l	loj
mloIn-Script Notificationji
i
titl
l	psh
mps		No iCal events todayhg

g
desc

l	vyf
mvy

Go outside and play!fed
e
appl
mz}-'AppleScript iCal today's Event Notifierdn
mfgPut
lcbcb
Xa
k
Q
r
l`
b
b!"
!n#$
#o__0
eventtitle
eventTitle
$o^^"0thiseventrecordthisEventRecord
"m%%	 -
 n&'
&o]]0	starttime	startTime
'o\\"0thiseventrecordthisEventRecord`
o[["0theeventsummarytheEventSummary
RZYX
Z.ascrerr ********YX
r()
(b*+
*m,,
no summary -
+n-.
-oWW0	starttime	startTime
.oVV"0thiseventrecordthisEventRecord
)oUU"0theeventsummarytheEventSummary/0
/lTSTS012
1Q345
3r67
6n89
8oRR$0eventdescriptioneventDescription
9oQQ"0thiseventrecordthisEventRecord
7oPP*0theeventdescriptiontheEventDescription
4RONM
O.ascrerr ********NM
5r:;
:m<<no description
;oLL*0theeventdescriptiontheEventDescription2=>
=lKJKJ>?I
?O@A
@l	BH
BIGFC
G.notifygrnullnullFCEDE
E
name
Dl	FD
FmGGToday's EventsDECHI
C
titl
Hl	JB
JoAA"0theeventsummarytheEventSummaryBI@KL
@
desc
Kl	M?
Mo>>*0theeventdescriptiontheEventDescription?L=N<
=
appl
NmOO-'AppleScript iCal today's Event Notifier<H
AmPIa"0thiseventrecordthisEventRecord
o;;0
currentevents
currentEventsP:
Pl9898:
mmpQQnull߀iiCal.appP<()P(|0wrbtalisDMacintosh HDgH+iiCal.app?Y	 Applicationsf?Ki"Macintosh HD:Applications:iCal.appiCal.appMacintosh HDApplications/iCal.app/RS
Rl7676ST5
Tl434352UV2U1
1.aevtoappnull****V0W/.XY-
0.aevtoappnull****
Wk	ZZ.[[e\\j]]t^^y__``,,/.X+*)+0thiscalthisCal*0	thisevent	thisEvent)"0thiseventrecordthisEventRecordYAPBD('I&%$O#"!X \`bQa

%,<GO( 0myallnoteslistmyAllNotesList
'
appl
&
anot
%
dnot
$
iapp#
".registernullnull
!
name

titl

desc
.notifygrnullnull
.misccurdldt null0now

time0thismorningthisMorning
.ascrcmnt********

days0thiseveningthisEvening

list0
currentevents
currentEvents

wres

kocl

cobj
.corecnte********

wreva

wr1s

wr5s
0thestarttheStart

tstr0thestarttimetheStartTime
0
eventtitle
eventTitle

wr11$0eventdescriptioneventDescription

wr120	starttime	startTime

reco0myrecordmyRecord0newlistnewList

nmbr"0theeventsummarytheEventSummary*0theeventdescriptiontheEventDescription-
/lvEO*UO*aaaUO*jE`O__a,E`O_jO_k_ kE`O_jOajva&E`O*a-[aa l!kh*a"-a#[[[a$,\Z_;\[a$,\Z_=A\[[a%,\Z_;\[a$,\Z_=AB1[aa l!kh\a&jO*a$,E`'O_'a(,E`)Oa*a+,a,a-,a._)a/a0&E`1O_1kva&E`2O__2%E`U[OYU[OY@O_a -a3,j!*a4a5aa6a7UYhO~_[aa l!kha*,a8%a.,%E`9WX:;a<a.,%E`9Oa,,E`=WX:;a>E`=O*a?_9a_=a@U[OYOPUascr
ޭ


The chapter markers are now accurate to the thousandth of a second

--
--  DASAppDelegate.applescript
--  itunes-concatenator
--
--  Created by David Schlachter on 2014-08-26.
--  Copyright (c) 2014 Red Eft Software. All rights reserved.
--

-- via http://macscripter.net/viewtopic.php?pid=173787 ; apparently needed for using arrays

script DASAppDelegate
	property parent : class "NSObject"

    global these_files, these_times, these_titles, the_index, the_pipes, theCounter, cmdPrefix

	-- IBOutlets
	property window : missing value
    property trackTable : missing value
    property catName : missing value
    property catArtist : missing value
    property catAlbum : missing value
    property catComposer : missing value
    property catGenre : missing value
    property catTrack : missing value
    property catTracks : missing value
    property catDisc : missing value
    property catDiscs : missing value
    property catAlbumArtist : missing value
    property catYear : missing value

    -- Again, per macscripter, we'll set up bindings for the options
    property pcatName : ""
    property pcatArtist : ""
    property pcatAlbum : ""
    property pcatComposer : ""
    property pcatGenre : ""
    property pcatTrack : ""
    property pcatTracks : ""
    property pcatDisc : ""
    property pcatDiscs : ""
    property pcatAlbumArtist : ""
    property pcatYear : ""

    -- Empty strings for each file name and location
    property pEachName : ""
    property pEachLocation : ""

    property these_titles : {}
    property these_files : {}
    property these_times: {}
    property the_index: {}
    property the_pipes: {}

    property theCounter : ""
    property cmdPrefix : "if [[ -r /etc/profile ]];then . /etc/profile;fi;if [[ -r ~/.bashrc ]];then . ~/.bashrc;fi;if [[ -r ~/.bash_profile ]];then . ~/.bash_profile;fi;"

    on awakeFromNib()
        --
        -- Check for FFMPEG and MP4v2
        --
        -- (This works, but it's ugly!)
        --
        --
        try
            do shell script cmdPrefix & " if [ -x \"`/usr/bin/which ffmpeg`\" ];then exit 0;else exit 1;fi"
        on error number error_number
            display dialog "You must install FFMPEG and MP4v2 to continue. \n\nYou may have to install Xcode Command Line Tools and Homebrew first. If you continue, we'll attempt to install them for you if they are not already present. \n\nIf you have already installed FFMPEG and MP4v2, ensure that they are in your bash path." buttons {"Quit","Install"} default button 2
            If button returned of result is "Install" then
                try
                    tell application "Terminal"
                        -- TODO: This should be cleaner -- Terminal in front, only one window, focus back to the cat'er afterwards
                        set newTab to do script cmdPrefix & "if [[ -x `which brew` ]];then brew install ffmpeg;else /usr/bin/ruby -e \"$(/usr/bin/curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)\";brew install ffmpeg mp4v2;fi"
                        delay 4
                        repeat
                            delay 0.1
                            if not busy of newTab then exit repeat
                        end repeat
                    end tell
                     -- TODO: This needs a better test, i.e., check if ffmpeg is actually accessible on the path
                    display dialog "FFMPEG was successfully installed"
                    -- TODO: This should actually work! (Bring us back to the foreground)
                    activate current application
                on error number error_number
                    display dialog "FFMPEG did not successfully install"
                end try
            end If
            If button returned of result is "Quit" then
                -- Fix!
                current application's NSApp's terminate()
            end If
        end try
    end awakeFromNib

    on btnGetTracks_(sender)
        -- Code to add iTunes tracks to our list
        -- via http://dougscripts.com/itunes/itinfo/info02.php and http://www.randomsequence.com/articles/applescript-to-send-selected-itunes-tracks-using-mail/
        tell application "iTunes"
            set these_titles to {}
            set these_times to {}
            set these_files to {}
            set the_index to {}
            if selection is not {} then -- there ARE tracks selected...
                set mySelection to selection
                set i to 1
                repeat with aTrack in mySelection
                    if class of aTrack is file track then
                        set end of these_titles to ((name of aTrack) as string)
                        set end of these_times to ((time of aTrack) as string)
                        set end of these_files to (posix path of (get location of aTrack))
                        set end of the_index to (count of these_titles)
                        -- Get metadata from the first track
                        if i is 1 then
                            set pcatArtist to ((artist of aTrack) as string)
                            set pcatAlbum to ((album of aTrack) as string)
                            set pcatComposer to ((composer of aTrack) as string)
                            set pcatGenre to ((genre of aTrack) as string)
                            set pcatDisc to ((disc number of aTrack) as string)
                            set pcatDiscs to ((disc count of aTrack) as string)
                            set pcatAlbumArtist to ((album artist of aTrack) as string)
                            set pcatYear to ((year of aTrack) as string)
                        end if
                        set i to (i + 1)
                    end if
                end repeat
            end if
        end tell
        -- Display the songs to be concatenated
        -- via http://stackoverflow.com/questions/25537750/setstringvalue-with-applescript-list
        set olddelimeters to AppleScript's text item delimiters
        set AppleScript's text item delimiters to "\n"
        set disp_titles to these_titles as string
        trackTable's setStringValue_(disp_titles)
        set AppleScript's text item delimiters to olddelimeters
        -- Update the default metadata
        catArtist's setStringValue_(pcatArtist)
        catAlbum's setStringValue_(pcatAlbum)
        catComposer's setStringValue_(pcatComposer)
        catGenre's setStringValue_(pcatGenre)
        catDisc's setStringValue_(pcatDisc)
        catDiscs's setStringValue_(pcatDiscs)
        catAlbumArtist's setStringValue_(pcatAlbumArtist)
        catYear's setStringValue_(pcatYear)
    end btnGetTracks_

    on btnConcatenate_(sender)
        -- Update the metadata variables with the user's input
        set pcatName to catName's stringValue()
        set pcatArtist to catArtist's stringValue()
        set pcatAlbum to catAlbum's stringValue()
        set pcatComposer to catComposer's stringValue()
        set pcatGenre to catGenre's stringValue()
        set pcatTrack to catTrack's stringValue()
        set pcatTracks to catTracks's stringValue()
        set pcatDisc to catDisc's stringValue()
        set pcatDiscs to catDiscs's stringValue()
        set pcatAlbumArtist to catAlbumArtist's stringValue()
        set pcatYear to catYear's stringValue()
        set the_pipes to {}
        repeat with theIndex in the_index
            -- TODO: Needs error checking!
            -- TODO: We need to check what kind of audio files we have, then adjust accordingly
            do shell script (cmdPrefix & "ffmpeg -i \"" & (item theIndex of these_files as text) & "\" -c copy -bsf:v h264_mp4toannexb -f mpegts /private/tmp/concat" & theIndex & ".ts 2> /dev/null" as text)
            log ("Processed file number" & theIndex) as text
            set end of the_pipes to ("/private/tmp/concat" & theIndex & ".ts" as text)
        end repeat
        -- Run the actual concatenation command in ffmpeg (for mp4/AAC files only!)
        -- via https://trac.ffmpeg.org/wiki/How%20to%20concatenate%20(join,%20merge)%20media%20files
        set olddelimeters to AppleScript's text item delimiters
        set AppleScript's text item delimiters to "|"
        set disp_thepipes to the_pipes as string
        do shell script (cmdPrefix & "ffmpeg -f mpegts -i \"concat:" & (disp_thepipes as text) & "\" -c copy -bsf:a aac_adtstoasc /private/tmp/cat.mp4")
        set AppleScript's text item delimiters to olddelimeters
        -- Now let's create the chapter file
        repeat with theIndex in the_index
            if theIndex < 2 then
                do shell script ("/bin/echo \"00:00:00.000 " & (item theIndex of these_titles as text) & "\" > /private/tmp/cat.chapters.txt" as text)
                set theCounter to (do shell script (cmdPrefix & "ffprobe -loglevel panic -show_streams /private/tmp/concat" & (theIndex as text) & ".ts | egrep -m 1 'duration=[0-9]+\\.' | sed 's/duration=\\([0-9]*[0-9]\\.[0-9]*\\)/\\1/'" as text) as string)
                set theCounter to (do shell script ("/bin/echo $(/usr/bin/printf %.$2f $(/bin/echo \"`/usr/bin/printf %.3f " & theCounter & "` * 1000\" | /usr/bin/bc))") as string)
            else
                set theDateStamp to do shell script (cmdPrefix & "t="& (theCounter as text) & ";((msec=t%1000, t/=1000, sec=t%60, t/=60, min=t%60, hrs=t/60));timestamp=$(printf \"%02d:%02d:%02d.%03d\" $hrs $min $sec $msec);/bin/echo $timestamp" as text)
                do shell script ("/bin/echo \"" & (theDateStamp as text) & " " & (item theIndex of these_titles as text) & "\" >> /private/tmp/cat.chapters.txt" as text)
                set theNewCounter to do shell script ((cmdPrefix & "ffprobe -loglevel panic -show_streams /private/tmp/concat" & (theIndex as text) & ".ts | egrep -m 1 'duration=[0-9]+\\.' | sed 's/duration=\\([0-9]*[0-9]\\.[0-9]*\\)/\\1/'" as text) as string)
                set theNewCounter to do shell script ("/bin/echo $(/usr/bin/printf %.$2f $(/bin/echo \"`/usr/bin/printf %.3f " & theNewCounter & "` * 1000\" | /usr/bin/bc))") as string
                log "theNewCounter is " & theNewCounter
                set theCounter to (theCounter + theNewCounter)
                log ("Post-addition, theCounter is " & theCounter) as text
            end if
        end repeat
        -- Chapterize cat.mp4
        do shell script (cmdPrefix & "mp4chaps -i /private/tmp/cat.mp4" as text)
        -- Add tags
        do shell script (cmdPrefix & "mp4tags -song \"" & pcatName & "\" -album \"" &  pcatAlbum & "\" -artist \"" &  pcatArtist & "\" -writer \"" &  pcatComposer & "\" -genre \"" &  pcatGenre & "\" -track \"" &  pcatTrack & "\" -tracks \"" &  pcatTracks & "\" -disk \"" &  pcatDisc & "\" -disks \"" &  pcatDiscs & "\" -albumartist \"" & pcatAlbumArtist & "\" -year \"" & pcatYear & "\" /private/tmp/cat.mp4" as text)
        -- Clean up
        do shell script "/bin/rm /private/tmp/concat* /private/tmp/cat.chapters.txt #/private/tmp/cat.mp4"
        set theCounter to ""
    end btnConcatenate_

	on applicationWillFinishLaunching_(aNotification)
		-- Insert code here to initialize your application before any files are opened
	end applicationWillFinishLaunching_

	on applicationShouldTerminate_(sender)
		-- Insert code here to do any housekeeping before your application quits
		return current application's NSTerminateNow
	end applicationShouldTerminate_

end script

--
--  DASAppDelegate.applescript
--  itunes-concatenator
--
--  Created by David Schlachter on 2014-08-26.
--  Copyright (c) 2014 Red Eft Software. All rights reserved.
--

-- via http://macscripter.net/viewtopic.php?pid=173787 ; apparently needed for using arrays

script DASAppDelegate
	property parent : class "NSObject"

    global these_files, these_times, these_titles, the_index, the_pipes, theCounter, cmdPrefix

	-- IBOutlets
	property window : missing value
    property trackTable : missing value
    property catName : missing value
    property catArtist : missing value
    property catAlbum : missing value
    property catComposer : missing value
    property catGenre : missing value
    property catTrack : missing value
    property catTracks : missing value
    property catDisc : missing value
    property catDiscs : missing value
    property catAlbumArtist : missing value
    property catYear : missing value

    -- Again, per macscripter, we'll set up bindings for the options
    property pcatName : ""
    property pcatArtist : ""
    property pcatAlbum : ""
    property pcatComposer : ""
    property pcatGenre : ""
    property pcatTrack : ""
    property pcatTracks : ""
    property pcatDisc : ""
    property pcatDiscs : ""
    property pcatAlbumArtist : ""
    property pcatYear : ""

    -- Empty strings for each file name and location
    property pEachName : ""
    property pEachLocation : ""

    property these_titles : {}
    property these_files : {}
    property these_times: {}
    property the_index: {}
    property the_pipes: {}

    property theCounter : ""
    property cmdPrefix : "if [[ -r /etc/profile ]];then . /etc/profile;fi;if [[ -r ~/.bashrc ]];then . ~/.bashrc;fi;if [[ -r ~/.bash_profile ]];then . ~/.bash_profile;fi;"

    on awakeFromNib()
        --
        -- Check for FFMPEG and MP4v2
        --
        -- (This works, but it's ugly!)
        --
        --
        try
            do shell script cmdPrefix & " if [ -x \"`/usr/bin/which ffmpeg`\" ];then exit 0;else exit 1;fi"
        on error number error_number
            display dialog "You must install FFMPEG and MP4v2 to continue. \n\nYou may have to install Xcode Command Line Tools and Homebrew first. If you continue, we'll attempt to install them for you if they are not already present. \n\nIf you have already installed FFMPEG and MP4v2, ensure that they are in your bash path." buttons {"Quit","Install"} default button 2
            If button returned of result is "Install" then
                try
                    tell application "Terminal"
                        -- TODO: This should be cleaner -- Terminal in front, only one window, focus back to the cat'er afterwards
                        set newTab to do script cmdPrefix & "if [[ -x `which brew` ]];then brew install ffmpeg;else /usr/bin/ruby -e \"$(/usr/bin/curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)\";brew install ffmpeg mp4v2;fi"
                        delay 4
                        repeat
                            delay 0.1
                            if not busy of newTab then exit repeat
                        end repeat
                    end tell
                     -- TODO: This needs a better test, i.e., check if ffmpeg is actually accessible on the path
                    display dialog "FFMPEG was successfully installed"
                    -- TODO: This should actually work! (Bring us back to the foreground)
                    activate current application
                on error number error_number
                    display dialog "FFMPEG did not successfully install"
                end try
            end If
            If button returned of result is "Quit" then
                -- Fix!
                current application's NSApp's terminate()
            end If
        end try
    end awakeFromNib

    on btnGetTracks_(sender)
        -- Code to add iTunes tracks to our list
        -- via http://dougscripts.com/itunes/itinfo/info02.php and http://www.randomsequence.com/articles/applescript-to-send-selected-itunes-tracks-using-mail/
        tell application "iTunes"
            set these_titles to {}
            set these_times to {}
            set these_files to {}
            set the_index to {}
            if selection is not {} then -- there ARE tracks selected...
                set mySelection to selection
                set i to 1
                repeat with aTrack in mySelection
                    if class of aTrack is file track then
                        set end of these_titles to ((name of aTrack) as string)
                        set end of these_times to ((time of aTrack) as string)
                        set end of these_files to (posix path of (get location of aTrack))
                        set end of the_index to (count of these_titles)
                        -- Get metadata from the first track
                        if i is 1 then
                            set pcatArtist to ((artist of aTrack) as string)
                            set pcatAlbum to ((album of aTrack) as string)
                            set pcatComposer to ((composer of aTrack) as string)
                            set pcatGenre to ((genre of aTrack) as string)
                            set pcatDisc to ((disc number of aTrack) as string)
                            set pcatDiscs to ((disc count of aTrack) as string)
                            set pcatAlbumArtist to ((album artist of aTrack) as string)
                            set pcatYear to ((year of aTrack) as string)
                        end if
                        set i to (i + 1)
                    end if
                end repeat
            end if
        end tell
        -- Display the songs to be concatenated
        -- via http://stackoverflow.com/questions/25537750/setstringvalue-with-applescript-list
        set olddelimeters to AppleScript's text item delimiters
        set AppleScript's text item delimiters to "\n"
        set disp_titles to these_titles as string
        trackTable's setStringValue_(disp_titles)
        set AppleScript's text item delimiters to olddelimeters
        -- Update the default metadata
        catArtist's setStringValue_(pcatArtist)
        catAlbum's setStringValue_(pcatAlbum)
        catComposer's setStringValue_(pcatComposer)
        catGenre's setStringValue_(pcatGenre)
        catDisc's setStringValue_(pcatDisc)
        catDiscs's setStringValue_(pcatDiscs)
        catAlbumArtist's setStringValue_(pcatAlbumArtist)
        catYear's setStringValue_(pcatYear)
    end btnGetTracks_

    on btnConcatenate_(sender)
        -- Update the metadata variables with the user's input
        set pcatName to catName's stringValue()
        set pcatArtist to catArtist's stringValue()
        set pcatAlbum to catAlbum's stringValue()
        set pcatComposer to catComposer's stringValue()
        set pcatGenre to catGenre's stringValue()
        set pcatTrack to catTrack's stringValue()
        set pcatTracks to catTracks's stringValue()
        set pcatDisc to catDisc's stringValue()
        set pcatDiscs to catDiscs's stringValue()
        set pcatAlbumArtist to catAlbumArtist's stringValue()
        set pcatYear to catYear's stringValue()
        set the_pipes to {}
        repeat with theIndex in the_index
            -- TODO: Needs error checking!
            -- TODO: We need to check what kind of audio files we have, then adjust accordingly
            do shell script (cmdPrefix & "ffmpeg -i \"" & (item theIndex of these_files as text) & "\" -c copy -bsf:v h264_mp4toannexb -f mpegts /private/tmp/concat" & theIndex & ".ts 2> /dev/null" as text)
            log ("Processed file number" & theIndex) as text
            set end of the_pipes to ("/private/tmp/concat" & theIndex & ".ts" as text)
        end repeat
        -- Run the actual concatenation command in ffmpeg (for mp4/AAC files only!)
        -- via https://trac.ffmpeg.org/wiki/How%20to%20concatenate%20(join,%20merge)%20media%20files
        set olddelimeters to AppleScript's text item delimiters
        set AppleScript's text item delimiters to "|"
        set disp_thepipes to the_pipes as string
        do shell script (cmdPrefix & "ffmpeg -f mpegts -i \"concat:" & (disp_thepipes as text) & "\" -c copy -bsf:a aac_adtstoasc /private/tmp/cat.mp4")
        set AppleScript's text item delimiters to olddelimeters
        -- Now let's create the chapter file
        repeat with theIndex in the_index
            if theIndex < 2 then
                do shell script ("/bin/echo \"00:00:00.000 " & (item theIndex of these_titles as text) & "\" > /private/tmp/cat.chapters.txt" as text)
                set theCounter to (do shell script (cmdPrefix & "ffprobe -loglevel panic -show_streams /private/tmp/concat" & (theIndex as text) & ".ts | egrep -m 1 'duration=[0-9]+\\.' | sed 's/duration=\\([0-9]*[0-9]\\)\\.[0-9]*/\\1/'" as text) as string)
            else
                set theDateStamp to do shell script (cmdPrefix & "t="& (theCounter as text) & ";((sec=t%60, t/=60, min=t%60, hrs=t/60));timestamp=$(printf \"%02d:%02d:%02d\" $hrs $min $sec);/bin/echo $timestamp" as text)
                do shell script ("/bin/echo \"" & (theDateStamp as text) & ".000 " & (item theIndex of these_titles as text) & "\" >> /private/tmp/cat.chapters.txt" as text)
                log ("Before the addition, theCounter is " & theCounter) as text
                set theCounter to do shell script (cmdPrefix & "t=" & theCounter & ";t=`echo $t\"+\\`ffprobe -loglevel panic -show_streams /private/tmp/concat" & (theIndex as text) & ".ts | egrep -m 1 'duration=[0-9]+\\.' | sed 's/duration=\\([0-9]*[0-9]\\)\\.[0-9]*/\\1/'\\`\" | bc`;echo $t" as text)
                log ("After the addition, theCounter is " & theCounter) as text
            end if
        end repeat
        -- Chapterize cat.mp4
        do shell script (cmdPrefix & "mp4chaps -i /private/tmp/cat.mp4" as text)
        -- Add tags
        do shell script (cmdPrefix & "mp4tags -song \"" & pcatName & "\" -album \"" &  pcatAlbum & "\" -artist \"" &  pcatArtist & "\" -writer \"" &  pcatComposer & "\" -genre \"" &  pcatGenre & "\" -track \"" &  pcatTrack & "\" -tracks \"" &  pcatTracks & "\" -disk \"" &  pcatDisc & "\" -disks \"" &  pcatDiscs & "\" -albumartist \"" & pcatAlbumArtist & "\" -year \"" & pcatYear & "\" /private/tmp/cat.mp4" as text)
        -- Clean up
        do shell script "/bin/rm /private/tmp/concat* /private/tmp/cat.chapters.txt #/private/tmp/cat.mp4"
        set theCounter to ""
    end btnConcatenate_

	on applicationWillFinishLaunching_(aNotification)
		-- Insert code here to initialize your application before any files are opened
	end applicationWillFinishLaunching_

	on applicationShouldTerminate_(sender)
		-- Insert code here to do any housekeeping before your application quits
		return current application's NSTerminateNow
	end applicationShouldTerminate_

end script


support file name utf8 encoded

support file name utf8 encoded

JsOsaDAS1.001.00bplist00VscriptoO//  The MIT License (MIT)
//  Copyright  2017 Lex Tang, http://lexrus.com
//
//  https://github.com/lexrus/LTFinderButtons
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the  Software ), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
//
//  THE SOFTWARE IS PROVIDED  AS IS , WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.

var app = Application.currentApplication()
app.includeStandardAdditions = true

ObjC.import("Foundation")

function urlPathToPosixPath(path) {
	return unescape(path)
	    .replace(/^\/?file[:]\/+/i, '/')
		.replace(/(")/g, '\\$1')
}

function getCurrentFinderPath() {
	var Finder = Application('Finder')
	var item = Finder.selection()[0]
	if (!item) {
		try {
			return urlPathToPosixPath(Finder.windows[0].target().url())
		} catch (e) {
			return urlPathToPosixPath(Finder.desktop().url())
		}
	}
	return urlPathToPosixPath(item.url())
}

var currentFolderPath =decodeURIComponent(escape(getCurrentFinderPath()))
app.setTheClipboardTo(currentFolderPath)jscrޭ

JsOsaDAS1.001.00bplist00Vscripto4//  The MIT License (MIT)
//  Copyright  2017 Lex Tang, http://lexrus.com
//
//  https://github.com/lexrus/LTFinderButtons
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the  Software ), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
//
//  THE SOFTWARE IS PROVIDED  AS IS , WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.

var app = Application.currentApplication()
app.includeStandardAdditions = true

ObjC.import("Foundation")

function urlPathToPosixPath(path) {
	return unescape(path)
	    .replace(/^\/?file[:]\/+/i, '/')
		.replace(/(")/g, '\\$1')
}

function getCurrentFinderPath() {
	var Finder = Application('Finder')
	var item = Finder.selection()[0]
	if (!item) {
		try {
			return urlPathToPosixPath(Finder.windows[0].target().url())
		} catch (e) {
			return urlPathToPosixPath(Finder.desktop().url())
		}
	}
	return urlPathToPosixPath(item.url())
}

var currentFolderPath = getCurrentFinderPath()
app.setTheClipboardTo(currentFolderPath)~jscrޭ


Ugh what is going on

Ugh what is going on

FasdUAS 1.101.10
k
l
I
.miscactvnullnull
m		@alispMacintosh HDBDNotificationCenter.app
 cuCoreServices5/:System:Library:CoreServices:NotificationCenter.app/.NotificationCenter.appMacintosh HD2System/Library/CoreServices/NotificationCenter.app/

l
O

O

T
k
l
Q1
r(
n&
4#&

sgrp
m$%
n#
4 #

uiel
 m!"
n !"
!4 #

scra
#m
"4$

cwin
$m%%&&&Notification Center
o0	thewindow	theWindow
R
.ascrerr ********
S01'(
'l22()
)Q2*+
*k5,,-.
-r5:/0
/n5812
1268

actT
2o560	thewindow	theWindow
0o0
theactions
theActions.34
3l;;456
5l;;787SM Try to close the whole group first. If that fails, close individual windows.899 Try to close the whole group first. If that fails, close individual windows.6:;
:X;t<=
<ZMo>?
>=MV@A
@nMRBC
B1NR

desc
CoMN0	theaction	theAction
AmRUDDEEClear All
?kYkFFGH
GrY^IJ
ImYZ
boovtrue
Jo
0closedHKL
KO_iMN
MIchO
.prcsperfnullactT
Oocd0	theaction	theAction
No_`0	thewindow	theWindowLP
PSjk0	theaction	theAction
=o>?0
theactions
theActions;QR
QluuRST
SXuUV
UZWX
W=YZ
Yn[\
[1

desc
\o0	theaction	theAction
Zm]]^^
Close
Xk__`a
`rbc
bm
boovtrue
co
0closedade
dOfg
fIh
.prcsperfnullactT
ho0	theaction	theAction
go0	thewindow	theWindowei
iS0	theaction	theAction
Voxy0
theactions
theActionsTj
jl
+R
.ascrerr ********
4
k

prcs
km
llmm&Notification Center

mnnsevsalis\Macintosh HDBDSystem Events.app
 cuCoreServices0/:System:Library:CoreServices:System Events.app/$System Events.appMacintosh HD-System/Library/CoreServices/System Events.app/opqro
.aevtoappnull****0	thewindow	theWindow0
theactions
theActions
0closedpstu
.aevtoappnull****
skvvww
t0	theaction	theActionu	nl%D]
.miscactvnullnull

prcs

cwin

scra

uiel

sgrp0	thewindow	theWindow

actT0
theactions
theActions

kocl

cobj
.corecnte********

desc
0closed
.prcsperfnullactTjO*/hZ*/k/k/k/EWXO-EO8[alkha,aeE`OjUOYh[OYO8[alkha,aeE`OjUOYh[OYOPWXh[OYYUUqxxyyzz{{|}|n~

pcap~$NotificationCenter

cwin}&Notification Center

scra

uiel

sgrprn

pcap$NotificationCenter

cwin&Notification Center

scra

uiel

sgrp

actT"AXScrollToVisiblen

pcap$NotificationCenter

cwin&Notification Center

scra

uiel

sgrp

actTAXShowMenu
boovtrueascr
ޭ

FasdUAS 1.101.10
k
l
I
.miscactvnullnull
m		@alispMacintosh HDBDNotificationCenter.app
 cuCoreServices5/:System:Library:CoreServices:NotificationCenter.app/.NotificationCenter.appMacintosh HD2System/Library/CoreServices/NotificationCenter.app/

l
O

O

T
k
l
Q1
r(
n&
4#&

sgrp
m$%
n#
4 #

uiel
 m!"
n !"
!4 #

scra
#m
"4$

cwin
$m%%&&&Notification Center
o0	thewindow	theWindow
R
.ascrerr ********
S01'(
'l22()
)Q2*+
*k5,,-.
-r5:/0
/n5812
1268

actT
2o560	thewindow	theWindow
0o0
theactions
theActions.34
3l;;456
5l;;787SM Try to close the whole group first. If that fails, close individual windows.899 Try to close the whole group first. If that fails, close individual windows.6:;
:X;t<=
<ZMo>?
>=MV@A
@nMRBC
B1NR

desc
CoMN0	theaction	theAction
AmRUDDEEClear All
?kYkFFGH
GrY^IJ
ImYZ
boovtrue
Jo
0closedHKL
KO_iMN
MIchO
.prcsperfnullactT
Oocd0	theaction	theAction
No_`0	thewindow	theWindowLP
PSjk0	theaction	theAction
=o>?0
theactions
theActions;QR
QluuRST
SXuUV
UZWX
W=YZ
Yn[\
[1

desc
\o0	theaction	theAction
Zm]]^^
Close
Xk__`a
`rbc
bm
boovtrue
co
0closedade
dOfg
fIh
.prcsperfnullactT
ho0	theaction	theAction
go0	thewindow	theWindowei
iS0	theaction	theAction
Voxy0
theactions
theActionsTj
jl
+R
.ascrerr ********
4
k

prcs
km
llmm&Notification Center

mnnsevsalis\Macintosh HDBDSystem Events.app
 cuCoreServices0/:System:Library:CoreServices:System Events.app/$System Events.appMacintosh HD-System/Library/CoreServices/System Events.app/opo
.aevtoappnull****pqrs
.aevtoappnull****
qkttuu
r0	theaction	theActions	nl%D]
.miscactvnullnull

prcs

cwin

scra

uiel

sgrp0	thewindow	theWindow

actT0
theactions
theActions

kocl

cobj
.corecnte********

desc
0closed
.prcsperfnullactTjO*/hZ*/k/k/k/EWXO-EO8[alkha,aeE`OjUOYh[OYO8[alkha,aeE`OjUOYh[OYOPWXh[OYYUUascr
ޭ


Reorganize and clean up workflow parameters

-- core configuration --

-- configurable options --

-- limit number of songs to improve efficiency
property resultLimit : 15
-- whether or not to retrieve/display album artwork for each result
property albumArtEnabled : true

-- workflow parameters --

-- workflow folders
property libraryFolder : (path to library folder from user domain as text)
property cacheFolder : (libraryFolder & "Caches:")
property alfredWorkflowDataFolder : (cacheFolder & "com.runningwithcrayons.Alfred:Workflow Data:")
property bundleId : "com.calebevans.playsong"
property workflowCacheFolder : (alfredWorkflowDataFolder & bundleId & ":") as text

-- album artwork folders
property artworkDocsFolder : ((get path to library folder from user domain as text) & "Containers:com.apple.AMPArtworkAgent:Data:Documents")
property artworkImageFolder : (artworkDocsFolder & ":artwork:")

-- the default icon used for search results without album artwork
property defaultIconName : "resources/icon-noartwork.png"
-- the name of the playlist used by the workflow for playing songs
property workflowPlaylistName : "Alfred Play Song"
-- list of Alfred results
property resultList : {}

-- replaces substring in string with another substring
on replace(replaceThis, replaceWith, theString)

	set oldDelims to AppleScript's text item delimiters
	set AppleScript's text item delimiters to replaceThis
	set strItems to text items of theString
	set AppleScript's text item delimiters to replaceWith
	set newString to strItems as text
	set AppleScript's text item delimiters to oldDelims
	return newString

end replace

-- retrieve the plural/singular form of a quantity based on the given number
on quantifyNumber(theNumber, quantityName, pluralQuantityName)

	if theNumber is 1 then

		set theString to (theNumber as text) & space & quantityName

	else

		set theString to (theNumber as text) & space & pluralQuantityName

	end if

	return theString

end quantifyNumber

-- encodes JSON reserved characters in the given string
on encodeFeedbackChars(theString)

	set theString to replace("\\", "\\\\", theString)
	set theString to replace("\"", "\\\"", theString)
	return theString

end encodeFeedbackChars

-- decodes JSON reserved characters in the given string
on decodeFeedbackChars(theString)

	set theString to replace("\\\\", "\\", theString)
	set theString to replace("\\\"", "\"", theString)
	return theString

end decodeFeedbackChars

-- adds Alfred result to result list
on addResult(theResult)

	copy theResult to the end of resultList

end addResult

-- adds item for "No Results" message
on addNoResultsItem(query, queryType)

	addResult({uid:"no-results", valid:"no", title:"No Results Found", subtitle:("No " & queryType & "s matching '" & query & "'"), icon:defaultIconName})

end addNoResultsItem

on resultListIsFull()

	return (length of resultList is resultLimit)

end resultListIsFull

on resultListIsEmpty()

	return (length of resultList is 0)

end resultListIsFull

-- builds Alfred result item as JSON
on getResultFeedback(theResult)

	-- encode reserved JSON characters
	set resultUid to encodeFeedbackChars(uid of theResult)
	set resultValid to (valid of theResult) as text
	set resultTitle to encodeFeedbackChars(title of theResult)
	set resultSubtitle to encodeFeedbackChars(subtitle of theResult)

	if (icon of theResult) contains ":" then

		set resultIcon to encodeFeedbackChars(POSIX path of icon of theResult)

	else

		set resultIcon to icon of theResult

	end if

	set json to "{"
	set json to json & "\"uid\":\"" & resultUid & "\","
	set json to json & "\"arg\":\"" & resultUid & "\","
	set json to json & "\"valid\":\"" & resultValid & "\","
	set json to json & "\"title\":\"" & resultTitle & "\","
	set json to json & "\"subtitle\":\"" & resultSubtitle & "\","
	set json to json & "\"icon\":{\"path\":\"" & resultIcon & "\"}"
	set json to json & "}"
	return json

end getResultFeedback

-- retrieves JSON document for Alfred results
on getResultListFeedback()

	set json to "{\"items\": ["

	repeat with theResult in resultList

		set json to json & getResultFeedback(theResult)
		set json to json & ","

	end repeat

	-- remove trailing comma after last item
	set json to text 1 thru (length of json - 1) of json
	set json to json & "]}"
	return json

end getResultListFeedback

-- writes the given content to the given file
on fileWrite(theFile, theContent)

	set fileRef to open for access theFile with write permission
	try
		set eof of fileRef to 0
		write theContent to fileRef starting at eof
		close access fileRef
	on error
		close access fileRef
	end try

end fileWrite

-- query path to artwork image file cached natively by Music.app in Catalina
on getSongArtworkPath(theSong)

	try

		if albumArtEnabled is false then return defaultIconName

		tell application "Music"

			-- get persistent ID of song and convert from hexadecimal to decimal (base-10)
			set hexSongId to persistent ID of theSong
			set decSongId to (do shell script "echo $((16#" & hexSongId & "))")

			-- retrieve filename of cached artwork
			set artworkName to (do shell script ("/usr/bin/sqlite3 " & (POSIX path of artworkDocsFolder) & "/artworkd.sqlite '" & ¬
			"select ZHASHSTRING, ZKIND from ZIMAGEINFO where Z_PK = (" & ¬
			"(select ZIMAGEINFO from ZSOURCEINFO where Z_PK = (" & ¬
			"select ZSOURCEINFO from ZDATABASEITEMINFO where ZPERSISTENTID = " & ¬
			decSongId & ")))' | " & ¬
			"awk '{split($0,a,\"|\"); print a[1] \"_sk_\" a[2] \"_cid_1.jpeg\"}'"))

			set artworkPath to (artworkImageFolder & artworkName)

		end tell

		return artworkPath

	on error errorMessage

		log errorMessage

	end try

end getNativeCachedArtworkPath

-- creates album artwork cache
on createWorkflowPlaylist()

	tell application "Music"

		if not (user playlist workflowPlaylistName exists) then

			make new user playlist with properties {name:workflowPlaylistName, shuffle:false}

		end if

	end tell

end createWorkflowPlaylist

on clearQueue()

	tell application "Music"

		if user playlist workflowPlaylistName exists then

			delete tracks of user playlist workflowPlaylistName

		end if

	end tell

end clearQueue

on queueSongs(theSongs)

	tell application "Music"

		repeat with theSong in theSongs

			duplicate theSong to user playlist workflowPlaylistName

		end repeat

	end tell

end queueSongs

on playQueue()

	tell application "Music"

		if number of tracks in user playlist workflowPlaylistName is not 0 then

			play user playlist workflowPlaylistName

		end if

	end tell

end playQueue

on getPlaylist(playlistId)

	tell application "Music"

		return (first playlist whose id is playlistId)

	end tell

end getPlaylist

on getPlaylistSongs(playlistId)

	tell application "Music"

		set thePlaylist to getPlaylist(playlistId) of me
		set playlistSongs to every track of thePlaylist

	end tell

	return playlistSongs

end getPlaylistSongs

-- retrieves list of artist names for the given genre
on getGenreArtists(genreName)

	tell application "Music"

		set genreSongs to every track of playlist 2 whose genre is genreName
		set artistNames to {}

		repeat with theSong in genreSongs

			if (artist of theSong) is not in artistNames then

				set artistNames to artistNames & (artist of theSong)

			end if

		end repeat

	end tell

	return artistNames

end getGenreArtists

-- retrieves list of songs within the given genre, sorted by artist
on getGenreSongs(genreName)

	set artistNames to getGenreArtists(genreName) of me
	set genreSongs to {}

	repeat with artistName in artistNames

		set genreSongs to genreSongs & getArtistSongs(artistName) of me

	end repeat

	return genreSongs

end getGenreSongs

-- retrieves list of album names for the given artist
on getArtistAlbums(artistName)

	tell application "Music"

		set artistSongs to every track of playlist 2 whose artist is artistName
		set albumNames to {}

		repeat with theSong in artistSongs

			if (album of theSong) is not in albumNames then

				set albumNames to albumNames & (album of theSong)

			end if

		end repeat

	end tell

	return albumNames

end getArtistAlbums

-- retrieves list of songs by the given artist, sorted by album
on getArtistSongs(artistName)

	tell application "Music"

		set albumNames to getArtistAlbums(artistName) of me
		set artistSongs to {}

		repeat with albumName in albumNames

			set albumSongs to (every track of playlist 2 whose artist is artistName and album is albumName)
			set artistSongs to artistSongs & albumSongs

		end repeat

	end tell

	return artistSongs

end getArtistSongs

-- retrieves list of songs in the given album
on getAlbumSongs(albumName)

	tell application "Music"

		set albumSongs to every track of playlist 2 whose album is albumName

	end tell

	return albumSongs

end getAlbumSongs

-- retrieves the song with the given ID
on getSong(songId)

	tell application "Music"

		set theSong to first track of playlist 2 whose database ID is songId

	end tell

	return theSong

end getSong

-- retrieves a list of objects or names matching the given query and type
on getResultsFromQuery(query, queryType)

	set evalScript to run script "
	script

		on findResults(query, queryType, resultLimit)

			tell application \"Music\"

				set theSongs to (get every track in playlist 2 whose " & queryType & " starts with query)

				if length of theSongs < resultLimit then

					set theSongs to theSongs & (get every track in playlist 2 whose " & queryType & " contains (space & query) and " & queryType & " does not start with query)

				end if

				if length of theSongs < resultLimit then

					set theSongs to theSongs & (get every track in playlist 2 whose " & queryType & " contains query and " & queryType & " does not start with query and " & queryType & " does not contain (space & query))

				end if

				if length of theSongs is 0 then

					if queryType is \"name\" then

						set theSongs to theSongs & (search playlist 2 for query only songs)

					else if queryType is not \"genre\" then

						set theSongs to theSongs & (search playlist 2 for query only " & queryType & "s)

					end if

				end if

				if queryType is \"name\" then

					if length of theSongs > resultLimit then

						set theSongs to items 1 thru resultLimit of theSongs

					end if

					set theResults to theSongs

				else

					set theResults to {}

					repeat with theSong in theSongs

						if length of theResults is resultLimit then exit repeat

						set theResult to " & queryType & " of theSong

						if theResult is not in theResults then

							set theResults to theResults & theResult

						end if

					end repeat

				end if

			end tell

			return theResults

		end findResults

	end script
	"

	evalScript's findResults(query, queryType, resultLimit)

end getResultsFromQuery

-- returns the given string with leading and trailing whitespace removed
on trimWhitespace(theString)

	-- trim leading whitespace
	repeat while theString begins with space

		if length of theString is 1 then return ""
		set theString to text 2 thru end of theString

	end repeat

	-- trim trailing whitespace
	repeat while theString ends with space

		set theString to text 1 thru ((length of theString) - 1) of theString

	end repeat

	return theString

end trimWhitespace

-- queues the song with the given ID
on queueSong(songId)

	set theSong to getSong(songId)
	queueSongs({theSong})

end queueSong

-- queues all songs belonging to the given album
on queueAlbum(albumName)

	set albumName to decodeFeedbackChars(albumName)
	set albumSongs to getAlbumSongs(albumName)
	queueSongs(albumSongs)

end queueAlbum

-- queues all songs by the given artist
on queueArtist(artistName)

	set artistName to decodeFeedbackChars(artistName)
	set artistSongs to getArtistSongs(artistName)
	queueSongs(artistSongs)

end queueArtist

-- queues all songs within the given genre
on queueGenre(genreName)

	set genreName to decodeFeedbackChars(genreName)
	set genreSongs to getGenreSongs(genreName)
	queueSongs(genreSongs)

end queueGenre

-- queues all songs in the given playlist
on queuePlaylist(playlistId)

	set playlistSongs to getPlaylistSongs(playlistId)
	queueSongs(playlistSongs)

end queuePlaylist

-- parses the given result query to retrieve type and id of item to queue
on parseResultQuery(query)

	set pos to offset of "-" in query
	set theType to text 1 thru (pos - 1) of query
	set theId to text (pos + 1) thru end of query
	return {type:theType, id:theId}

end parseResultQuery

on queue(query)

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

	createWorkflowPlaylist()

	if theType is "song" then
		queueSong(theId)
	else if theType is "album" then
		queueAlbum(theId)
	else if theType is "artist" then
		queueArtist(theId)
	else if theType is "genre" then
		queueGenre(theId)
	else if theType is "playlist" then
		queuePlaylist(theId)
	else
		log "Unsupported type: " & theType
	end if

end queue

on play(query)

	clearQueue()
	queue(query)
	playQueue()

end play

-- core configuration --

-- configurable options --

-- limit number of songs to improve efficiency
property resultLimit : 15
-- whether or not to retrieve/display album artwork for each result
property albumArtEnabled : true

-- workflow parameters --

property homeFolder : (path to home folder as text)
property libraryFolder : (path to library folder from user domain as text)
property cacheFolder : (libraryFolder & "Caches:")
property alfredWorkflowDataFolder : (cacheFolder & "com.runningwithcrayons.Alfred:Workflow Data:")
property bundleId : "com.calebevans.playsong"
property workflowCacheFolder : (alfredWorkflowDataFolder & bundleId & ":") as text
property artworkDocsFolder : ((get path to library folder from user domain as text) & "Containers:com.apple.AMPArtworkAgent:Data:Documents")
property artworkImageFolder : (artworkDocsFolder & ":artwork:")
property songArtworkNameSep : " | "
property defaultIconName : "resources/icon-noartwork.png"
-- the name of the playlist used by the workflow for playing songs
property workflowPlaylistName : "Alfred Play Song"
-- list of Alfred results
property resultList : {}

-- replaces substring in string with another substring
on replace(replaceThis, replaceWith, theString)

	set oldDelims to AppleScript's text item delimiters
	set AppleScript's text item delimiters to replaceThis
	set strItems to text items of theString
	set AppleScript's text item delimiters to replaceWith
	set newString to strItems as text
	set AppleScript's text item delimiters to oldDelims
	return newString

end replace

-- retrieve the plural/singular form of a quantity based on the given number
on quantifyNumber(theNumber, quantityName, pluralQuantityName)

	if theNumber is 1 then

		set theString to (theNumber as text) & space & quantityName

	else

		set theString to (theNumber as text) & space & pluralQuantityName

	end if

	return theString

end quantifyNumber

-- encodes JSON reserved characters in the given string
on encodeFeedbackChars(theString)

	set theString to replace("\\", "\\\\", theString)
	set theString to replace("\"", "\\\"", theString)
	return theString

end encodeFeedbackChars

-- decodes JSON reserved characters in the given string
on decodeFeedbackChars(theString)

	set theString to replace("\\\\", "\\", theString)
	set theString to replace("\\\"", "\"", theString)
	return theString

end decodeFeedbackChars

-- adds Alfred result to result list
on addResult(theResult)

	copy theResult to the end of resultList

end addResult

-- adds item for "No Results" message
on addNoResultsItem(query, queryType)

	addResult({uid:"no-results", valid:"no", title:"No Results Found", subtitle:("No " & queryType & "s matching '" & query & "'"), icon:defaultIconName})

end addNoResultsItem

on resultListIsFull()

	return (length of resultList is resultLimit)

end resultListIsFull

on resultListIsEmpty()

	return (length of resultList is 0)

end resultListIsFull

-- builds Alfred result item as JSON
on getResultFeedback(theResult)

	-- encode reserved JSON characters
	set resultUid to encodeFeedbackChars(uid of theResult)
	set resultValid to (valid of theResult) as text
	set resultTitle to encodeFeedbackChars(title of theResult)
	set resultSubtitle to encodeFeedbackChars(subtitle of theResult)

	if (icon of theResult) contains ":" then

		set resultIcon to encodeFeedbackChars(POSIX path of icon of theResult)

	else

		set resultIcon to icon of theResult

	end if

	set json to "{"
	set json to json & "\"uid\":\"" & resultUid & "\","
	set json to json & "\"arg\":\"" & resultUid & "\","
	set json to json & "\"valid\":\"" & resultValid & "\","
	set json to json & "\"title\":\"" & resultTitle & "\","
	set json to json & "\"subtitle\":\"" & resultSubtitle & "\","
	set json to json & "\"icon\":{\"path\":\"" & resultIcon & "\"}"
	set json to json & "}"
	return json

end getResultFeedback

-- retrieves JSON document for Alfred results
on getResultListFeedback()

	set json to "{\"items\": ["

	repeat with theResult in resultList

		set json to json & getResultFeedback(theResult)
		set json to json & ","

	end repeat

	-- remove trailing comma after last item
	set json to text 1 thru (length of json - 1) of json
	set json to json & "]}"
	return json

end getResultListFeedback

-- writes the given content to the given file
on fileWrite(theFile, theContent)

	set fileRef to open for access theFile with write permission
	try
		set eof of fileRef to 0
		write theContent to fileRef starting at eof
		close access fileRef
	on error
		close access fileRef
	end try

end fileWrite

-- query path to artwork image file cached natively by Music.app in Catalina
on getSongArtworkPath(theSong)

	try

		if albumArtEnabled is false then return defaultIconName

		tell application "Music"

			-- get persistent ID of song and convert from hexadecimal to decimal (base-10)
			set hexSongId to persistent ID of theSong
			set decSongId to (do shell script "echo $((16#" & hexSongId & "))")

			-- retrieve filename of cached artwork
			set artworkName to (do shell script ("/usr/bin/sqlite3 " & (POSIX path of artworkDocsFolder) & "/artworkd.sqlite '" & ¬
			"select ZHASHSTRING, ZKIND from ZIMAGEINFO where Z_PK = (" & ¬
			"(select ZIMAGEINFO from ZSOURCEINFO where Z_PK = (" & ¬
			"select ZSOURCEINFO from ZDATABASEITEMINFO where ZPERSISTENTID = " & ¬
			decSongId & ")))' | " & ¬
			"awk '{split($0,a,\"|\"); print a[1] \"_sk_\" a[2] \"_cid_1.jpeg\"}'"))

			set artworkPath to (artworkImageFolder & artworkName)

		end tell

		return artworkPath

	on error errorMessage

		log errorMessage

	end try

end getNativeCachedArtworkPath

-- creates album artwork cache
on createWorkflowPlaylist()

	tell application "Music"

		if not (user playlist workflowPlaylistName exists) then

			make new user playlist with properties {name:workflowPlaylistName, shuffle:false}

		end if

	end tell

end createWorkflowPlaylist

on clearQueue()

	tell application "Music"

		if user playlist workflowPlaylistName exists then

			delete tracks of user playlist workflowPlaylistName

		end if

	end tell

end clearQueue

on queueSongs(theSongs)

	tell application "Music"

		repeat with theSong in theSongs

			duplicate theSong to user playlist workflowPlaylistName

		end repeat

	end tell

end queueSongs

on playQueue()

	tell application "Music"

		if number of tracks in user playlist workflowPlaylistName is not 0 then

			play user playlist workflowPlaylistName

		end if

	end tell

end playQueue

on getPlaylist(playlistId)

	tell application "Music"

		return (first playlist whose id is playlistId)

	end tell

end getPlaylist

on getPlaylistSongs(playlistId)

	tell application "Music"

		set thePlaylist to getPlaylist(playlistId) of me
		set playlistSongs to every track of thePlaylist

	end tell

	return playlistSongs

end getPlaylistSongs

-- retrieves list of artist names for the given genre
on getGenreArtists(genreName)

	tell application "Music"

		set genreSongs to every track of playlist 2 whose genre is genreName
		set artistNames to {}

		repeat with theSong in genreSongs

			if (artist of theSong) is not in artistNames then

				set artistNames to artistNames & (artist of theSong)

			end if

		end repeat

	end tell

	return artistNames

end getGenreArtists

-- retrieves list of songs within the given genre, sorted by artist
on getGenreSongs(genreName)

	set artistNames to getGenreArtists(genreName) of me
	set genreSongs to {}

	repeat with artistName in artistNames

		set genreSongs to genreSongs & getArtistSongs(artistName) of me

	end repeat

	return genreSongs

end getGenreSongs

-- retrieves list of album names for the given artist
on getArtistAlbums(artistName)

	tell application "Music"

		set artistSongs to every track of playlist 2 whose artist is artistName
		set albumNames to {}

		repeat with theSong in artistSongs

			if (album of theSong) is not in albumNames then

				set albumNames to albumNames & (album of theSong)

			end if

		end repeat

	end tell

	return albumNames

end getArtistAlbums

-- retrieves list of songs by the given artist, sorted by album
on getArtistSongs(artistName)

	tell application "Music"

		set albumNames to getArtistAlbums(artistName) of me
		set artistSongs to {}

		repeat with albumName in albumNames

			set albumSongs to (every track of playlist 2 whose artist is artistName and album is albumName)
			set artistSongs to artistSongs & albumSongs

		end repeat

	end tell

	return artistSongs

end getArtistSongs

-- retrieves list of songs in the given album
on getAlbumSongs(albumName)

	tell application "Music"

		set albumSongs to every track of playlist 2 whose album is albumName

	end tell

	return albumSongs

end getAlbumSongs

-- retrieves the song with the given ID
on getSong(songId)

	tell application "Music"

		set theSong to first track of playlist 2 whose database ID is songId

	end tell

	return theSong

end getSong

-- retrieves a list of objects or names matching the given query and type
on getResultsFromQuery(query, queryType)

	set evalScript to run script "
	script

		on findResults(query, queryType, resultLimit)

			tell application \"Music\"

				set theSongs to (get every track in playlist 2 whose " & queryType & " starts with query)

				if length of theSongs < resultLimit then

					set theSongs to theSongs & (get every track in playlist 2 whose " & queryType & " contains (space & query) and " & queryType & " does not start with query)

				end if

				if length of theSongs < resultLimit then

					set theSongs to theSongs & (get every track in playlist 2 whose " & queryType & " contains query and " & queryType & " does not start with query and " & queryType & " does not contain (space & query))

				end if

				if length of theSongs is 0 then

					if queryType is \"name\" then

						set theSongs to theSongs & (search playlist 2 for query only songs)

					else if queryType is not \"genre\" then

						set theSongs to theSongs & (search playlist 2 for query only " & queryType & "s)

					end if

				end if

				if queryType is \"name\" then

					if length of theSongs > resultLimit then

						set theSongs to items 1 thru resultLimit of theSongs

					end if

					set theResults to theSongs

				else

					set theResults to {}

					repeat with theSong in theSongs

						if length of theResults is resultLimit then exit repeat

						set theResult to " & queryType & " of theSong

						if theResult is not in theResults then

							set theResults to theResults & theResult

						end if

					end repeat

				end if

			end tell

			return theResults

		end findResults

	end script
	"

	evalScript's findResults(query, queryType, resultLimit)

end getResultsFromQuery

-- returns the given string with leading and trailing whitespace removed
on trimWhitespace(theString)

	-- trim leading whitespace
	repeat while theString begins with space

		if length of theString is 1 then return ""
		set theString to text 2 thru end of theString

	end repeat

	-- trim trailing whitespace
	repeat while theString ends with space

		set theString to text 1 thru ((length of theString) - 1) of theString

	end repeat

	return theString

end trimWhitespace

-- queues the song with the given ID
on queueSong(songId)

	set theSong to getSong(songId)
	queueSongs({theSong})

end queueSong

-- queues all songs belonging to the given album
on queueAlbum(albumName)

	set albumName to decodeFeedbackChars(albumName)
	set albumSongs to getAlbumSongs(albumName)
	queueSongs(albumSongs)

end queueAlbum

-- queues all songs by the given artist
on queueArtist(artistName)

	set artistName to decodeFeedbackChars(artistName)
	set artistSongs to getArtistSongs(artistName)
	queueSongs(artistSongs)

end queueArtist

-- queues all songs within the given genre
on queueGenre(genreName)

	set genreName to decodeFeedbackChars(genreName)
	set genreSongs to getGenreSongs(genreName)
	queueSongs(genreSongs)

end queueGenre

-- queues all songs in the given playlist
on queuePlaylist(playlistId)

	set playlistSongs to getPlaylistSongs(playlistId)
	queueSongs(playlistSongs)

end queuePlaylist

-- parses the given result query to retrieve type and id of item to queue
on parseResultQuery(query)

	set pos to offset of "-" in query
	set theType to text 1 thru (pos - 1) of query
	set theId to text (pos + 1) thru end of query
	return {type:theType, id:theId}

end parseResultQuery

on queue(query)

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

	createWorkflowPlaylist()

	if theType is "song" then
		queueSong(theId)
	else if theType is "album" then
		queueAlbum(theId)
	else if theType is "artist" then
		queueArtist(theId)
	else if theType is "genre" then
		queueGenre(theId)
	else if theType is "playlist" then
		queuePlaylist(theId)
	else
		log "Unsupported type: " & theType
	end if

end queue

on play(query)

	clearQueue()
	queue(query)
	playQueue()

end play


Updated SpamScript app

Updated SpamScript app

FasdUAS 1.101.10
k
l

r

n

1

ttxt
l
I

.sysodlogaskrTEXT

m0What shall I spam, baby?

dtxt
m

disp
m
stic
	o0x
l
c
o0x
m

utxt
l
r
n !
 1

ttxt
!l"
"I#$
.sysodlogaskrTEXT
#m%%&&:How many times shall I spam??$'(

dtxt
'm))**(+

disp
+m
stic
o0y,-
,l -.
.r -/0
/n +12
11)+

ttxt
2l )3
3I )45
.sysodlogaskrTEXT
4m !6677How fast? -in seconds- After closing this dialog you have six seconds to click on the input you want me to spam.589

dtxt
8m"#::;;9<

disp
<m$%
stic
0o0z-=
=l.b>
>O.b?@
?k4aAABC
BI49
.miscactvnullnullCDE
DI:AF
.sysodelanullnmbr
Fm:=EG
GUBaHI
HkI\JJKL
KIINM
.prcskprsnullctxt
MoIJ0xLNO
NIOTP
.sysodelanullnmbr
PoOP0zOQ
QIU\R
.prcskprsnullctxt
RoUX

ret
IoEF0y
@m.1SSsevsalisMacintosh HD:H+ۓSystem Events.app	K	 CoreServicesۓےۑ=Macintosh HD:System:Library:CoreServices:System Events.app$System Events.appMacintosh HD-System/Library/CoreServices/System Events.app/TUT
.aevtoappnull****UVWX
.aevtoappnull****
VkbYYZZ[[\\,]]=WX%)6:S

dtxt

disp
stic
.sysodlogaskrTEXT

ttxt0x

utxt0y0z
.miscactvnullnull
.sysodelanullnmbr
.prcskprsnullctxt

ret c,EO&O,EO,EOa/*jOajOkhjOjO_j[OYUascrޭ

FasdUAS 1.101.10
k
l

r

n

1

ttxt
l
I

.sysodlogaskrTEXT

m0What shall I spam, baby?

dtxt
m

disp
m
stic
	o0x
l
c
o0x
m

utxt
l
r
n !
 1

ttxt
!l"
"I#$
.sysodlogaskrTEXT
#m%%&&:How many times shall I spam??$'(

dtxt
'm))**(+

disp
+m
stic
o0y,-
,l -.
.r -/0
/n +12
11)+

ttxt
2l )3
3I )45
.sysodlogaskrTEXT
4m !6677How fast? -in seconds- After closing this dialog you have six seconds to click on the input you want me to spam.589

dtxt
8m"#::;;9<

disp
<m$%
stic
0o0z-=
=l.b>
>O.b?@
?k4aAABC
BI49
.miscactvnullnullCDE
DI:AF
.sysodelanullnmbr
Fm:=EG
GUBaHI
HkI\JJKL
KIINM
.prcskprsnullctxt
MoIJ0xLNO
NIOTP
.sysodelanullnmbr
PoOP0zOQ
QIU\R
.prcskprsnullctxt
RoUX

ret
IoEF0y
@m.1SSsevsalisMacintosh HD:H+ۓSystem Events.app	K	 CoreServicesۓےۑ=Macintosh HD:System:Library:CoreServices:System Events.app$System Events.appMacintosh HD-System/Library/CoreServices/System Events.app/TUVWXT
.aevtoappnull****0x0y0zUYZ[
.aevtoappnull****
Ykb\\]]^^__,``=Z[%)6:S

dtxt

disp
stic
.sysodlogaskrTEXT

ttxt0x

utxt0y0z
.miscactvnullnull
.sysodelanullnmbr
.prcskprsnullctxt

ret c,EO&O,EO,EOa/*jOajOkhjOjO_j[OYUVaaWbbXccascrޭ


Debug

Debug

FasdUAS 1.101.10
k
i
I
.aevtoappnull****
	o0argv
k'

r

l
n
4

cobj
m
o0argv
o0	pathtopsd	pathToPsd
r

l
n
4

cobj
m

o0argv
o0	pathtojsx	pathToJsx
O'
k&
I
.miscactvnullnull !"
!I #
.PsCSodocnull****
#4$

alis
$o0	pathtopsd	pathToPsd"%&
%l!!'('% do javascript (file pathToJsx)())> do javascript (file pathToJsx)&*
*I!&
.PsCSquitnullnull
m++08BIMalisMacintosh HDΘ*SH+t[IAdobe Photoshop CC 2015.appt[J	 Adobe Photoshop CC 2015ΗAt[I#$OMacintosh HD:Applications:Adobe Photoshop CC 2015:Adobe Photoshop CC 2015.app8Adobe Photoshop CC 2015.appMacintosh HD@Applications/Adobe Photoshop CC 2015/Adobe Photoshop CC 2015.app/,
,l-.-
.aevtoappnull****./0
.aevtoappnull****0argv/0argv0+

cobj0	pathtopsd	pathToPsd0	pathtojsx	pathToJsx
.miscactvnullnull

alis
.PsCSodocnull****
.PsCSquitnullnull(k/EOl/EO*jO*/jO*jUascr
ޭ

FasdUAS 1.101.10
k
i
I
.aevtoappnull****
	o0argv
k0

r

l
n
4

cobj
m
o0argv
o0	pathtopsd	pathToPsd
r

l
n
4

cobj
m

o0argv
o0	pathtojsx	pathToJsx
O0
k/
I
.miscactvnullnull !"
!I #
.PsCSodocnull****
#4$

alis
$o0	pathtopsd	pathToPsd"%&
%I!)'
.miscDjxMutxt****
'l!%(
(4!%)

file
)o#$0	pathtojsx	pathToJsx&*
*I*/
.PsCSquitnullnull
m++08BIMalisMacintosh HDΘ*SH+t[IAdobe Photoshop CC 2015.appt[J	 Adobe Photoshop CC 2015ΗAt[I#$OMacintosh HD:Applications:Adobe Photoshop CC 2015:Adobe Photoshop CC 2015.app8Adobe Photoshop CC 2015.appMacintosh HD@Applications/Adobe Photoshop CC 2015/Adobe Photoshop CC 2015.app/,
,l-.-
.aevtoappnull****./0
.aevtoappnull****0argv/0argv0
+

cobj0	pathtopsd	pathToPsd0	pathtojsx	pathToJsx
.miscactvnullnull

alis
.PsCSodocnull****

file
.miscDjxMutxt****
.PsCSquitnullnull1k/EOl/EO*jO*/jO*/jO*j	Uascr
ޭ


Added iterm_bookmark to launch an iTerm session with a given bookmark's name.

FasdUAS 1.101.10
k
i
I
.aevtoappnull****
	o0argv
O4

k3

I
.miscactvnullnull
O
3
k2
I
.ITRMLNCHnullobj

Pssn
l
n
4

cobj
m
o0argv
r"
l
4

Pssn
 m
o
0	mysession!
!O#2"#
"I'1$
.ITRMWrtenullobj $%

iTxt
%l)-&
&n)-'(
'4*-)

cobj
)m+,
(o)*0argv
#o#$
0	mysession
l
*
*4
+

Ptrm
+m

m,,ITRMalisHMacintosh HDīH+ݕ	shell.app[<	 ApplicationsĬb\%ݕ#Macintosh HD:Applications:shell.app	shell.appMacintosh HDApplications/shell.app/-
-l./0.
.aevtoappnull****
0	mysession/12
.aevtoappnull****0argv10argv2	,
.miscactvnullnull

Ptrm

Pssn

cobj
.ITRMLNCHnullobj
0	mysession

iTxt
.ITRMWrtenullobj 51*jO*k/#*k/lO*i/EO*l/lUUU03344,

Ptrm

Pssnascr
ޭ


Focus queue when queue is played manually

-- plays workflow queue in iTunes --

on loadConfig()

	set config to load script alias ((path to library folder from user domain as text) & "Caches:com.runningwithcrayons.Alfred-2:Workflow Data:com.calebevans.playsong:config.scpt")
	return config

end loadConfig

set config to loadConfig()
playQueue() of config
focusQueue() of config