Hi All,
In my automation plugin I need to have full absolute path of the opened document with any possible non-English letters. Using SDK examples Listener and Getter that come with Photoshop SDK the full absolute path which I obtain is in the default ANSI code page (CP_ACP) and I can convert it to Unicode using MultiByteToWideChar() API. However this works well when I have corresponding to document name language set in the "Control Panel -> Regional and Language Options -> Advanced -> Select a language to match the language version of the non-Unicode programs you want to use." For example if name of the document has Russian letters and chosen language in "Regional and Language Options" is also Russian the described conversion works well. If I change "Regional and Language Options" to English for example, full path returned by Photoshop SDK API (AliasToFullPath in PIUFile.cpp) for the document with Russian letters will contain "????????.psd" symbols.
So I need to have an ability to get absolute file path in Unicode. Is it possible in Photoshop CS2/CS3/CS4 for Windows? I have searched forum and SDK but could not find info on it.
Is it possible to have native HANDLE of the opened file to get file info using Windows API?
Please advice.
Below given slightly modified code from Photoshop CS3 which I use to get absolute file pat of the opened document.
Thanks and regards,
Sergey
*******************************************************************
std::string outFilePath;
....
int32 theID = 0;
SPErr error = kSPNoError;
error = PIUGetInfo(classDocument, keyDocumentID, &theID, NULL);
if (error == kSPNoError)
{
Handle theFileHandle = NULL;
error = PIUGetInfoByID(theID, classDocument, keyFileReference, &theFileHandle, NULL);
if (error == kSPNoError)
{
int32 length = sPSHandle->GetSize(theFileHandle);
Boolean oldLock = FALSE;
Ptr pointer = NULL;
sPSHandle->SetLock(theFileHandle, true, &pointer, &oldLock);
if (pointer != NULL)
{
outFilePath = (char*)pointer;
sPSHandle->SetLock(theFileHandle, oldLock, &pointer, &oldLock);
}
}
}
In my automation plugin I need to have full absolute path of the opened document with any possible non-English letters. Using SDK examples Listener and Getter that come with Photoshop SDK the full absolute path which I obtain is in the default ANSI code page (CP_ACP) and I can convert it to Unicode using MultiByteToWideChar() API. However this works well when I have corresponding to document name language set in the "Control Panel -> Regional and Language Options -> Advanced -> Select a language to match the language version of the non-Unicode programs you want to use." For example if name of the document has Russian letters and chosen language in "Regional and Language Options" is also Russian the described conversion works well. If I change "Regional and Language Options" to English for example, full path returned by Photoshop SDK API (AliasToFullPath in PIUFile.cpp) for the document with Russian letters will contain "????????.psd" symbols.
So I need to have an ability to get absolute file path in Unicode. Is it possible in Photoshop CS2/CS3/CS4 for Windows? I have searched forum and SDK but could not find info on it.
Is it possible to have native HANDLE of the opened file to get file info using Windows API?
Please advice.
Below given slightly modified code from Photoshop CS3 which I use to get absolute file pat of the opened document.
Thanks and regards,
Sergey
*******************************************************************
std::string outFilePath;
....
int32 theID = 0;
SPErr error = kSPNoError;
error = PIUGetInfo(classDocument, keyDocumentID, &theID, NULL);
if (error == kSPNoError)
{
Handle theFileHandle = NULL;
error = PIUGetInfoByID(theID, classDocument, keyFileReference, &theFileHandle, NULL);
if (error == kSPNoError)
{
int32 length = sPSHandle->GetSize(theFileHandle);
Boolean oldLock = FALSE;
Ptr pointer = NULL;
sPSHandle->SetLock(theFileHandle, true, &pointer, &oldLock);
if (pointer != NULL)
{
outFilePath = (char*)pointer;
sPSHandle->SetLock(theFileHandle, oldLock, &pointer, &oldLock);
}
}
}