Created
March 9, 2011 21:47
-
-
Save kanemu/863076 to your computer and use it in GitHub Desktop.
[indesign]選択範囲内の行にハイパーリンク先があるかどうか調べる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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