Skip to main content
Participant
March 13, 2010
Question

Filter Plug-In get image file name

  • March 13, 2010
  • 3 replies
  • 2120 views

Hi,

I have a filter plug-in (it's using FilterRecord structure) and after filtering I want to save some statistics in a report file.In the header of the report I want also to write the image file name. Everyhting is nice but I cannot find anywhere the name the name of the oppend image (e.g. image1.jpeg).

Does anybody have an ideea how could I get the filtered image (file) name?

Thanks,

Paul

This topic has been closed for replies.

3 replies

Inspiring
May 9, 2017

7 years later~ I'm unable to get the PropertyUtils.h to build on my machine using the Photoshop SDK... anyone have a fix for this?

Participant
March 24, 2010

Hi,

I found the way to do it. If someone else is interested in this topic here is how I did it:

// global variable

PropertyProcs *propSuite;


DLLExport MACPASCAL void PluginMain(const int16 selector,
                                    FilterRecordPtr filterRecord,
                                    intptr_t * data,
                                    int16 * result)

{

// ........................

    propSuite = ((FilterRecordPtr)filterRecord)->propertyProcs;

    char *sFileName;

    Handle hFileName = gFilterRecord->handleProcs->newProc(100);

    propSuite->getPropertyProc('8BIM', 'titl', 0, nil, &hFileName);
    sFileName = (char*)(*hFileName);

    gFilterRecord->handleProcs->disposeProc(hFileName);


// ..........................

}

Paulie

Participant
July 26, 2010

Hi everyone,

TheRealPaulie, i am trying to do something similar to what you described in your first post (getting file name for a report), and i used the code you posted before.

The problem is, sFileName either contains some non-intelligible string , or has some random characters in it, with the name i want in the midst.

Is that some kind of platform-specific string rappresentation problem? How can i solve it?

I am working under Windows 7 on Visual Studio 2010, if it can help.

Participant
July 26, 2010

Hi Mihai,

I had the same problem but I didn't added any other comments on the forum post.

Anyhow I know that I've lost a lot of time and I was just able to minimize the problem and not to remove it. I got lost in string/char function and I finally I quited - it was not that important for me. I think the problem is realted with the char variables, and using the line  sFileName =  (char*)(*hFileName);  it stores in sFileName just the reference and don't make a copy of what was read in with getPropertyProc().

Because I've was nervos and I was not able to use some CString functions (because is not MFC) I used a dirty way of minimizing the problem:

char *RemoveNoValidChar(char *Input)
{
    int index = 0;
    for (int i=0; i<strlen(Input); i++)
    {
        if (Input >= 32 && Input<=126)
            index++;
    }

    char *Output = new char [index+1];
    strncpy(Output, Input, index);
    Output[index] = '\0';
    return Output;
}

void MainFunction()

{

   ...............

    hFileName = gFilterRecord->handleProcs->newProc(100);


    (*hFileName) = "";
    propSuite->getPropertyProc('8BIM', 'titl', 0, nil, &hFileName);
    gData->sFileName = RemoveNoValidChar((char*)(*hFileName));
    gFilterRecord->handleProcs->disposeProc(hFileName);

   ....................

}

If you find a real solution for it please share it, I'm really curious how this problem can be solved.

If you have some other questions please feel free to ask.

Regards,

Paul T.

Chris Cox
Legend
March 13, 2010

PropertyProcs would be a start.

Participant
March 23, 2010

Hi Chris,

Thank you for your hint. I've tried to do it but I still don't find the right way.

Ok, I have to use the function: GetPropertyProc PropertyProcs::getPropertyProc, but I don't know which property should I read.

Can you please send me a samll example (a line ore two) or the name of a SDK example that uses it.

Thanks,

Paul

Chris Cox
Legend
March 24, 2010

I don't have an example handy at the moment (don't know all the current SDK code, either).

But most of the properties should be documented in the SDK.