[OS X TeX] Still trying...

Herb Schulz herbs at wideopenwest.com
Wed Apr 7 17:49:08 EDT 2004


On 4/7/04 10:50 AM, "Stefan Walsen" <stefan at walsen.net> wrote:

> Curtis Clifton wrote:
>> On Apr 7, 2004, at 10:14 AM, Herb Schulz wrote:
>>> I'm back to trying to write an Applescript that does a search for the
>>> next
>>> occurrence of a particular character and then select that character
>>> within
>>> TeXShop. I can get the search to work fine but that doesn't select the
>>> character, it returns the character position in the file. Even though
>>> selection is a defined object in the TeXShop Applescript library I get an
>>> error when I try to set its position, length and contents to the required
>>> value. Is it read only?
>> I recall successfully setting the selection in TeXShop via Applescript
>> in the past, but I can't find the code that I used.
> 
> same here :)
> 
> I tried it from scratch ... This works for me:
> 
> --applescript
> tell application "TeXShop"
> try
>    set searchString to "#" -- or whatever you're looking for
>    set searchOffset to (offset of selection of front document) +1
>    search front document starting from searchOffset for searchString
>    set offset of selection of front document to the result -1
>    set length of selection of front document to 1
>  end try
> end tell
> --end of script
> 
> Setting the offset of the search to the current cursor position +1
> prevents the script from finding the same character every time when
> called repeatedly.
> 
> Regards,
> Stefan

Howdy,

I want to thank both Curtis and Stefan for their help; I've now got my
macros running.

Next I will be adapting my CommandCompletion.txt file so that it will put
"tabs" in the commands so you can jump from argument to argument and then to
the end of the environment. Right now I'll use €, the bullet, as the "tab"
marker. Are there any other suggestions or reasons not to use it? Of course
it will be easy to do a Find&Replace in the CommandCompletion.txt file once
it's set up and the Applescripts can easily be adapted to the new character.

Good Luck,

Herb Schulz
(herbs at wideopenwest.com)

-----------------------------------------------------
Please see <http://www.esm.psu.edu/mac-tex/> for list
guidelines, information, and LaTeX/TeX resources.





More information about the MacOSX-TeX mailing list