Coder Social home page Coder Social logo

scan-categorizer's Introduction

clasp

Scan Categorizer v2 ๐Ÿ—ƒ

Script that organizes all PDF files and moves, renames and creates shortcuts dynamically according to predefined categories and file contents. This script can easily be implemented in your current workflows and saves time navigating through Google Drive and enforces directory structures.

Currently, there are two types of conditions that can be applied to each category:

  • or conditions, which require the document to include one of the words defined.
  • and conditions, which require the document to include all the words defined.

The conditions can also be chained and multiple conditions of different types can be applied to one category.

// Don't worry, there is no coding skills required. Just use the UI to generate conditions!
const conditions = [
  {name: 'Lorem', conditions: [and('lorem', 'ipsum')], path: 'Lorem/$y'},
  {name: 'Ipsum', conditions: [or('ipsum', 'dolor')], path: 'Ipsum/$y'},
  {
    name: 'Ipsum',
    conditions: [or('ipsum', 'dolor'), and('lorem', 'ipsum')],
    path: 'Ipsum/$y',
  },
];

If you want to match multiple words you can simply use a RegExp. For example, if you want to match all documents that contain the words Lorem Ipsum, you can use the following RegExp: /lorem ipsum/.

It's important to use a space between the words, otherwise the script will not be able to match the words correctly and bare in mind that default JavaScript RegExp are case sensitive and must be lowercase only.

Table of contents ๐Ÿ“š

Getting Started ๐Ÿš€

Follow the 7 simple steps in the Installation guide and start configuring your categories. You can even add your code and customize it even more.

Installation ๐Ÿ‘พ

Step 1 - Create new Script

Create a new Google Script Project within your Google Account. (If App Script is not enabled for your account ask your administrator or switch the account.) When created the project should open an editor.

Step 2 - Add library

In the sidebar menu, click the plus icon on the left-hand side of Libraries.

Screenshot

  • Insert 1489WTMiopg0jt53nfftMhbrHyuF67ieIKOoN2ZCuLLUYNRynw6u6GFS2 as script ID.
  • Select your version. (In most cases, choose the latest version.)
  • Import the library with the name sc.

Step 3 - Configure

Insert the contents from category UI into your Code.gs file. When running the script you get should asked for permission. Grant the required permissions and test the script.

It's recommended to test your configuration before creating a Trigger.

Possible use cases ๐Ÿ”ฅ

  • Finally, go digital by scanning and automatically organizing your old papers.
  • Enforce directory structures.
  • Automatically distribute incoming mail.
  • Create shortcuts for each invoice for your taxes.

Migrate ๐Ÿšง

Thanks for using version 1 already, you're awesome! There are several changes in version 2 that will affect your current configurations.

  • $S argument has been deprecated and can no longer be used.
  • There is no more notification email when documents can't get categorized.
  • When using custom rename functions the addShortcut has also been deprecated.
  • The keywords property has been replaced by conditions.
v1 Syntax v2 Syntax
{
  name: "Lorem",
  keywords: ["Lorem", "Ipsum"],
  path: "Lorem/$y/$m",
}
{
  name: "Lorem",
  conditions: [or("Lorem", "Ipsum")],
  path: "Lorem/$y/$m",
}
{
  name: "Lorem",
  keywords: ["Lorem", "Ipsum"],
  shortcuts: ["Ipsum/$y"]
  path: "Lorem/$y/$m",
}
{
  name: "Lorem",
  conditions: [or("Lorem", "Ipsum")],
  shortcuts: ["Ipsum/$y"] // Still the same
  path: "Lorem/$y/$m",
}

We're sorry if you ran into problems. Please open an Issue if you need help.

API โœจ

Functions

sc.categorize(categories: Query.Category[], src: string[]): void

Development ๐Ÿฆบ

The repository uses Typescript and transpires and pushes the code to the corresponding Google App Script.

Clone the repository and install the dependencies with yarn install. Keep in mind that by default, every function is hidden by using the namespace technique described by clasp docs. To export a function to the users, simply define a wrapper function inside the index.ts file (See existing for guidance).

Authors ๐Ÿ’ป

Contributing ๐Ÿค

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate and meet the quality gate requirements.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.