Commit b0fd79cf authored by Jonas Neugebauer's avatar Jonas Neugebauer

Initial commit

parents
property SUBJ : ""
property SENDR : ""
property RECEIPIENTS : {""}
property CC : {""}
property BCC : {""}
property TESNIP : ""
tell application "Airmail 2"
set newMail to make new outgoing message with properties {subject:SUBJ, sender:SENDR}
repeat with R in RECEIPIENTS
make new to recipient at end of newMail's to recipients with properties {name:"", address:R}
end repeat
repeat with C in CC
make new cc recipient at end of newMail's cc recipients with properties {name:"", address:C}
end repeat
repeat with B in BCC
make new bcc recipient at end of newMail's bcc recipients with properties {name:"", address:B}
end repeat
compose newMail
activate
if TESNIP is not "" then
delay 1
tell application "TextExpander" to expand abbreviation TESNIP
end if
end tell
\ No newline at end of file
(*
Use as a script in Airmail rules to save attachments to
folder DOWNLOADS.
*)
property DOWNLOADS : "/Volumes/Hyrrokkin/Downloads"
on processMessage(theMessage)
try
tell application "Airmail 2"
set theAttach to filename of first mail attachment of theMessage
set thePDF to quoted form of POSIX path of theAttach
do shell script "cp " & thePDF & " " & DOWNLOADS
end tell
end try
end processMessage
\ No newline at end of file
# Converts any markdown file to html using
# CommonMark (http://commonmark.org) and copies all tags with
# tag (https://github.com/jdberry/tag/).
IFS=" "
files="{query}"
for file in $files; do
newfile="${file%.*}.html"
/usr/local/bin/cmark -t html --safe "$file" > "$newfile"
tags=`/usr/local/bin/tag -N "$file"`
/usr/local/bin/tag --set $tags "$newfile"
done
#!/usr/bin/env bash
cat "{query}" | pbcopy
#!/usr/bin/env bash
ls -A -1 "{query}" | pbcopy
#!/usr/bin/env bash
IFS=" "
files="{query}"
for file in $files
do mv "$file" "`dirname \"$file\"`/`date '+%Y-%m-%d'`_`basename \"$file\"`"
done
#!/usr/bin/env bash
IFS=" "
files="{query}"
for file in $files; do
mtime=`date -j -f "%s" "$(stat -f '%m' \"$file\")" +"%F"`
mv "$file" "`dirname \"$file\"`/${mtime}_`basename \"$file\"`"
done
on alfred_script(q)
if q is not in {"toggle", "deactivate", "activate"} then
set q to "toggle"
end if
tell application "Caffeine"
set status to "not been changed."
if active and q is in {"toggle", "deactivate"} then
turn off
set status to "been deactivated."
else if not active and q is in {"toggle", "activate"} then
turn on
set status to "been activated."
end if
set output to "Caffeine has " & status
return output
end tell
end alfred_script
set theState to "inactive."
tell application "Caffeine"
if active is true then
set theState to "active."
end if
end tell
"<?xml version=\"1.0\"?><items><item uid=\"caffeine_state\"><title>Toggle Caffeine</title><subtitle>Caffeine is "&theState&"</subtitle><icon></icon></item></items>" & ""
(*
Lets you choose a folder and randomizes the order of all files in it by renaming them with
NAME_PREFIX and a number.
*)
property NAME_PREFIX : "Bilderrahmen-"
property NUMBER_PADDING : 4
property TYPES : {"jpg", "jpeg"}
-- get the folder to check
set f to choose folder
-- notice the use of "entire contents" to also go through subfolders of f
-- use a "whose" filter to find only the video files
tell application "Finder"
set allFiles to (files of entire contents of f whose name extension is in TYPES) as alias list
set theNo to 1
repeat while allFiles is not {}
set fileCount to the count of allFiles
tell current application to set pick to random number from 1 to fileCount
set theFile to item pick of allFiles -- as alias
-- remove theFile from list
if fileCount is 1 then
set allFiles to {}
else if pick is 1 then
set allFiles to items 2 thru fileCount of allFiles
else if pick is fileCount then
set allFiles to items 1 thru (fileCount - 1) of allFiles
else
set allFiles to (items 1 thru (pick - 1) of allFiles) & (items (pick + 1) thru fileCount of allFiles)
end if
set fileNumber to "0000000000" & (fileCount as string)
set fileNumber to characters ((length of fileNumber) - NUMBER_PADDING + 1) thru -1 of fileNumber as string
-- rename theFile
set the name of file theFile to (NAME_PREFIX & fileNumber) & "." & name extension of theFile
end repeat
end tell
set AppleScript's text item delimiters to ","
set theTags to do shell script "/usr/local/bin/tag -N " & (quoted form of POSIX path of theFile)
set theTags to theTags's text items
tell application "Evernote"
--activate
create note from file theFile tags theTags
delay 2
end tell
# Converts any markdown file to html using
# CommonMark (http://commonmark.org) and copies all tags with
# tag (https://github.com/jdberry/tag/).
target="${1%.*}.html"
/usr/local/bin/cmark -t html --safe "$file" > "$target"
tags=`/usr/local/bin/tag -N "$file"`
/usr/local/bin/tag --set $tags "$target"
# Resize image to picture frame size with ImageMagick
convert $1'[800x600]' $1
# Shrink filesize with jhead and ImageOptim
jhead -ft "$1"
/Applications/ImageOptim.app/Contents/MacOS/ImageOptim "$1"
# Randomize filename with a 8 character long string
RAND=$(date +%s | sha256sum | base64 | head -c 8)
mv "$1" "$RAND.${1##*.}"
#!/usr/bin/env bash
# Randomize filename with a 8 character long string
RAND=$(date +%s | sha256sum | base64 | head -c 8)
mv "$1" "$RAND.${1##*.}"
(*
Exports a mail to the DOWNLOADS folder.
*)
property DOWNLOADS : "/Volumes/Hyrrokkin/Downloads"
property TRASH_AFTER : false
using terms from application "Mail"
on perform mail action with messages theMails for rule theRule
tell application "Mail"
repeat with aMail in theMails
set theSource to source of aMail
try
set theFilename to DOWNLOADS & "/" & subject of aMail & ".eml"
do shell script "touch \"" & theFilename & "\""
set theFile to open for access theFilename with write permission
write theSource to theFile
close access theFile
if TRASH_AFTER then delete aMail
on error
do shell script "rm -f \"" & theFilename & "\""
end try
end repeat
end tell
end perform mail action with messages
end using terms from
\ No newline at end of file
(*
Saves the mail attachments to DOWNLOADS.
*)
property DOWNLOADS : "/Volumes/Hyrrokkin/Downloads"
property TRASH_AFTER : false
using terms from application "Mail"
on perform mail action with messages theMails for rule theRule
tell application "Mail"
repeat with aMail in theMails
try
set theStuff to every mail attachment of aMail
repeat with aStuff in theStuff
save aStuff in POSIX file (DOWNLOADS & "/" & name of aStuff)
end repeat
if TRASH_AFTER then delete aMail
end try
end repeat
end tell
end perform mail action with messages
end using terms from
\ No newline at end of file
property TARGET : "/Volumes/Hyrrokkin/Uploads/Photorahmen"
tell application "Photos"
set favs to every media item in favorites album
export favs to POSIX file TARGET
end tell
\ No newline at end of file
(*
Sorts pics from a particular album into weekly albums relative to a
target date based on the image date.
The script will sort every media item from SOURCE_ALBUM album into child albums of
the TARGET_FOLDER by calculating how many weeks after TARGET_DATE it was taken.
The resulting folder structure will be:
TARGET_FOLDER
ZERO_ALBUM
WEEKLY_PREFIX 1
WEEKLY_PREFIX 2
WEEKLY_PREFIX 3
...
*)
-- Set to the target date
property TARGET_DATE : date "Dienstag, 22. Juli 2014 02:06:00"
-- Set to the album with the unsorted pics. If it is a subfolder use a path like string.
property SOURCE_ALBUM : "#Unsortiert/Linus Neu"
-- Set to the target folder for the weekly albums. This folder will be the parent of the weekly albums.
property TARGET_FOLDER : "Growing-Up/Linus"
-- Set to the album for pictures without a date or with a date before the target date
property ZERO_ALBUM : "Woche 0"
-- Set to a prefix for the weekly albums
property WEEKLY_PREFIX : "Woche "
property DISPLAY_DIALOG : true
-- Do some startup stuff
display notification "AppleScript is busy. This might take a while." with title "SortPicsIntoWeeks" subtitle "Sorting images ..."
-- Get relevant folders
set theSrcAlbum to getAlbum(SOURCE_ALBUM)
set theTargetFolder to getAlbum(TARGET_FOLDER)
set theZeroAlbum to getAlbum(TARGET_FOLDER & "/" & ZERO_ALBUM)
tell application "Photos"
-- Get all images
set allMedia to media items of theSrcAlbum
if length of allMedia is 0 then
display notification "Source folder is empty. No pictures to sort." with title "SortPicsIntoWeeks"
return
end if
-- Sort media into folders
set n to 0
set f to 0
repeat with aMedium in allMedia
-- Get media date
set mDate to date of aMedium
if TARGET_DATE < mDate then
-- Get week realtive to BIRTHDAY
set weekNo to (mDate - TARGET_DATE) div (7 * days) + 1
set weekName to WEEKLY_PREFIX & weekNo
-- log "Sort medium into album " & weekName
-- Get appropriate week album or create
try
tell theTargetFolder to set theWeekAlbum to container weekName
on error
set theWeekAlbum to make new album named weekName at theTargetFolder
end try
-- Add medium to album
add {aMedium} to theWeekAlbum
-- Remove from old album
-- ?????
log ("Sorted medium " & (filename of aMedium) & " to album " & (name of theWeekAlbum))
else
-- Move to Week 0
add aMedium to theZeroAlbum
log ("Sorted medium " & (filename of aMedium) & " to album " & (name of theZeroAlbum))
end if
set n to n + 1
end repeat
set msg to n & " pictures sorted." & return
if f > 0 then set msg to msg & f & " pictures with errors!" & return
set msg to msg & "The pictures can now be deleted from album " & quote & (name of theSrcAlbum) & quote & "."
if DISPLAY_DIALOG then
display dialog msg as text with title "SortPicsIntoWeeks"
else
display notification msg as text with title "SortPicsIntoWeeks"
end if
end tell
on getAlbum(path)
set {astid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "/"}
set pathItems to every text item of path
set AppleScript's text item delimiters to astid
tell application "Photos"
set c to container (first item of pathItems)
set pathItems to rest of pathItems
repeat with p in pathItems
tell c to set c to container p
end repeat
end tell
return c
end getAlbum
(* Creates a set of snippets for common HTML tags. For each tag in TAGS_INLINE and TAGS_BLOCK the script will create two snippets, one with the cursor () and one with the clipboard (%clipboard) between the opening and closing tags. For the TAGS_EMPTY empty tags (e.g. "<hr/>") are created. As abbreviations the first PREFIX_LENGTH chars of the tag name are used. E.g. for the inline/block tags "em"/"blockquote" with default settings the following snippets will be created: ,em <em>%|</em> ;em <em>%clipboard</em> ,block <blockquote> %| </blockquote> ;block <blockquote> %clipboard </blockquote> *)-- name of group the snippets will be created in property GROUP_NAME : "HTML" -- number of chars to take from the tag name for the abbreviation property PREFIX_LENGTH : 5 -- snippet prefixes to use -- the first list item places the cursor (%|) between the tags -- the second list item places the cursor (%clipboard) between the tags -- the third is used for empty blocks (e.g. "<hr/>") property PREFIX_CHARS : [",", ";", ",/"] -- inline tags to create snippets for property TAGS_INLINE : ["del", "code", "strong", "em"] -- block level tags to create snippets for property TAGS_BLOCK : ["pre", "blockquote"] -- empty tags to create snippets for property TAGS_EMPTY : ["br", "hr"] tell application "TextExpander" try set theGroup to group GROUP_NAME on error set theGroup to make new group with properties {name:GROUP_NAME} end try set noClipChar to first item of PREFIX_CHARS set clipChar to second item of PREFIX_CHARS set emptyChar to last item of PREFIX_CHARS set cnt to 0 tell theGroup -- create inline tags repeat with tag in TAGS_INLINE -- create abbreviation set charCount to length of tag if charCount < PREFIX_LENGTH then set abbrev to rich text 1 through charCount of tag else set abbrev to rich text 1 through PREFIX_LENGTH of tag end if -- create snippet text set snipNoClip to "<" & tag & ">%|</" & tag & ">" set snipClip to "<" & tag & ">%clipboard</" & tag & ">" -- create the snippets if there is none with this abbreviation if (not (count of (every snippet whose abbreviation is noClipChar & abbrev)) is greater than 0) then make new snippet with properties {abbreviation:noClipChar & abbrev, plain text expansion:snipNoClip, content type:plain_text, abbreviation mode:match case, label:"AS Tag: " & noClipChar & abbrev} set cnt to cnt + 1 end if if (not (count of (every snippet whose abbreviation is clipChar & abbrev)) is greater than 0) then make new snippet with properties {abbreviation:clipChar & abbrev, plain text expansion:snipClip, content type:plain_text, abbreviation mode:match case, label:"AS Tag: " & clipChar & abbrev} set cnt to cnt + 1 end if end repeat -- create block level tags repeat with tag in TAGS_BLOCK -- create abbreviation set charCount to length of tag if charCount < PREFIX_LENGTH then set abbrev to rich text 1 through charCount of tag else set abbrev to rich text 1 through PREFIX_LENGTH of tag end if -- create snippet text set snipNoClip to "<" & tag & ">" & return & "%|" & return & "</" & tag & ">" set snipClip to "<" & tag & ">" & return & "%clipboard" & return & "</" & tag & ">" -- create the snippets if there is none with this abbreviation if (not (count of (every snippet whose abbreviation is noClipChar & abbrev)) is greater than 0) then make new snippet with properties {abbreviation:noClipChar & abbrev, plain text expansion:snipNoClip, content type:plain_text, abbreviation mode:match case, label:"AS Tag: " & noClipChar & abbrev} set cnt to cnt + 1 end if if (not (count of (every snippet whose abbreviation is clipChar & abbrev)) is greater than 0) then make new snippet with properties {abbreviation:clipChar & abbrev, plain text expansion:snipClip, content type:plain_text, abbreviation mode:match case, label:"AS Tag: " & clipChar & abbrev} set cnt to cnt + 1 end if end repeat -- create emtpy tags repeat with tag in TAGS_EMPTY -- create abbreviation set charCount to length of tag if charCount < PREFIX_LENGTH then set abbrev to rich text 1 through charCount of tag else set abbrev to rich text 1 through PREFIX_LENGTH of tag end if -- create snippet text set snip to "<" & tag & "/>" -- create the snippets if there is none with this abbreviation if (not (count of (every snippet whose abbreviation is emptyChar & abbrev)) is greater than 0) then make new snippet with properties {abbreviation:emptyChar & abbrev, plain text expansion:snip, content type:plain_text, abbreviation mode:match case, label:"AS Tag: " & emptyChar & abbrev} set cnt to cnt + 1 end if end repeat display notification (cnt & " HTML snippets created in group " & GROUP_NAME as rich text) with title "CreateHTMLSnippets" end tell end tell
\ No newline at end of file
(* Creates a set of snippets for common MediaWiki tags. Note: This is a copy of te_CreateHTMLSnippets.scpt*)-- Set to name of group the snippets will be created in property GROUP_NAME : "HTML" -- number of chars to take from the tag name for the abbreviation property PREFIX_LENGTH : 5 -- snippet prefixes to use -- the first list item places the cursor (%|) between the tags -- the second list item places the cursor (%clipboard) between the tags -- the third is used for empty blocks (e.g. "<hr/>") property PREFIX_CHARS : [",", ";", ",/"] -- inline tags to create snippets for property TAGS_INLINE : ["nowiki", "includeonly", "noinclude", "onlyinclude"] -- block level tags to create snippets for property TAGS_BLOCK : ["syntaxhighlight"] -- empty tags to create snippets for property TAGS_EMPTY : ["nowiki"] tell application "TextExpander" try set theGroup to group GROUP_NAME on error set theGroup to make new group with properties {name:GROUP_NAME} end try set noClipChar to first item of PREFIX_CHARS set clipChar to second item of PREFIX_CHARS set emptyChar to last item of PREFIX_CHARS set cnt to 0 tell theGroup -- create inline tags repeat with tag in TAGS_INLINE -- create abbreviation set charCount to length of tag if charCount < PREFIX_LENGTH then set abbrev to rich text 1 through charCount of tag else set abbrev to rich text 1 through PREFIX_LENGTH of tag end if -- create snippet text set snipNoClip to "<" & tag & ">%|</" & tag & ">" set snipClip to "<" & tag & ">%clipboard</" & tag & ">" -- create the snippets if there is none with this abbreviation if (not (count of (every snippet whose abbreviation is noClipChar & abbrev)) is greater than 0) then make new snippet with properties {abbreviation:noClipChar & abbrev, plain text expansion:snipNoClip, content type:plain_text, abbreviation mode:match case, label:"AS Tag: " & noClipChar & abbrev} set cnt to cnt + 1 end if if (not (count of (every snippet whose abbreviation is clipChar & abbrev)) is greater than 0) then make new snippet with properties {abbreviation:clipChar & abbrev, plain text expansion:snipClip, content type:plain_text, abbreviation mode:match case, label:"AS Tag: " & clipChar & abbrev} set cnt to cnt + 1 end if end repeat -- create block level tags repeat with tag in TAGS_BLOCK -- create abbreviation set charCount to length of tag if charCount < PREFIX_LENGTH then set abbrev to rich text 1 through charCount of tag else set abbrev to rich text 1 through PREFIX_LENGTH of tag end if -- create snippet text set snipNoClip to "<" & tag & ">" & return & "%|" & return & "</" & tag & ">" set snipClip to "<" & tag & ">" & return & "%clipboard" & return & "</" & tag & ">" -- create the snippets if there is none with this abbreviation if (not (count of (every snippet whose abbreviation is noClipChar & abbrev)) is greater than 0) then make new snippet with properties {abbreviation:noClipChar & abbrev, plain text expansion:snipNoClip, content type:plain_text, abbreviation mode:match case, label:"AS Tag: " & noClipChar & abbrev} set cnt to cnt + 1 end if if (not (count of (every snippet whose abbreviation is clipChar & abbrev)) is greater than 0) then make new snippet with properties {abbreviation:clipChar & abbrev, plain text expansion:snipClip, content type:plain_text, abbreviation mode:match case, label:"AS Tag: " & clipChar & abbrev} set cnt to cnt + 1 end if end repeat -- create emtpy tags repeat with tag in TAGS_EMPTY -- create abbreviation set charCount to length of tag if charCount < PREFIX_LENGTH then set abbrev to rich text 1 through charCount of tag else set abbrev to rich text 1 through PREFIX_LENGTH of tag end if -- create snippet text set snip to "<" & tag & "/>" -- create the snippets if there is none with this abbreviation if (not (count of (every snippet whose abbreviation is emptyChar & abbrev)) is greater than 0) then make new snippet with properties {abbreviation:emptyChar & abbrev, plain text expansion:snip, content type:plain_text, abbreviation mode:match case, label:"AS Tag: " & emptyChar & abbrev} set cnt to cnt + 1 end if end repeat display notification (cnt & " HTML snippets created in group " & GROUP_NAME as rich text) with title "CreateHTMLSnippets" end tell end tell
\ No newline at end of file
(* Creates a set of snippets for enclosing parentheses. For each pair of parentheses the script will create two snippets, one with the cursor (%|) and one with the clipboard (%clipboard) between the parentheses. Both snippets will be created MAX_REPEAT times, by repeating the opening and closing parentheses one to MAX_REPEAT times. E.g. for the pair "[","]" with default settings the following snippets will be created: ,[ [%|] ;[ [%clipboard] ,2[ [[%|]] ;2[ [[%clipboard]] ,3[ [[[%|]]] ;3[ [[[%clipboard]]]*)-- name of group the snippets will be created in property GROUP_NAME : "Parentheses" -- maximum depth for snippets property MAX_REPEAT : 3 -- snippet prefixes to use -- the first list item places the cursor (%|) between the parentheses -- the second list item places the cursor (%clipboard) between the parentheses property PREFIX_CHARS : [",", ";"] -- parenthesis pairs, each item is a list with two items: the of opening and closing parenthesis property PAIRS : {["'", "'"], ["\"", "\""], ["`", "`"], ["(", ")"], ["[", "]"], ["{", "}"], ["_", "_"], ["-", "-"], ["~", "~"], ["*", "*"], ["<", ">"], ["=", "="]} tell application "TextExpander" try set theGroup to group GROUP_NAME on error set theGroup to make new group with properties {name:GROUP_NAME} end try set noClipChar to first item of PREFIX_CHARS set clipChar to last item of PREFIX_CHARS set cnt to 0 tell theGroup repeat with i from 1 to MAX_REPEAT repeat with pair in PAIRS set openChar to first item of pair set closeChar to last item of pair -- add number to abbreviation if i > 1 then set abbrevNoClip to noClipChar & i & openChar set abbrevClip to clipChar & i & openChar else set abbrevNoClip to noClipChar & openChar set abbrevClip to clipChar & openChar end if -- make snippet text set snipNoClip to "%|" set snipClip to "%clipboard" repeat i times set snipNoClip to openChar & snipNoClip & closeChar set snipClip to openChar & snipClip & closeChar end repeat -- create the snippets if there is none with this abbreviation if (not (count of (every snippet whose abbreviation is abbrevNoClip)) is greater than 0) then make new snippet with properties {abbreviation:abbrevNoClip, plain text expansion:snipNoClip, content type:plain_text, abbreviation mode:match case} set cnt to cnt + 1 end if if (not (count of (every snippet whose abbreviation is abbrevClip)) is greater than 0) then make new snippet with properties {abbreviation:abbrevClip, plain text expansion:snipClip, content type:plain_text, abbreviation mode:match case} set cnt to cnt + 1 end if end repeat end repeat display notification (cnt & " parentheses snippets created in group " & GROUP_NAME as rich text) with title "CreateParenthesesSnippets" end tell end tell
\ No newline at end of file
(* Creates a Launch Center Pro action to select a snippet from a list and copy it to the clipboard.*)-- set to a list of te groups to include in the list property INCLUDE_GROUPS : ["Misc", "Contact", "Date&Time", "GTD"] --property INCLUDE_GROUPS : ["Misc"] -- set to true to create a link to import the action into launch center -- (requires python for urlencoding) property GENERATE_LINK : true tell application "TextExpander" set theList to "launch://clipboard?text=[list:Snippets" repeat with aGroup in groups set theGroupName to name of aGroup if theGroupName is in INCLUDE_GROUPS then set theList to theList & "|" & theGroupName & "=[list:" & theGroupName repeat with aSnippet in snippets of aGroup set theSnippetName to label of aSnippet if theSnippetName is "" then set theSnippetName to name of aSnippet set theSnippetAbbrev to abbreviation of aSnippet set theList to theList & "|" & theSnippetName & "=[textexpander:" & theSnippetAbbrev & "]" end repeat set theList to theList & "]" end if end repeat set theList to theList & "]" if GENERATE_LINK then set theList to "launch://import?title=Snippet&description=Copy%20TextExpander%20snippet%20to%20clipboard.&url=" & (do shell script "/usr/bin/python -c 'import sys, urllib; print urllib.quote(sys.argv[1])' " & quoted form of theList) end if set the clipboard to theList display notification "Launch Center Pro action copied to clipboard." with title "MakeLaunchCenterList" end tell
\ No newline at end of file
(* Creates a Launch Center Pro clipboard action. Note: This is a copy of te_MakeLaunchCenterList.scpt*)-- set to a list of te groups to include in the list property INCLUDE_GROUPS : ["Misc", "Contact", "Date&Time", "GTD"] --property INCLUDE_GROUPS : ["Misc"] -- set to true to create a link to import the action into launch center -- (requires python for urlencoding) property GENERATE_LINK : true tell application "TextExpander" set theList to "launch://clipboard?text=[list:Clipboard|New=[prompt:Clipboard]|Show=[prompt:Clipboard=[clipboard]]|Snippet=[list:Snippets" repeat with aGroup in groups set theGroupName to name of aGroup if theGroupName is in INCLUDE_GROUPS then set theList to theList & "|" & theGroupName & "=[list:" & theGroupName repeat with aSnippet in snippets of aGroup set theSnippetName to label of aSnippet if theSnippetName is "" then set theSnippetName to name of aSnippet set theSnippetAbbrev to abbreviation of aSnippet set theList to theList & "|" & theSnippetName & "=[textexpander:" & theSnippetAbbrev & "]" end repeat set theList to theList & "]" end if end repeat set theList to theList & "]]" if GENERATE_LINK then set theList to "launch://import?title=Clipboard&description=Copy%20TextExpander%20snippet%20to%20clipboard%20and%20other%20actions.&url=" & (do shell script "/usr/bin/python -c 'import sys, urllib; print urllib.quote(sys.argv[1])' " & quoted form of theList) end if set the clipboard to theList display notification "Launch Center Pro action copied to clipboard." with title "MakeLaunchCenterList" end tell
\ No newline at end of file
(* Adds a new task to Things. (For use with Alfredapp: alfredapp.com) Syntax: #tag1 #tag2 task name [project name/area name] ::note >duedate *) on alfred_script(q) tell application "Things" to set task to parse quicksilver input q return (name of task) end alfred_script
\ No newline at end of file
-- parsequery.scpt -- Author: Jonas Neugebauer <dergimli@gmail.com> -- Version: 1.0 -- log parse_query("#tag1 #tag2 My Title [Important project] ::This is very important >01.01.2012") (* Parses a query string of the form #tag1 #tag2 title [project name] ::descr >due date to a named list with - tags: a list of tags as strings - title: the title as string - project: the project name as string - descr: the description as string - due: the due date as date object Every part except the name is optional and will be null in the result list if ommited (the tags will be an empty list) *) on parse_query(q) set title to "" set tags to [] set project to null set descr to null set due to null set projMode to false set descrMode to false set AppleScript's text item delimiters to {" "} set qElems to every text item of q repeat with elem in qElems set fc to character 1 of elem set lc to character -1 of elem if fc = ">" then set descrMode to false set d to text 2 thru -1 of elem as text try set due to date d end try else if fc = "#" then set descrMode to false set tag to text 2 thru -1 of elem as text set tags to tags & [tag] else if fc = "[" then set descrMode to false set projMode to true if lc = "]" then set project to (text 2 thru -2 of elem as text) set projMode to false else set project to (text 2 thru -1 of elem as text) end if else if lc = "]" then set projMode to false set project to (project & space & (text 1 thru -2 of elem as text)) else if projMode = true then set project to (project & space & elem) else if fc = ":" and (character 2 of elem = ":") then set descrMode to true set descr to (text 3 thru -1 of elem as text) else if descrMode = true then set descr to (descr & space & elem) else if (count of title) = 0 then set title to elem else set title to (title & space & elem) end if end if end repeat return {title:title, tags:tags, project:project, descr:descr, due:due} end parse_query
\ No newline at end of file
(* Displays a dialog with a list of all tasks in the today list*) set grwlTitle to "0 Tasks for today"set taskList to "No tasks left for today" tell application "Things" set todayCount to (count to do of list "Today") set todayTasks to to dos of list "Today" if todayCount is greater than 0 then set grwlTitle to (todayCount & " tasks for today") as text set taskList to "" repeat with taskItem in todayTasks set taskName to name of taskItem if taskList is "No tasks left for today" then set taskList to "- " & taskName else set taskList to taskList & return & "- " & taskName end if end repeat end ifend tell display dialog grwlTitle & return & taskList with title "ShowTodayTasks"
\ No newline at end of file
(* Displays dialog with a list of all tasks in the today list*) set grwlTitle to "0 Tasks for today"set taskList to "No tasks left for today" set finished to 0set unfinished to 0 tell application "Things" set todayCount to (count to do of list "Today") set todayTasks to to dos of list "Today" if todayCount is greater than 0 then set grwlTitle to (todayCount & " tasks for today") as text set taskList to "" repeat with taskItem in todayTasks set taskName to name of taskItem if taskList is "No tasks left for today" then set taskList to "- " & taskName else set taskList to taskList & return & "- " & taskName end if if status of taskItem is in [completed, canceled] then set finished to finished + 1 if status of taskItem is open then set unfinished to unfinished + 1 end repeat end ifend tell display notification (unfinished & " tasks open" as text) with title grwlTitle subtitle (finished & " tasks already finished today. great job! 👍" as text)
\ No newline at end of file
#!/bin/bash
FILE="$1"
# Get ID3 tags
IFS='
'
TAGS=($(/usr/local/bin/exiftool -s3 -f -Artist -Band -Album -Title -Track -PartOfSet -Compilation "$FILE"))
# Build new filename
TITLE=${TAGS[3]}
TRACK=${TAGS[4]/\/*/}
if [ "$TRACK" != "-" ] ; then
# if number of cds is set, check if > 1
if [[ ${TAGS[5]} == *"/"* ]] ; then
TOTAL="${TAGS[5]/*\//}"
if [ ${TOTAL} -gt 1 ] ; then
TRACK="${TAGS[5]/\/*/}-$TRACK"
fi
fi
else
TRACK=""
fi
NAME="$TRACK $TITLE.${FILE##*.}"
# Build new path
ARTIST="Unknown"
ALBUM="Unknown"
if [ ${TAGS[1]} != "-" ] ; then
ARTIST=${TAGS[1]}
else
if [ ${TAGS[6]} == "Yes" -o ${TAGS[6]} == "1" ] ; then
ARTIST="Compilation"
else
if [ ${TAGS[0]} != "-" ] ; then
ARTIST=${TAGS[0]}
fi
fi
fi
if [ ${TAGS[2]} != "-" ] ; then
ALBUM=${TAGS[2]}
fi
FL=${ARTIST//[^A-Za-z0-9]/}
FL=${FL/#The/}
FL=${FL:0:1}
if [ -z $FL ] ; then
FL="_"
fi
PATH="$(dirname $FILE)/$FL/$ARTIST/$ALBUM"
/bin/mkdir -p "$PATH"
/bin/mv -f "$FILE" "$PATH/$NAME"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment