Link in Zwischenablage kopieren
Kopiert
I have an XML embedded InDesign file in which some page numbers are given under link tag. The first page information, before endash(–), will be link to "start" attribute and sendcond page information, after the endash(–), will be link to "end" attribute.
The first page informatio is 125 and the second page information is 26 in the below example.
<link start="c51351-549" end="c51351-550">125–26</link>
Everything I have done but not able to select both the informations individually to link means I have to first select the 125 and link, and after that I have to select 26 and make a link. I'm using the followin code to select the information which select both 125 and 26 with endash.
var root = myDoc.xmlElements[0];
var xpath = "//link";
var node = null;
try
{
var proc = app.xmlRuleProcessors.add ([xpath]);
var match = proc.startProcessingRuleSet (root);
while( match!=undefined )
{
node = match.element;
myDoc.select(node.texts);
sourceText=myDoc.selection[0];
Please, could you look into this and do the needful.
Thanks,
Anil Yadav
Link in Zwischenablage kopieren
Kopiert
Hi Anil Yadav,
Select the XML Element [link] and execute the below code:
var myText = app.selection[0].texts[0];
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.findWhat = "[0-9]+";
var myFound = myText.findGrep();
for(var Len = 0; Len < myFound.length; Len++)
{
myFound[Len].select();
alert(myFound[Len].contents)
}
I hope this will give you the idea.
Regards,
Ramkumar .P
Link in Zwischenablage kopieren
Kopiert
Thank you very much!!!
Anil Yadav
Link in Zwischenablage kopieren
Kopiert
hi Ram,
how to find the paticular word from element content.
eg)
<para>select the partially text</para>
From above content i have to select "partially", only.
Thanks
Link in Zwischenablage kopieren
Kopiert
replace your text in findWhat
Like below
Link in Zwischenablage kopieren
Kopiert
yes, Thanks Shonky
Link in Zwischenablage kopieren
Kopiert
app.selection[0].paragraphs[0].words[2].select();
(where your cursor is anywhere inside that paragraph.) Apparently, "<para>select" is considered the first word (#0) ...
Something that hasn't been mentioned so far: for most purposes, it is not really necessary to select something with a script -- only if you want the user to see what got selected.
For instance, to underline the word 'partially', one would simply use
app.selection[0].paragraphs[0].words[2].underline = true;
-- which works fundamentally different. If you select the first word and run the script, the fourth one gets underlined but the selection stays on the first word.
[Ed.] (For the fourth time! What's wrong with this Jive editor!?)
Link in Zwischenablage kopieren
Kopiert
[Ed.] (For the fourth time! What's wrong with this Jive editor!?)
It's crap
robin
www.adobescripts.com
Weitere Inspirationen, Events und Ressourcen finden Sie in der neuen Adobe Community
Jetzt ansehen