Skip to main content
Participant
January 24, 2024
Question

Can we reinitLink with custome URI schema?

  • January 24, 2024
  • 1 reply
  • 183 views

Hi everyone,

 

I have developed an InDesign Plugin with a custom link handler (ILinkResourceFactory) with a specific schema, e.g: XXX://path

static const WideString k_fileScheme("XXX");

void CusDtLnkLinkResourceFactory::GetSchemes(K2Vector<WideString>& schemes) const
{
	schemes.clear();
	schemes.push_back(k_fileScheme);
}

It works perfectly fine!

 

However, while working with INDD Server script, I have no way to relink to a link with my custom schema, it seems that accepts only schema file:

// This line works
link.reinitLink("file://path");

// This line does NOT work
link.reinitLink("XXX://path");

 

Is there any way to relink with a custom schema so my plugin can regconize it?

 

Thanks very much!

This topic has been closed for replies.

1 reply

Community Expert
March 10, 2024

Maybe try file schema

I've no idea if this is correct or not - I'm not an inDesign scripter - but I do try

 

Apologies if that is not what you're asking or if it's wrong - but if it's not right - hopefully it gives you an idea.

 

// Store the original schema
WideString originalSchema = k_fileScheme;

// Temporarily change the schema to "file://" for relinking
k_fileScheme = "file";

// Perform the relinking with the "file://" schema
link.reinitLink("file://path");

// Switch back to the original schema
k_fileScheme = originalSchema;