2 Replies Latest reply on Nov 13, 2008 12:56 PM by (Ir)

    Footnote Reference with punctutation after reference to go before reference in text script error

      Hi All<br /><br />For about three weeks I have been trying various methods of search/replacing in InDesign for a footnote reference number "^F" followed by any punctuation ".,;:?!" and placing the punctuation before the reference and deleting the one after I tried using GREP etc and nothing worked then someone kindly wrote me a script, see below what they sent. I have saved the script and put it into my USER scripts folder and when I run it in InDesign I get the message:<br /><br />Apple script Error<br />Error Number:  2470<br />Error String: A"/" can't go here.<br /><br />Here is the script that was sent:<br /><br />//Header<br />(function(){<br />//<br />try{<br />    var doc=app.documents[0];<br />    ResetFindPrefs();<br />    app.findTextPreferences.findWhat="^F";<br />    var finds = doc.findText();<br />    for(var i=0;i<finds.length;i++){<br />        var story = finds[i].parentStory<br />        var nextChar =<br />story.characters.item(finds[i].insertionPoints[-1].index);<br />        var contents = nextChar.contents;<br />// if(contents==" "){<br />// nextChar =<br />story.characters.item(nextChar.insertionPoints[-1].index);<br />// contents = nextChar.contents;<br />//~ }<br />        if(contents=="." || contents==","){<br />            nextChar.remove();<br />            finds[i].insertionPoints[0].contents=contents;<br />            }<br />        }<br />    }<br />catch(err){}<br />function ResetFindPrefs(){<br />    app.findTextPreferences = null;ResetFindChangeOptions();<br />    }<br />function ResetFindChangeOptions(){<br />    app.findChangeTextOptions.properties =<br />app.findChangeGrepOptions.properties = {<br />        includeLockedStoriesForFind:false,<br />        includeLockedLayersForFind:false,<br />        includeHiddenLayers:false,<br />        includeMasterPages:false,<br />        includeFootnotes:false,<br />        wholeWord:false,<br />        caseSensitive:false<br />        }<br />    }<br />//Trailer<br />})();<br /><br />Any suggestions I am working on a mac and using Adobe CS3 version 5.0.3<br /><br />Any help would be most appreciated<br /><br />Regards<br /><br />Clint