Author Topic: Automation Tagging?  (Read 3950 times)

0 Members and 1 Guest are viewing this topic.

jsoltani

  • Newbie
  • *
  • Posts: 5
Automation Tagging?
« on: March 19, 2015, 09:54:59 PM »
Hi, Is there a way for this software to monitor a mapped network drive (or multiple mapped network drives preferrably) and automatically tag new files based on a list of seperate automated tagging rules?
I.e. New files in a mapped network drive will go through a gauntlet of automated rules to tag it if it's an invoice, tag it based on the client name/account, tag it based on vendor, etc.

RTT

  • Administrator
  • *****
  • Posts: 764
Re: Automation Tagging?
« Reply #1 on: March 20, 2015, 12:20:29 AM »
Check the task automation folders tool. The edit info fields task tool has scripting functionality.

Or you may use the PDF-ShellTools command line and scripting interfaces to set the metadata, and use another tool/method to do the folder monitoring and call the command line/script when changes occur.

jsoltani

  • Newbie
  • *
  • Posts: 5
Re: Automation Tagging?
« Reply #2 on: March 20, 2015, 05:03:14 PM »
Thank you! I'm not a programmer so I don't know how to create the script but if you gave me a script template I might be able to get through it and modify the parameters to fit my needs... Is there a chance you will create a more user friendly non-scripting version for this problem?

RTT

  • Administrator
  • *****
  • Posts: 764
Re: Automation Tagging?
« Reply #3 on: March 20, 2015, 08:01:18 PM »
Can you describe a detailed example of the tagging process?
- From where do you get the data (is invoice, client name/account, vendor,...)?
- What metadata fields you want to fill, and how this data is generated?
- And so forth.

jsoltani

  • Newbie
  • *
  • Posts: 5
Re: Automation Tagging?
« Reply #4 on: March 20, 2015, 08:58:45 PM »
Sure, I would like to run a list of process' each process will run through and look through all files in mapped network drive  (or folder if this can't be done)
AND including subfolders The process will look for specific key words in the File Name and tag it. For example, File Name: Jay Soltani Widget 03 20 2015.pdf
I'd like to have one process that would search for and tag "Jay Soltani" "Widget" and "2015" so this file would have three tags (four if we can have one for .pdf extensions only)
I will then be able to use the windows explorer search function tags:Widget 2015 to find all Widgets in the year 2015 for example.

I think my word for tags is your word for keywords?

