├── requirements.txt ├── Recent Excel Documents.lbaction └── Contents │ ├── Scripts │ ├── mruservice.py │ ├── mruuserdata.py │ └── default.py │ └── Info.plist ├── Recent OneNote Documents.lbaction └── Contents │ ├── Scripts │ ├── mruservice.py │ └── default.py │ └── Info.plist ├── Recent PowerPoint Documents.lbaction └── Contents │ ├── Scripts │ ├── mruservice.py │ ├── mruuserdata.py │ └── default.py │ └── Info.plist ├── README.md ├── Office 14 MRU.playground ├── contents.xcplayground ├── playground.xcworkspace │ └── contents.xcworkspacedata └── Contents.swift ├── Recent Word Documents.lbaction └── Contents │ ├── Scripts │ ├── default.py │ ├── mruuserdata.py │ └── mruservice.py │ └── Info.plist ├── .gitignore ├── Scripts └── release.py └── LICENSE /requirements.txt: -------------------------------------------------------------------------------- 1 | packaging>=21.3 2 | pyinstaller>=4.8 3 | -------------------------------------------------------------------------------- /Recent Excel Documents.lbaction/Contents/Scripts/mruservice.py: -------------------------------------------------------------------------------- 1 | ../../../Recent Word Documents.lbaction/Contents/Scripts/mruservice.py -------------------------------------------------------------------------------- /Recent Excel Documents.lbaction/Contents/Scripts/mruuserdata.py: -------------------------------------------------------------------------------- 1 | ../../../Recent Word Documents.lbaction/Contents/Scripts/mruuserdata.py -------------------------------------------------------------------------------- /Recent OneNote Documents.lbaction/Contents/Scripts/mruservice.py: -------------------------------------------------------------------------------- 1 | ../../../Recent Word Documents.lbaction/Contents/Scripts/mruservice.py -------------------------------------------------------------------------------- /Recent PowerPoint Documents.lbaction/Contents/Scripts/mruservice.py: -------------------------------------------------------------------------------- 1 | ../../../Recent Word Documents.lbaction/Contents/Scripts/mruservice.py -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LBOfficeMRU 2 | LaunchBar actions returning most recently used file lists for Mac Office 365, 2016, 2019 or 2021 applications. 3 | -------------------------------------------------------------------------------- /Recent PowerPoint Documents.lbaction/Contents/Scripts/mruuserdata.py: -------------------------------------------------------------------------------- 1 | ../../../Recent Word Documents.lbaction/Contents/Scripts/mruuserdata.py -------------------------------------------------------------------------------- /Office 14 MRU.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Office 14 MRU.playground/playground.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Recent OneNote Documents.lbaction/Contents/Scripts/default.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import json, operator 4 | import mruservice 5 | 6 | APP_NAME = 'OneNote' 7 | APP_BUNDLE_ID = 'com.microsoft.onenote.mac' 8 | APP_URL_PREFIX = 'onenote:' 9 | 10 | items = mruservice.items_for_app(APP_NAME, APP_BUNDLE_ID, APP_URL_PREFIX) 11 | 12 | items.sort(key=operator.itemgetter('Timestamp'), reverse=True) 13 | 14 | print(json.dumps(items)) 15 | -------------------------------------------------------------------------------- /Recent Word Documents.lbaction/Contents/Scripts/default.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import json, operator 4 | import mruservice, mruuserdata 5 | 6 | APP_NAME = 'Word' 7 | APP_BUNDLE_ID = 'com.microsoft.Word' 8 | APP_URL_PREFIX = 'ms-word:ofe|u|' 9 | EXTENSION_TO_ICON_NAME = dict( 10 | docx='WXBN', doc='W8BN', dotx='WXTN', dot='W8TN', docm='WXBM', dotm='WXTM', 11 | xml='WXML', mht='WDZ9', mhtm='WDZ9', mhtml='WDZ9', odt='ODT', _='TEXT') 12 | 13 | items = mruuserdata.items_for_app(APP_NAME) 14 | items += mruservice.items_for_app(APP_NAME, APP_BUNDLE_ID, APP_URL_PREFIX, EXTENSION_TO_ICON_NAME) 15 | 16 | items.sort(key=operator.itemgetter('Timestamp'), reverse=True) 17 | 18 | print(json.dumps(items)) 19 | -------------------------------------------------------------------------------- /Recent PowerPoint Documents.lbaction/Contents/Scripts/default.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import json, operator 4 | import mruservice, mruuserdata 5 | 6 | APP_NAME = 'PowerPoint' 7 | APP_BUNDLE_ID = 'com.microsoft.PowerPoint' 8 | APP_URL_PREFIX = 'ms-powerpoint:ofe|u|' 9 | EXTENSION_TO_ICON_NAME = dict( 10 | pptx='PPTX', xml='PPTX', thmx='THMX', ppt='SLD8', potx='POTX', pot='PPOT', odp='PODP', 11 | ppsx='PPSX', pps='PPSS', pptm='PPTM', potm='POTM', ppsm='PPSM', _='TEXT') 12 | 13 | items = mruuserdata.items_for_app(APP_NAME) 14 | items += mruservice.items_for_app(APP_NAME, APP_BUNDLE_ID, APP_URL_PREFIX, EXTENSION_TO_ICON_NAME) 15 | 16 | items.sort(key=operator.itemgetter('Timestamp'), reverse=True) 17 | 18 | print(json.dumps(items)) 19 | -------------------------------------------------------------------------------- /Recent Excel Documents.lbaction/Contents/Scripts/default.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import json, operator 4 | import mruservice, mruuserdata 5 | 6 | APP_NAME = 'Excel' 7 | APP_BUNDLE_ID = 'com.microsoft.Excel' 8 | APP_URL_PREFIX = 'ms-excel:ofe|u|' 9 | EXTENSION_TO_ICON_NAME = dict( 10 | slk='XLS8', dif='XLS8', ods='ODS', xls='XLS8', xlsx='XLSX', xltx='XLTX', xlsm='XLSM', 11 | xltm='XLTM', xlsb='XLSB', xlam='XLAM', xlw='XLW8', xla='XLA8', xlb='XLB8', xlt='XLT', 12 | xld='XLD5', xlm='XLM4', xll='XLL', csv='CSV', txt='TEXT', xml='XMLS', tlb='OTLB', _='TEXT') 13 | 14 | items = mruuserdata.items_for_app(APP_NAME) 15 | items += mruservice.items_for_app(APP_NAME, APP_BUNDLE_ID, APP_URL_PREFIX, EXTENSION_TO_ICON_NAME) 16 | 17 | items.sort(key=operator.itemgetter('Timestamp'), reverse=True) 18 | 19 | print(json.dumps(items)) 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | 48 | # Translations 49 | *.mo 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | 55 | # Sphinx documentation 56 | docs/_build/ 57 | 58 | # PyBuilder 59 | target/ 60 | 61 | #Ipython Notebook 62 | .ipynb_checkpoints 63 | 64 | # Emacs 65 | *~ 66 | \#* 67 | 68 | # DS stuff 69 | .DS_Store 70 | 71 | # OS X code signatures 72 | _CodeSignature/ 73 | 74 | # Xcode junk 75 | *.xcuserstate 76 | 77 | # Packaging 78 | LBOfficeMRU-*/ 79 | LBOfficeMRU-*.zip 80 | 81 | # venv 82 | bin/ 83 | pyvenv.cfg 84 | -------------------------------------------------------------------------------- /Office 14 MRU.playground/Contents.swift: -------------------------------------------------------------------------------- 1 | // MRU list generator for Mac Office 14 (2011) 2 | 3 | import Foundation 4 | 5 | func getMRUList(forApp: String) -> [String]? { 6 | guard let defaults = NSUserDefaults.standardUserDefaults().persistentDomainForName("com.microsoft.office") else { 7 | NSLog("Unable to find Office defaults") 8 | return nil 9 | } 10 | 11 | guard let mruList = defaults["14\\File MRU\\" + forApp ] as? [NSDictionary] else { 12 | NSLog("Unable to find recent documents for Office application \(forApp)") 13 | return nil 14 | } 15 | 16 | return mruList.flatMap { (mruItem: NSDictionary) in 17 | guard let mruFileAliasData = mruItem["File Alias"] as? NSData else { 18 | NSLog("Unable to extract file alias from MRU item \(mruItem)") 19 | return nil 20 | } 21 | do { 22 | let mruFileBookmarkData = CFURLCreateBookmarkDataFromAliasRecord(nil, mruFileAliasData).takeRetainedValue() 23 | let mruFileURL = try NSURL.init(byResolvingBookmarkData: mruFileBookmarkData, options: NSURLBookmarkResolutionOptions(), relativeToURL: nil, bookmarkDataIsStale: nil) 24 | return mruFileURL.path 25 | } catch let error as NSError { 26 | NSLog("Unable to resolve file alias for MRU item \(mruFileAliasData): \(error.localizedDescription)") 27 | return nil 28 | } 29 | } 30 | } 31 | 32 | if let mruList = getMRUList("MSWD") { 33 | print(NSString.init(data: try! NSJSONSerialization.dataWithJSONObject(mruList, options: NSJSONWritingOptions()), encoding: NSUTF8StringEncoding)!) 34 | } 35 | -------------------------------------------------------------------------------- /Recent Word Documents.lbaction/Contents/Scripts/mruuserdata.py: -------------------------------------------------------------------------------- 1 | from collections import OrderedDict 2 | from urllib.parse import urlsplit 3 | import os, sqlite3 4 | 5 | __all__ = ('items_for_app',) 6 | 7 | SQL = """select url.value URL, ts.value Timestamp from HKEY_CURRENT_USER_values url 8 | join HKEY_CURRENT_USER_values ts using (node_id) 9 | join HKEY_CURRENT_USER_values filename using (node_id) 10 | join HKEY_CURRENT_USER uuid using (node_id) 11 | join HKEY_CURRENT_USER documents on uuid.parent_id = documents.node_id and documents.name = 'Documents' 12 | join HKEY_CURRENT_USER local on documents.parent_id = local.node_id and local.name = 'Local' 13 | join HKEY_CURRENT_USER app on local.parent_id = app.node_id and app.name = ? 14 | join HKEY_CURRENT_USER user on app.parent_id = user.node_id 15 | join HKEY_CURRENT_USER mru on user.parent_id = mru.node_id and mru.name = 'MruUserData' 16 | join HKEY_CURRENT_USER common on mru.parent_id = common.node_id and common.name = 'Common' 17 | join HKEY_CURRENT_USER version on common.parent_id = version.node_id 18 | join HKEY_CURRENT_USER office on version.parent_id = office.node_id and office.name = 'Office' 19 | join HKEY_CURRENT_USER microsoft on office.parent_id = microsoft.node_id and microsoft.name = 'Microsoft' 20 | join HKEY_CURRENT_USER software on microsoft.parent_id = software.node_id and software.name = 'Software' 21 | where software.parent_id = -1 22 | and url.name = 'DocumentUrl' and ts.name = 'Timestamp' and filename.name = 'FileName' 23 | order by ts.value desc 24 | """ 25 | 26 | def items_for_app(app_name): 27 | conn = sqlite3.connect(os.path.expanduser( 28 | '~/Library/Group Containers/UBF8T346G9.Office/MicrosoftRegistrationDB.reg')) 29 | 30 | items = OrderedDict() 31 | 32 | for url, timestamp in conn.execute(SQL, (app_name,)): 33 | # urlsplit should not ordinarily raise 34 | # if it does, let it through so the user knows and can report an issue 35 | path = urlsplit(url).path 36 | if path in items: 37 | continue 38 | if not os.path.exists(path): 39 | continue 40 | items[path] = timestamp 41 | 42 | return [dict(path=path, Timestamp=timestamp) for path, timestamp in items.items()] 43 | -------------------------------------------------------------------------------- /Recent Word Documents.lbaction/Contents/Scripts/mruservice.py: -------------------------------------------------------------------------------- 1 | import json, os, sys 2 | from urllib.parse import quote 3 | 4 | __all__ = ('items_for_app',) 5 | 6 | def items_for_app(app_name, app_bundle_id, app_url_prefix, extension_to_icon_name=None): 7 | mruservicecache_paths = (os.path.expanduser(path) % app_bundle_id for path in ( 8 | '~/Library/Containers/%s/Data/Library/Application Support/Microsoft/Office/16.0/MruServiceCache', 9 | '~/Library/Containers/%s/Data/Library/Application Support/Microsoft/AppData/Office/15.0/MruServiceCache')) 10 | 11 | for mruservicecache_path in mruservicecache_paths: 12 | if os.path.isdir(mruservicecache_path): 13 | break 14 | else: 15 | return [] 16 | 17 | documents = [] 18 | 19 | for cache_path in os.listdir(mruservicecache_path): 20 | app_path = os.path.join(mruservicecache_path, cache_path, app_name) 21 | if not os.path.isdir(app_path): 22 | continue 23 | 24 | for documents_filename in (f for f in os.listdir(app_path) if f.startswith('Documents_')): 25 | documents_path = os.path.join(app_path, documents_filename) 26 | 27 | if not os.path.isfile(documents_path): 28 | continue 29 | 30 | try: 31 | documents += json.load(open(documents_path)) 32 | except ValueError as e: 33 | print("Can't parse documents MRU cache:", e, file=sys.stderr) 34 | continue 35 | 36 | items = [] 37 | seen_urls = set() 38 | 39 | for document in documents: 40 | url = document['DocumentUrl'] 41 | if url in seen_urls: 42 | continue 43 | 44 | seen_urls.add(url) 45 | filename = document['FileName'] 46 | if extension_to_icon_name: 47 | filename, extension = os.path.splitext(filename) 48 | icon = None 49 | if extension: icon = extension_to_icon_name.get(extension.lower()[1:]) 50 | if icon is None: icon = extension_to_icon_name['_'] 51 | icon = '%s:%s' % (app_bundle_id, icon) 52 | else: 53 | icon = app_bundle_id 54 | 55 | items.append(dict(title=filename, 56 | subtitle=document['Path'], 57 | url='%s%s' % (app_url_prefix, 58 | quote(document['DocumentUrl'].encode('utf-8'), safe=':/')), 59 | icon=app_bundle_id, 60 | Timestamp=document['Timestamp'])) 61 | 62 | return items 63 | -------------------------------------------------------------------------------- /Recent OneNote Documents.lbaction/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIconFile 6 | com.microsoft.onenote.mac 7 | CFBundleIdentifier 8 | net.sabi.LaunchBar.action.RecentOneNoteDocuments 9 | CFBundleName 10 | Recent OneNote Documents 11 | CFBundleVersion 12 | 1.2b1 13 | LBAssociatedApplication 14 | com.microsoft.onenote.mac 15 | LBDescription 16 | 17 | LBAuthor 18 | Nicholas Riley 19 | LBChangelog 20 | 21 | 1.2: Bundles Python 3.10.2 in preparation for macOS 12.3 removing Python 2. 22 | 1.1: Adds support for OneNote 16. 23 | 1.0: Fixes crash with Unicode characters in cloud-hosted document names. 24 | 1.0b2: Adds a OneNote action. 25 | 26 | LBDownloadURL 27 | https://github.com/nriley/LBOfficeMRU/releases/download/v1.2b1/LBOfficeMRU-1.2b1.zip 28 | LBEmail 29 | launchbar@sabi.net 30 | LBRequirements 31 | Microsoft OneNote 15 or 16 32 | LBResult 33 | The list of recently opened OneNote documents. 34 | LBSummary 35 | This action returns a list of recently opened OneNote documents. 36 | LBTwitter 37 | @nriley 38 | LBUpdateURL 39 | https://raw.githubusercontent.com/nriley/LBOfficeMRU/master/Recent%20OneNote%20Documents.lbaction/Contents/Info.plist 40 | LBWebsiteURL 41 | https://sabi.net/nriley/software/#launchbar 42 | 43 | LBRequiredApplication 44 | com.microsoft.onenote.mac 45 | LBRequirements 46 | Microsoft OneNote 15 or 16 47 | LBResult 48 | The list of recently opened OneNote notebooks. 49 | LBScripts 50 | 51 | LBDefaultScript 52 | 53 | LBKeepWindowActive 54 | 55 | LBResultType 56 | unknown 57 | LBReturnsResult 58 | 59 | LBScriptName 60 | default.py 61 | 62 | 63 | LSMinimumSystemVersion 64 | 10.10 65 | NSHumanReadableCopyright 66 | Copyright © 2016–22 Nicholas Riley 67 | 68 | 69 | -------------------------------------------------------------------------------- /Recent Word Documents.lbaction/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIconFile 6 | com.microsoft.Word:WXTN 7 | CFBundleIdentifier 8 | net.sabi.LaunchBar.action.RecentWordDocuments 9 | CFBundleName 10 | Recent Word Documents 11 | CFBundleVersion 12 | 1.2b1 13 | LBAssociatedApplication 14 | com.microsoft.Word 15 | LBDescription 16 | 17 | LBAuthor 18 | Nicholas Riley 19 | LBChangelog 20 | 21 | 1.2: Bundles Python 3.10.2 in preparation for macOS 12.3 removing Python 2. 22 | 1.1: Adds support for Office 16/2019. 23 | 1.0: Fixes crash with Unicode characters in cloud-hosted document names. 24 | 1.0b2: Adds support for cloud-hosted documents (e.g. SharePoint, OneDrive). Always sorts most recent documents first. Adds support for automatic updates if you have the Action Updates action installed. 25 | 26 | LBDownloadURL 27 | https://github.com/nriley/LBOfficeMRU/releases/download/v1.2b1/LBOfficeMRU-1.2b1.zip 28 | LBEmail 29 | launchbar@sabi.net 30 | LBRequirements 31 | Microsoft Word 15 or 16 (Office 365, 2016, 2019 or 2021) 32 | LBResult 33 | The list of recently opened Word documents. 34 | LBSummary 35 | This action returns a list of recently opened Word documents. 36 | LBTwitter 37 | @nriley 38 | LBUpdateURL 39 | https://raw.githubusercontent.com/nriley/LBOfficeMRU/master/Recent%20Word%20Documents.lbaction/Contents/Info.plist 40 | LBWebsiteURL 41 | https://sabi.net/nriley/software/#launchbar 42 | 43 | LBRequiredApplication 44 | com.microsoft.Word 45 | LBRequirements 46 | Microsoft Word 15 or 16 (Office 365, 2016, 2019 or 2021) 47 | LBResult 48 | The list of recently opened Word documents. 49 | LBScripts 50 | 51 | LBDefaultScript 52 | 53 | LBKeepWindowActive 54 | 55 | LBResultType 56 | unknown 57 | LBReturnsResult 58 | 59 | LBScriptName 60 | default.py 61 | 62 | 63 | LSMinimumSystemVersion 64 | 10.10 65 | NSHumanReadableCopyright 66 | Copyright © 2016–22 Nicholas Riley 67 | 68 | 69 | -------------------------------------------------------------------------------- /Recent Excel Documents.lbaction/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIconFile 6 | com.microsoft.Excel:XLTX 7 | CFBundleIdentifier 8 | net.sabi.LaunchBar.action.RecentExcelDocuments 9 | CFBundleName 10 | Recent Excel Documents 11 | CFBundleVersion 12 | 1.2b1 13 | LBAssociatedApplication 14 | com.microsoft.Excel 15 | LBDescription 16 | 17 | LBAuthor 18 | Nicholas Riley 19 | LBChangelog 20 | 21 | 1.2: Bundles Python 3.10.2 in preparation for macOS 12.3 removing Python 2. 22 | 1.1: Adds support for Office 16/2019. 23 | 1.0: Fixes crash with Unicode characters in cloud-hosted document names. 24 | 1.0b2: Adds support for cloud-hosted documents (e.g. SharePoint, OneDrive). Always sorts most recent documents first. Adds support for automatic updates if you have the Action Updates action installed. 25 | 26 | LBDownloadURL 27 | https://github.com/nriley/LBOfficeMRU/releases/download/v1.2b1/LBOfficeMRU-1.2b1.zip 28 | LBEmail 29 | launchbar@sabi.net 30 | LBRequirements 31 | Microsoft Excel 15 or 16 (Office 365, 2016, 2019 or 2021) 32 | LBResult 33 | The list of recently opened Excel documents. 34 | LBSummary 35 | This action returns a list of recently opened Excel documents. 36 | LBTwitter 37 | @nriley 38 | LBUpdateURL 39 | https://raw.githubusercontent.com/nriley/LBOfficeMRU/master/Recent%20Excel%20Documents.lbaction/Contents/Info.plist 40 | LBWebsiteURL 41 | https://sabi.net/nriley/software/#launchbar 42 | 43 | LBRequiredApplication 44 | com.microsoft.Excel 45 | LBRequirements 46 | Microsoft Excel 15 or 16 (Office 365, 2016, 2019 or 2021) 47 | LBResult 48 | The list of recently opened Excel documents. 49 | LBScripts 50 | 51 | LBDefaultScript 52 | 53 | LBKeepWindowActive 54 | 55 | LBResultType 56 | unknown 57 | LBReturnsResult 58 | 59 | LBScriptName 60 | default.py 61 | 62 | 63 | LSMinimumSystemVersion 64 | 10.10 65 | NSHumanReadableCopyright 66 | Copyright © 2016–22 Nicholas Riley 67 | 68 | 69 | -------------------------------------------------------------------------------- /Recent PowerPoint Documents.lbaction/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIconFile 6 | com.microsoft.Powerpoint:POTX 7 | CFBundleIdentifier 8 | net.sabi.LaunchBar.action.RecentPowerPointDocuments 9 | CFBundleName 10 | Recent PowerPoint Documents 11 | CFBundleVersion 12 | 1.2b1 13 | LBAssociatedApplication 14 | com.microsoft.Powerpoint 15 | LBDescription 16 | 17 | LBAuthor 18 | Nicholas Riley 19 | LBChangelog 20 | 21 | 1.2: Bundles Python 3.10.2 in preparation for macOS 12.3 removing Python 2. 22 | 1.1: Adds support for Office 16/2019. 23 | 1.0: Fixes crash with Unicode characters in cloud-hosted document names. 24 | 1.0b2: Adds support for cloud-hosted documents (e.g. SharePoint, OneDrive). Always sorts most recent documents first. Adds support for automatic updates if you have the Action Updates action installed. 25 | 26 | LBDownloadURL 27 | https://github.com/nriley/LBOfficeMRU/releases/download/v1.2b1/LBOfficeMRU-1.2b1.zip 28 | LBEmail 29 | launchbar@sabi.net 30 | LBRequirements 31 | Microsoft PowerPoint 15 or 16 (Office 365, 2016, 2019 or 2021) 32 | LBResult 33 | The list of recently opened PowerPoint documents. 34 | LBSummary 35 | This action returns a list of recently opened PowerPoint documents. 36 | LBTwitter 37 | @nriley 38 | LBUpdateURL 39 | https://raw.githubusercontent.com/nriley/LBOfficeMRU/master/Recent%20PowerPoint%20Documents.lbaction/Contents/Info.plist 40 | LBWebsiteURL 41 | https://sabi.net/nriley/software/#launchbar 42 | 43 | LBRequiredApplication 44 | com.microsoft.Powerpoint 45 | LBRequirements 46 | Microsoft PowerPoint 15 or 16 (Office 365, 2016, 2019 or 2021) 47 | LBResult 48 | The list of recently opened PowerPoint documents. 49 | LBScripts 50 | 51 | LBDefaultScript 52 | 53 | LBKeepWindowActive 54 | 55 | LBResultType 56 | unknown 57 | LBReturnsResult 58 | 59 | LBScriptName 60 | default.py 61 | 62 | 63 | LSMinimumSystemVersion 64 | 10.10 65 | NSHumanReadableCopyright 66 | Copyright © 2016–22 Nicholas Riley 67 | 68 | 69 | -------------------------------------------------------------------------------- /Scripts/release.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import argparse 4 | import compileall 5 | import json 6 | import os 7 | import plistlib 8 | import shutil 9 | import subprocess 10 | import sys 11 | import tempfile 12 | import webbrowser 13 | 14 | import PyInstaller.__main__ 15 | 16 | from contextlib import contextmanager 17 | from packaging.version import Version 18 | from pathlib import Path 19 | from urllib.parse import quote, urlencode 20 | 21 | @contextmanager 22 | def info_plist(bundle_path): 23 | info_plist_path = bundle_path / 'Contents' / 'Info.plist' 24 | with open(info_plist_path, 'rb') as plist_file: 25 | info_plist = plistlib.load(plist_file) 26 | yield info_plist 27 | with open(info_plist_path, 'wb') as plist_file: 28 | plistlib.dump(info_plist, plist_file) 29 | 30 | def expand_url_template(url_template, *args, **query): 31 | url = url_template 32 | if args: 33 | url = url % tuple(map(quote, args)) 34 | if query: 35 | url += '?' + urlencode(query) 36 | return url 37 | 38 | def update_bundle_version(bundle_path, version, repo): 39 | with info_plist(bundle_path) as info: 40 | info['CFBundleVersion'] = version 41 | info['LBDescription']['LBDownloadURL'] = expand_url_template( 42 | 'https://github.com/%s/releases/download/%s/%s-%s.zip', repo, 43 | tag_for_version(version), repo.split('/', 1)[1], version) 44 | 45 | def update_bundle_default_script(bundle_path): 46 | with info_plist(bundle_path) as info: 47 | default_script = info['LBScripts']['LBDefaultScript'] 48 | script_name = default_script['LBScriptName'] 49 | default_script['LBScriptName'] = os.path.splitext(script_name)[0] 50 | return (script_name, default_script['LBScriptName']) 51 | 52 | def sign_bundle(bundle_path): 53 | subprocess.check_call(['/usr/bin/codesign', '-fs', 'Developer ID Application: Nicholas Riley', 54 | bundle_path]) 55 | 56 | def output(*args): 57 | return subprocess.check_output(args, encoding='utf-8') 58 | 59 | PROJECT_PATH = None 60 | def project_path(): 61 | global PROJECT_PATH 62 | if PROJECT_PATH is None: 63 | PROJECT_PATH = output('/usr/bin/git', '-C', os.path.dirname(__file__), 64 | 'rev-parse', '--show-toplevel').rstrip('\n') 65 | return Path(PROJECT_PATH) 66 | 67 | def git(*args): 68 | return output('/usr/bin/git', '-C', project_path(), *args) 69 | 70 | def archive_bundles(product_name, version, bundle_paths): 71 | file_paths = git('ls-files', '-z', *bundle_paths).rstrip('\0').split('\0') 72 | 73 | git('commit', '-am', version) 74 | 75 | dest_dir_path = Path(tempfile.mkdtemp(prefix='dest_' + product_name)) 76 | work_dir_path = Path(tempfile.mkdtemp(prefix='work_' + product_name)) 77 | archive_dir_path = dest_dir_path / f'{product_name} {version}' 78 | git('checkout-index', f'--prefix={archive_dir_path}/', *file_paths) 79 | git('reset', 'HEAD~') 80 | 81 | for bundle_path in bundle_paths: 82 | archive_bundle_path = archive_dir_path / bundle_path 83 | 84 | contents_path = archive_bundle_path / 'Contents' 85 | scripts_path = contents_path / 'Scripts' 86 | default_script_name, exec_name = update_bundle_default_script(archive_bundle_path) 87 | with info_plist(archive_bundle_path) as info: 88 | bundle_identifier = info['CFBundleIdentifier'] 89 | 90 | PyInstaller.__main__.run([ 91 | str(scripts_path / default_script_name), 92 | '--distpath', str(contents_path), 93 | '-n', exec_name, 94 | '-y', 95 | '--clean', 96 | '--target-architecture', 'universal2', 97 | '--workpath', str(work_dir_path), 98 | '--specpath', str(work_dir_path), 99 | '--osx-bundle-identifier', bundle_identifier, 100 | '--codesign-identity', 'Developer ID Application: Nicholas Riley' 101 | ]) 102 | 103 | staging_path = contents_path / exec_name 104 | shutil.rmtree(scripts_path) 105 | staging_path.rename(scripts_path) 106 | 107 | sign_bundle(archive_bundle_path) 108 | 109 | shutil.rmtree(work_dir_path) 110 | 111 | # note: a single action can be zipped into a .lbaction file instead 112 | archive_path = project_path() / f'{product_name}-{version}.zip' 113 | subprocess.check_call(['/usr/bin/ditto', '-ck', dest_dir_path, archive_path]) 114 | shutil.rmtree(dest_dir_path) 115 | 116 | return archive_path 117 | 118 | def tag_for_version(version): 119 | return 'v' + version 120 | 121 | def upload_release(repo, version, archive_path, github_access_token): 122 | package_version = Version(version) 123 | 124 | releases_url = expand_url_template( 125 | 'https://api.github.com/repos/%s/releases', repo) 126 | 127 | release_name = tag_for_version(version) 128 | release_json = dict(tag_name=release_name, target_commitish='master', 129 | name=release_name, body='', draft=True, 130 | prerelease=package_version.is_prerelease) 131 | 132 | releases_api = subprocess.Popen( 133 | ['/usr/bin/curl', '-u', 'nriley:' + github_access_token, 134 | '--data', '@-', releases_url], 135 | stdin=subprocess.PIPE, stdout=subprocess.PIPE, encoding='utf-8') 136 | release_json_data, _ = releases_api.communicate(json.dumps(release_json)) 137 | release_json = json.loads(release_json_data) 138 | 139 | html_url = release_json['html_url'] 140 | upload_url = release_json['upload_url'].split('{', 1)[0] 141 | upload_url = expand_url_template(upload_url, 142 | name=os.path.basename(archive_path)) 143 | subprocess.check_call( 144 | ['/usr/bin/curl', '-u', 'nriley:' + github_access_token, 145 | '-H', 'Content-Type: application/zip', 146 | '--data-binary', f'@{archive_path}', upload_url]) 147 | 148 | return html_url 149 | 150 | def release(version, github_access_token): 151 | repo = 'nriley/LBOfficeMRU' 152 | os.chdir(project_path()) 153 | action_paths = sorted(Path().glob('*.lbaction')) 154 | 155 | for action_path in action_paths: 156 | # update version number and download URL in the working copy so it can be committed 157 | update_bundle_version(action_path, version, repo) 158 | 159 | archive_path = archive_bundles('LBOfficeMRU', version, action_paths) 160 | 161 | subprocess.check_call(['/usr/bin/xcrun', 'notarytool', 'submit', archive_path, 162 | '--keychain-profile', 'Notarization', '--wait']) 163 | 164 | if github_access_token is None: 165 | return 166 | 167 | html_url = upload_release('nriley/LBOfficeMRU', version, archive_path, github_access_token) 168 | webbrowser.open(html_url) 169 | 170 | print() 171 | print("Make sure changes are committed and pushed before saving release as final!") 172 | 173 | if __name__ == '__main__': 174 | parser = argparse.ArgumentParser(description='Build and optionally release to GitHub.') 175 | parser.add_argument('version') 176 | parser.add_argument('github_access_token', nargs='?', default=None) 177 | 178 | args = parser.parse_args() 179 | 180 | release(args.version, args.github_access_token) 181 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------