Skip to content

Instantly share code, notes, and snippets.

@kanemu
Created March 9, 2011 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kanemu/863076 to your computer and use it in GitHub Desktop.
Save kanemu/863076 to your computer and use it in GitHub Desktop.
[indesign]選択範囲内の行にハイパーリンク先があるかどうか調べる
(function(){
//選択範囲内の行にハイパーリンク先があるかどうか調べる
if(app.documents.length===0)return;
var doc = app.activeDocument;
if(doc.selection.length===0)return;
var paras = doc.selection[0].paragraphs;
if(paras){
var destTexts = doc.hyperlinkTextDestinations;
var destParas = destTexts.everyItem().destinationText;
for(var d=destParas.length-1;d>-1;d--){
destParas[d]=destParas[d].paragraphs[0];
};
var nameList = [];
for(var i=0,len=paras.length;i<len;i++){
var para = paras[i];
for(var d=destParas.length-1;d>-1;d--){
if(para===destParas[d]){
nameList.push(destTexts[d].name);
};
};
};
if(nameList.length>0){
alert('選択範囲内の行にハイパーリンク先が'+nameList.length+'個あります。\n'+nameList.join('\n'));
}else{
alert('選択範囲内の行にハイパーリンク先はありません。');
}
};
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment