Skip to content

Instantly share code, notes, and snippets.

@codingbulljunky
codingbulljunky / papers_keywords
Created October 10, 2018 19:06
Assign keywords to publication(s) in Papers by choosing from list of existing keywords.
tell application "Papers"
activate
set theKeywordList to {"New"}
set pubList to every publication item
repeat with eachPub in pubList
set theKeywords to keyword names of eachPub
if theKeywords is not "" then
if theKeywords is not in theKeywordList then
copy theKeywords to end of theKeywordList
@codingbulljunky
codingbulljunky / finder_tags_to_papers_keywords
Last active October 18, 2018 20:56
Gets tags associated with a physical file (article PDF), and imports them as keywords in Papers3. Also makes a Things3 to-do for the article
on hazelProcessFile(theFile)
tell application "Papers"
set todayDate to current date
set pubList to every publication item
repeat with eachPub in pubList
set theImport to import date of eachPub
set theDiff to (theImport - todayDate) div days
if theDiff is 0 then
if flagged of eachPub is false then
tell application "Finder" to set theFolderList to files of folder POSIX file "/path/to/your/folder/" as alias list
set theProjectName to "New Project"
tell application "Things3"
make new project with properties {name:theProjectName}
end tell
repeat with x in theFolderList
set thePath to POSIX path of x
tell application "Things3"
set theToDos to to dos of list "Today"
repeat with eachToDo in theToDos
if name of eachToDo contains "Readings_" then
set theChapter to name of eachToDo as string
set status of eachToDo to completed
set thePath to notes of eachToDo
end if
end repeat
end tell
@codingbulljunky
codingbulljunky / cocoa-applescript main.scpt
Created January 9, 2020 05:41
Retroactive Things Completion Date
-- main.scpt
-- Cocoa-AppleScript Applet
--
-- Copyright 2011 {Your Company}. All rights reserved.
-- This is the main script for a Cocoa-AppleScript Applet.
-- You can put the usual script applet handlers here.
use AppleScript version "2.4"
use scripting additions
tell application "Things3"
set theTag to "⏰"
set theAnytimeToDos to to dos of list "Anytime"
set theUpcomingToDos to to dos of list "Upcoming"
set theToDos to theAnytimeToDos & theUpcomingToDos
repeat with aTodo in theToDos
set theDue to due date of aTodo
if theDue is not missing value then
tell application "Things3"
set theTag to "@"
set theAnytimeToDos to to dos of list "Anytime"
set theUpcomingToDos to to dos of list "Upcoming"
set theToDos to theAnytimeToDos & theUpcomingToDos
repeat with aTodo in theToDos
set theName to name of aTodo
if theName contains "email" then
tell application "Things3"
set theTag to "📞"
set theAnytimeToDos to to dos of list "Anytime"
set theUpcomingToDos to to dos of list "Upcoming"
set theToDos to theAnytimeToDos & theUpcomingToDos
repeat with aTodo in theToDos
set theName to name of aTodo
if theName contains "call" then
if theName does not contain "submission" then
@codingbulljunky
codingbulljunky / Citrix.applescript
Created March 25, 2020 21:10
Citrix.applescript
set cxviewer to my is_running("Citrix Viewer")
-
if cxviewer is true then
tell application "Citrix Viewer"
activate
end tell
tell application "System Events"
--your username
@codingbulljunky
codingbulljunky / n1.applescript
Created March 25, 2020 21:45
date_by_weekday_Sunday
set todayDate to (current date)
set theWeekday to weekday of todayDate
if theWeekday = Sunday then
set thisweeksSunday to todayDate
else
set thisweeksSunday to my DateOfThisInstanceOfThisWeekdayBeforeOrAfterThisDate(todayDate, Sunday, -1)
end if