[OS X TeX] decimal numbers in Applescript

Frank STENGEL fstengel at mac.com
Tue Nov 30 20:16:02 CET 2004


Le 30 nov. 04, à 17:57, Claus Gerhardt a écrit :

> My efforts of writing a little Applescript application that can rival 
> Textures flash mode - in conjunction with an excellent pdf viewer like 
> TeXniscope - have been successful. The script checks the file in 
> question in a regular interval, the default is 0.5 sec, which is fine 
> on my machine, but might be a little bit too fast on others. 
> Therefore, this parameter should be user adjustable by entering a 
> different value in a preference file.
>
> My guess now is that I don't have to worry about the particular number 
> format. If the user enters the number, or the decimal number, 
> according to his system formats, then the Applescript application will 
> understand it, even if it has been created on a system using different 
> formats.
>
> Could someone, more knowledgeable than me, please confirm or deny.

This snippet

<script>
set temp to display dialog "Give a number" default answer ""
set temp to text returned of temp
try
	set x to temp as number
	display dialog "I got the number " & x buttons {"OK"}
on error
	display dialog "I wanted a number and got " & temp & "!" buttons {"OK"}
end try
</script>

works in various language settings... I basically compiled it and tried 
it with two users I had create for the test: one in US Engilsh 
(language, formats and key board) and one in German (tried as well with 
my usual system in French)

I hope this helps...
-- 
Frank STENGEL (stengelf<at>menara.ma)
               (fstengel<at>mac.com)
               (fstengel<at>nordnet.fr)

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list