The second template would automatically tag the contents of a specific folder with a specified tag name (ie all files in folder "Checks" would be tagged "Checks"

With a good template, I could basically create multiple scripts for each tag I need (probably going to need to make myself around 200-300 scripts and then click run so I can tag my 10000+ files without having to go through individually...!

Once all these scripts are in place, I just need to look for some kind of way to automate the scripts (trigger would be nice but based on scheduled intervals would do)
This will basically allow me to find my files based on tags instead of a hierarchy of folders.
For example, if I have a bill from a vendor associated with a client - I currently have all my vendor bills compiled together by vendor, so it makes finding all bills in relation to a client a real pain in the butt. If I can do it by tags, I could simply look for Tags:Invoices;Client or Tags:Invoices;Vendor

This is the only thing I need before being able to really buy this pdf explorer and the pdf-shelltool for my company.
Thanks again! :)

Example attached


P.s. even better would be some kind of cool tool that allowed me to upload a csv of search terms and their related tag terms that would generate the scripts for me.

RTT

  • Administrator
  • *****
  • Posts: 764
Re: Automation Tagging?
« Reply #5 on: March 21, 2015, 03:06:05 AM »
If all the data you wanna use for search is already in the file name, or directory name, I'm failing to understand your need to put it also in the tags (keywords) field!
Your first example, with file name equal to "Jay Soltani Widget 03 20 2015.pdf", if you search for Widget 2015, the Windows search will find your file, and any other file that contains these two words.

Quote
The second template would automatically tag the contents of a specific folder with a specified tag name (ie all files in folder "Checks" would be tagged "Checks"
If you don't intend to move the file to a different folder, and for your example in the screenshot - "Cheung_1-9-2015 $400.00", if that file is in a "Checks" sub-folder, searching for Cheung 2015 Checks will find it, without the need to have these words in the tags field.

Quote
For example, if I have a bill from a vendor associated with a client - I currently have all my vendor bills compiled together by vendor, so it makes finding all bills in relation to a client a real pain in the butt.

But aren't the client names also in the file name of each bill? If yes - it's already possible to find it, if not - from where will the script get the name of the client to put in the tags?

Based in the examples you gave, doesn't seems too difficult to develop a script to parse these files, and containing folders, names and put the data in the tags field, but I'm probably missing something because I don't see why you need to do this. :-\

Here is a sample script that will add the containing sub-folder name to the keywords field, for each of the selected PDF files.
Code: [Select]
for (var i = 0; i < pdfe.SelectedFiles.Count; i++) {
    var File = pdfe.SelectedFiles(i);
    var FileMetadata = File.Metadata;

    //generate here your keywords, e.g. by parsing the pdfe.SelectedFiles(i).filename, to extract the containing sub-folder name.
    var Filename = File.Filename;
    var subfolder = Filename.substring(0, Filename.lastIndexOf('\\'));
    subfolder = subfolder.substring(subfolder.lastIndexOf('\\') + 1);

    FileMetadata.keywords = FileMetadata.keywords + ';' + subfolder;
    if (FileMetadata.CommitChanges()) {
        pdfe.echo(Filename + ' - OK');
    }
}

jsoltani

  • Newbie
  • *
  • Posts: 5
Re: Automation Tagging?
« Reply #6 on: March 23, 2015, 09:35:46 PM »
I appreciate the sample script!
I think we're close here... Rather than automatically assigning a tag equal to the name of the subfolder. Is there a way for me to manually specify a tag of my choice for all files in a folder?
I.e. if the folder name is "Checks Recvd" I'd like to manually tell the script to assign the tag "Checks" and not "Checks Recvd" to match the subfolder name.

Then I'd like to also tag manually based on a specific word in the file name. so if the script finds "AOM" in the filename then assign it tag "Assignment of Mortgage" for example

RTT

  • Administrator
  • *****
  • Posts: 764
Re: Automation Tagging?
« Reply #7 on: March 24, 2015, 01:05:20 AM »
Quote
Is there a way for me to manually specify a tag of my choice for all files in a folder?
I.e. if the folder name is "Checks Recvd" I'd like to manually tell the script to assign the tag "Checks" and not "Checks Recvd" to match the subfolder name.

You can have the script to ask for the keyword:
Code: [Select]
function MyPrompt(message, defaultValue) {
    var oIE = WScript.CreateObject("InternetExplorer.Application");
    oIE.navigate("about:blank");
    oIE.Visible = 0;

    while (oIE.Busy) {
        pdfe.sleep(500);
    }
    pdfe.BringWindowToFront(oIE.HWND);

    var obj = oIE.Document.Script;
    var input = obj.prompt(message, defaultValue);
    oIE.Quit();
    return input;
}


var Filename = pdfe.SelectedFiles(0).Filename;
var subfolder = Filename.substring(0, Filename.lastIndexOf('\\'));
subfolder = subfolder.substring(subfolder.lastIndexOf('\\') + 1);

subfolder = MyPrompt("What's the keyword for this subfolder?", subfolder);

if (subfolder)
for (var i = 0; i < pdfe.SelectedFiles.Count; i++) {
   var File = pdfe.SelectedFiles(i);
   var FileMetadata = File.Metadata;

    FileMetadata.keywords = FileMetadata.keywords + ';' + subfolder;
    if (FileMetadata.CommitChanges()) {
        pdfe.echo(Filename + ' - OK');
    }
}

Quote
Then I'd like to also tag manually based on a specific word in the file name. so if the script finds "AOM" in the filename then assign it tag "Assignment of Mortgage" for example
Manually?!
if you have a fixed list of these abbreviations you can have the script to automatically find them and add the corresponding value to the list of tags.
Code: [Select]
var abbrevs = [{
    'key': 'AOM',
    'value': 'Assignment of Mortgage'
}, {
    'key': 'BAU',
    'value': 'Business As Usual'
}]

for (var i = 0; i < pdfe.SelectedFiles.Count; i++) {
    var File = pdfe.SelectedFiles(i);
    var Filename = File.Filename;
    var FileMetadata = File.Metadata;

    var oriKeywordsStr = FileMetadata.Keywords;

    if (oriKeywordsStr) {
        var newKeywords = oriKeywordsStr.split(';');
    } else {
        var newKeywords = [];
    }

    for (var n = 0; n < abbrevs.length; n++) {
        //var reg = new RegExp("\\b" + abbrevs[n].key + "\\b");
        var reg = new RegExp(abbrevs[n].key);
        if (reg.test(Filename)) {
            newKeywords.push(abbrevs[n].value);
        }
    }

    var uniqueKeywords = removeDublicates(newKeywords);
    newKeywordsStr = FileMetadata.keywords = uniqueKeywords.join(';');

    if (newKeywordsStr != oriKeywordsStr) {
        if (FileMetadata.CommitChanges()) {
            pdfe.echo(Filename + ' - OK');
        }
    }
}

/*********************************************************/

function arrayIndexOf(arr, obj, start) {
    for (var i = (start || 0); i < arr.length; i++) {
        if (arr[i] == obj) {
            return i;
        }
    }
    return -1;
}

function removeDublicates(arr) {
    var result = [];
    for (var i in arr) {
        if (arrayIndexOf(result, arr[i]) === -1) {
            result.push(arr[i]);
        }
    }
    return result
}


jsoltani

  • Newbie
  • *
  • Posts: 5
Re: Automation Tagging?
« Reply #8 on: March 24, 2015, 01:32:58 AM »
Sounds good! Let me give these a shot and I'll get back to ya