Highlighted

Script to change HyperlinkPageDestination ViewSetting

New Here ,
Oct 16, 2020

Copy link to clipboard

Copied

Hi.

I am trying to speed up my process of creating page links. As InDesign does not allow the default of 'Fixed' to be changed, I would like to create a script to run through the document and change the setting of all HyperlinkPageDestination ViewSetting.

 

The code I am trying to change is underlined below:

</Properties>
</HyperlinkPageDestination>
<HyperlinkPageDestination Self="HyperlinkPageDestination/.122286" Name=".122286" NameManually="true" DestinationPage="n" ViewSetting="FitWidth" ViewPercentage="105" Hidden="true" DestinationUniqueKey="106">
 
The script I have tried to chop together (amongst others) is:
var doc = app.activeDocument;
for(var i = 0; i < doc.HyperlinkPageDestination.length; i++) {
try {
doc.HyperlinkPageDestination.item(i).ViewSetting = doc.HyperlinkPageDestination.item(i).ViewSetting.replace("Fixed", "FitWindow");
} catch(e){}
};
 
This generates an 'Error Number: 55'. Does not support the property or method 'HyperlinkPageDestination'. The source is:
for(var i = 0; i < doc.HyperlinkPageDestination.length; i++) {
 
If anyone can help, I would really appreciate it.
Thanks in advance.
Adobe Community Professional
Correct answer by Manan Joshi | Adobe Community Professional

Try the following

 

var doc = app.activeDocument;
for(var i = 0; i < doc.hyperlinkPageDestinations.length; i++) {
try {
	doc.hyperlinkPageDestinations[i].viewSetting = HyperlinkDestinationPageSetting.FIT_WINDOW
} catch(e){}
};

 

-Manan

TOPICS
Scripting

Views

28

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Script to change HyperlinkPageDestination ViewSetting

New Here ,
Oct 16, 2020

Copy link to clipboard

Copied

Hi.

I am trying to speed up my process of creating page links. As InDesign does not allow the default of 'Fixed' to be changed, I would like to create a script to run through the document and change the setting of all HyperlinkPageDestination ViewSetting.

 

The code I am trying to change is underlined below:

</Properties>
</HyperlinkPageDestination>
<HyperlinkPageDestination Self="HyperlinkPageDestination/.122286" Name=".122286" NameManually="true" DestinationPage="n" ViewSetting="FitWidth" ViewPercentage="105" Hidden="true" DestinationUniqueKey="106">
 
The script I have tried to chop together (amongst others) is:
var doc = app.activeDocument;
for(var i = 0; i < doc.HyperlinkPageDestination.length; i++) {
try {
doc.HyperlinkPageDestination.item(i).ViewSetting = doc.HyperlinkPageDestination.item(i).ViewSetting.replace("Fixed", "FitWindow");
} catch(e){}
};
 
This generates an 'Error Number: 55'. Does not support the property or method 'HyperlinkPageDestination'. The source is:
for(var i = 0; i < doc.HyperlinkPageDestination.length; i++) {
 
If anyone can help, I would really appreciate it.
Thanks in advance.
Adobe Community Professional
Correct answer by Manan Joshi | Adobe Community Professional

Try the following

 

var doc = app.activeDocument;
for(var i = 0; i < doc.hyperlinkPageDestinations.length; i++) {
try {
	doc.hyperlinkPageDestinations[i].viewSetting = HyperlinkDestinationPageSetting.FIT_WINDOW
} catch(e){}
};

 

-Manan

TOPICS
Scripting

Views

29

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 16, 2020 0
Adobe Community Professional ,
Oct 16, 2020

Copy link to clipboard

Copied

Try the following

 

var doc = app.activeDocument;
for(var i = 0; i < doc.hyperlinkPageDestinations.length; i++) {
try {
	doc.hyperlinkPageDestinations[i].viewSetting = HyperlinkDestinationPageSetting.FIT_WINDOW
} catch(e){}
};

 

-Manan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 16, 2020 0
New Here ,
Oct 16, 2020

Copy link to clipboard

Copied

Many thanks for the reply.

The script runs without error, but does not change the ViewSetting.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 16, 2020 0
Adobe Community Professional ,
Oct 16, 2020

Copy link to clipboard

Copied

Try it again, I edited the code after I posted the first time. The viewSettings had a typo, the v should be lowercase. No errors are shown because of the try-catch block

-Manan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 16, 2020 0
New Here ,
Oct 16, 2020

Copy link to clipboard

Copied

Genius! Works perfectly.

Thank you so much!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 16, 2020 0