text
stringlengths
0
15.7k
source
stringlengths
6
112
set theURL to ""
Copy as Markdown.applescript
if theNote starts with "http" then
Copy as Markdown.applescript
set theURL to the first paragraph of theNote
Copy as Markdown.applescript
set theNote to rest of the theNote's paragraphs
Copy as Markdown.applescript
if (count of theURL) is greater than 0 then
Copy as Markdown.applescript
set the clipboard to (the clipboard) & "- [" & theTitle & "](" & theURL & ")"
Copy as Markdown.applescript
set the clipboard to (the clipboard) & "- " & theTitle
Copy as Markdown.applescript
if (count of theNote) is greater than 0 then
Copy as Markdown.applescript
set the clipboard to (the clipboard) & "
Copy as Markdown.applescript
" & theNote & "
Copy as Markdown.applescript
end copyAsMarkdown
Copy as Markdown.applescript
property ScriptName : "iTunes Find Artwork-less"
iTunes Find Artwork-less.applescript
property scriptVersion : "1.0"
iTunes Find Artwork-less.applescript
property scriptDescription : "Find the songs with no Album Artwork set"
iTunes Find Artwork-less.applescript
set resultsPlaylistName to "* Missing Artwork"
iTunes Find Artwork-less.applescript
on show_error(theMessage)
iTunes Find Artwork-less.applescript
try -- Tiger
iTunes Find Artwork-less.applescript
display alert ScriptName message theMessage as warning buttons {"OK"} default button 1
iTunes Find Artwork-less.applescript
on error -- Panther
iTunes Find Artwork-less.applescript
set theHeading to "* " & ScriptName & " *" & return & return
iTunes Find Artwork-less.applescript
display dialog theHeading & theMessage with icon 2 buttons {"OK"} default button 1
iTunes Find Artwork-less.applescript
end show_error
iTunes Find Artwork-less.applescript
set selectedTracks to the selection of front window
iTunes Find Artwork-less.applescript
if selectedTracks is {} then
iTunes Find Artwork-less.applescript
set selectedPlaylist to view of front window
iTunes Find Artwork-less.applescript
set selectedTracks to file tracks of selectedPlaylist
iTunes Find Artwork-less.applescript
my show_error("Please first select the desired tracks")
iTunes Find Artwork-less.applescript
else if name of view of front window is resultsPlaylistName then
iTunes Find Artwork-less.applescript
my show_error("Please choose another playlist, you can't search on" & return & resultsPlaylistName)
iTunes Find Artwork-less.applescript
delete tracks of playlist resultsPlaylistName
iTunes Find Artwork-less.applescript
make new playlist with properties {name:resultsPlaylistName}
iTunes Find Artwork-less.applescript
repeat with thisTrack in selectedTracks
iTunes Find Artwork-less.applescript
if (count artworks of thisTrack) is 0 then
iTunes Find Artwork-less.applescript
duplicate thisTrack to playlist resultsPlaylistName
iTunes Find Artwork-less.applescript
set view of front window to playlist resultsPlaylistName
iTunes Find Artwork-less.applescript
on run -- example
JSON copy 2.applescript
set theRecord to {testing:{one:"1", |2|:2, three:3.3, |list|:{missing value}}}
JSON copy 2.applescript
set theList to {"List item", 4, 8.8, missing value, {"Another list"}, theRecord}
JSON copy 2.applescript
set test to (generateJSON for theList)
JSON copy 2.applescript
log result
JSON copy 2.applescript
set fileRef to (open for access ((path to desktop) as text) & "Sample.json" with write permission)
JSON copy 2.applescript
set eof fileRef to 0
JSON copy 2.applescript
write test to fileRef
JSON copy 2.applescript
on error errmess
JSON copy 2.applescript
error errmess
JSON copy 2.applescript
set JSONString to read (choose file of type "public.json")
JSON copy 2.applescript
return (parseJSON from JSONString)
JSON copy 2.applescript
to parseJSON from sourceString given coercion:coerce : true
JSON copy 2.applescript
if class of sourceString is not string then error "parseJSON error: source is not a string"
JSON copy 2.applescript
set theString to current application's NSString's stringWithString:sourceString
JSON copy 2.applescript
set theData to theString's dataUsingEncoding:(current application's NSUTF8StringEncoding)
JSON copy 2.applescript
set {object, anyError} to current application's NSJSONSerialization's JSONObjectWithData:theData options:0 |error|:(reference)
JSON copy 2.applescript
if object is missing value then error "parseJSON error: " & (anyError's userInfo's objectForKey:"NSDebugDescription")
JSON copy 2.applescript
if coerce then if (object's isKindOfClass:(current application's NSArray)) as boolean then
JSON copy 2.applescript
return object as list
JSON copy 2.applescript
return object as record
JSON copy 2.applescript
return object -- leave as NSArray or NSDictionary
JSON copy 2.applescript
end parseJSON
JSON copy 2.applescript
to generateJSON for someObject -- someObject needs to be a list, record, or objC equivalent
JSON copy 2.applescript
set {theData, anyError} to current application's NSJSONSerialization's dataWithJSONObject:someObject options:(current application's NSJSONWritingPrettyPrinted) |error|:(reference)
JSON copy 2.applescript
if theData is missing value then error "generateJSON error: " & (anyError's userInfo's objectForKey:"NSDebugDescription")
JSON copy 2.applescript
set JSONString to current application's NSString's alloc()'s initWithData:theData encoding:(current application's NSUTF8StringEncoding)
JSON copy 2.applescript
return JSONString as string
JSON copy 2.applescript
end generateJSON
JSON copy 2.applescript
set b to bounds of window of desktop
Upper Center Third.applescript
set displayWidth to (item 3 of b)
Upper Center Third.applescript
set displayHeight to (item 4 of b)
Upper Center Third.applescript
if (do shell script "defaults read com.apple.dock autohide") is equal to "0" then
Upper Center Third.applescript
set dockSize to ((do shell script "defaults read com.apple.dock tilesize") as number) + 19
Upper Center Third.applescript
set dockSize to 0
Upper Center Third.applescript
set menubarSize to 22
Upper Center Third.applescript
set curApp to (path to frontmost application as Unicode text)
Upper Center Third.applescript
tell application curApp
Upper Center Third.applescript
set {x1, y1, x2, y2} to (get bounds)
Upper Center Third.applescript
set y1 to menubarSize
Upper Center Third.applescript
set usableHeight to (displayHeight - menubarSize)
Upper Center Third.applescript
set y2 to menubarSize + usableHeight / 2
Upper Center Third.applescript
if curApp ends with ":Finder.app:" then
Upper Center Third.applescript
set y2 to y2 - 22
Upper Center Third.applescript
if (exists "mac:Applications:TotalFinder.app") then
Upper Center Third.applescript
set y1 to y1 - 44
Upper Center Third.applescript
set y2 to y2 + 14
Upper Center Third.applescript
set x1 to dockSize + (displayWidth - dockSize) / 3
Upper Center Third.applescript
set x2 to dockSize + 2 * (displayWidth - dockSize) / 3
Upper Center Third.applescript
set bounds to {x1, y1, x2, y2}
Upper Center Third.applescript
display dialog "Enter Fader Level Control String" default answer "" buttons {"Set", "Cancel"} cancel button "Cancel" default button "Set" with title "SCENE NUMBER"
LS9CustomFaderAssign.applescript
set inputMsg to text returned of result
LS9CustomFaderAssign.applescript
set message to my faderString(inputMsg)
LS9CustomFaderAssign.applescript
set midiBank to first item of (selected as list)
LS9CustomFaderAssign.applescript
set message type of midiBank to sysex
LS9CustomFaderAssign.applescript
set sysex message of midiBank to message
LS9CustomFaderAssign.applescript
set q name of midiBank to inputMsg
LS9CustomFaderAssign.applescript
on faderString(inputMsg)
LS9CustomFaderAssign.applescript
set pre to "43 10 3E 12 01"
LS9CustomFaderAssign.applescript
set splitText to split(inputMsg, space)
LS9CustomFaderAssign.applescript
if length of splitText = 5 then
LS9CustomFaderAssign.applescript
set chan to item 1 of splitText
LS9CustomFaderAssign.applescript
set chanN to item 2 of splitText as integer
LS9CustomFaderAssign.applescript
set customN to item 5 of splitText as integer
LS9CustomFaderAssign.applescript
set customN to item 4 of splitText as integer
LS9CustomFaderAssign.applescript