Skip to content

ImSingee/OFScriptsTemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeScript OmniFocus Scripts!

Support TypeScript & Support Bundler!

Getting Started

  1. Use this template to create a repository
  2. Clone the repository you created
  3. Run pnpm install to install dependencies
  4. Run pnpm build to build scripts

The script source code is located in the src directory, and the compile results (which can be used by OmniFocus) are in the dist directory.

Add New Script

Any typescript file inside src directory is treated as an OmniFocus script.

If you want to ignore some scripts (e.g., treat them as utility scripts), ensure their filenames start with an underscore (_).

Any script must follow the following pattern:

export const action = new PlugIn.Action(function (selection) {
  // do anything you want
});

action.validate = function (selection) {
  // do anything you want
};

export const meta: Meta = {
  label: "...",
  description: "...",
  identifier: "...",
  author: "...",
  version: "0.1",
};

Note:

  1. action and meta are required, action.validate is optional.
  2. meta must appear as the last section of the script; no code should follow it.

Build

Run pnpm build, the built scripts (ended with .omnifocusjs) will be placed in the dist directory.

Using Third-Party Dependencies

Feel free to use third-party dependencies. All imports will be bundled; however, be aware that imported scripts might not function properly in the Omni Automation environment.

Examples

See src directory for some pre-built scripts.

Syncing with OmniFocus

If you are using iCloud to save your OmniFocus Scripts, you can use pnpm sync to automatically sync built scripts (which is generated by pnpm build) to your OmniFocus Scripts directory.

If your OmniFocus Scripts are located elsewhere, modify the sync.sh script accordingly..

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published