<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hey Folks,<div>I encountered some Problems while using the insert reference Macro from Texshop. After I told the macro to search inside other texfiles for labels too I encountered an applescript error : "Finder got an error. Can't get container of document foo.tex."</div><div><br></div><div>Accourding to <a href="http://www.apfelwiki.de/forum/viewtopic.php?f=6&t=1932&p=6653#p6653">http://www.apfelwiki.de/forum/viewtopic.php?f=6&t=1932&p=6653#p6653</a> I don't seem to be the only one with this Problem.</div><div>I did some research on the topic and found a solution which works for me. </div><div><br></div><div>I you open the Macro editor in texshop and edit the insert Reference Macro in the following way the macro should work again:</div><div>replace the line :"<span class="Apple-style-span" style="font-family: monospace; ">tell application "Finder" to set texfolder to the container of (texloc as alias) -- Get the folder: "path:to:""</span></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px; ">with the following code:</span></font></div><div><font class="Apple-style-span" face="monospace"><dd><code>set oldDelimiters to AppleScript's text item delimiters -- always preserve original delimiters<br>set AppleScript's text item delimiters to {":"}<br>set pathItems to text items of (texloc as text)<br>if last item of pathItems is "" then set pathItems to items 1 thru -2 of pathItems -- its a folder<br>set texfolder to ((reverse of the rest of reverse of pathItems) as string) & ":"<br>set AppleScript's text item delimiters to oldDelimiters -- always restore original delimiters<br></code></dd><dd><br></dd><dd><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px; ">see</span></font> <span class="Apple-style-span" style="font-family: Helvetica; ">ttp://<a href="http://www.apfelwiki.de/forum/viewtopic.php?f=6&t=1932&p=6653#p6653">www.apfelwiki.de/forum/viewtopic.php?f=6&t=1932&p=6653#p6653</a> for details. Hope this works for others too.</span></dd><dd><span class="Apple-style-span" style="font-family: Helvetica; ">Best regards </span></dd><dd><font class="Apple-style-span" face="Helvetica">Max</font></dd></font></div></body></html>