Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Plugin and Companion App SDK
Viewing all articles
Browse latest Browse all 54282

[automation plugin c++] Create a new file from clipboard

$
0
0

Hi!

 

I'm creating automation plugin using c++.

 

I'm copying some selection, and want to create a new file with it (so, with clipboard).

 

And I have a autogenerated code (from listener) for that:

 

SPErr MakeNewDocument(/*your parameters go here*/void)

{

     PIActionDescriptor result = NULL;

     DescriptorTypeID runtimeKeyID;

     SPErr error = kSPNoError;

     // Move this to the top of the routine!

     PIActionDescriptor desc000001A0 = NULL;

 

     error = sPSActionDescriptor->Make(&desc000001A0);

     if (error) goto returnError;

 

          // Move this to the top of the routine!

          PIActionDescriptor desc000001A8 = NULL;

 

          error = sPSActionDescriptor->Make(&desc000001A8);

          if (error) goto returnError;

 

          error = sPSActionControl->StringIDToTypeID("preset", &runtimeKeyID);

          if (error) goto returnError;

 

          // Unicode String as UTF8: Буфер Обмена (Clipboard in English)

          error = sPSActionDescriptor->PutString(desc000001A8, runtimeKeyID, "Áóôåð îáìåíà"); <------------------ this is "Clipboard", but in russian. I need something more language-independent

          if (error) goto returnError;

 

     error = sPSActionDescriptor->PutObject(desc000001A0, keyNew, classDocument, desc000001A8);

     if (error) goto returnError;

 

     error = sPSActionControl->Play(&result, eventMake, desc000001A0, plugInDialogSilent);

     if (error) goto returnError;

 

returnError:

     if (result != NULL) sPSActionDescriptor->Free(result);

     if (desc000001A0 != NULL) sPSActionDescriptor->Free(desc000001A0);

     if (desc000001A8 != NULL) sPSActionDescriptor->Free(desc000001A8);

     return error;

}

 

 

So that code works only in russian PS. That's ugly. How to do the same but without strings like that? Maybe there is typeID for it? ))


Viewing all articles
Browse latest Browse all 54282

Trending Articles