Can I get the pathname of a file open in a not AS-scriptable application?
Can I get the pathname of a file open in a not AS-scriptable application?
- Subject: Can I get the pathname of a file open in a not AS-scriptable application?
- From: "Fernando O. Raineri" <email@hidden>
- Date: Fri, 09 Mar 2001 20:40:28 -0500
Hello. Would it be possible to obtain, using AS, the name of a file
(or, more conveniently, its full path) when such file is already
open with an application that is not AS-scriptable?
My problem is as follows. I frequently work with numerically-oriented
programs (modules) that I write in Python. For this I use the Python IDE
(which I like very much), as it offers the possibility of running the
Python code directly using the command-R key sequence.
Unfortunately, the Python IDE does not offer a print facility, as far as I
know (of course, I would love to be corrected). So I'm trying to create an
easy-to-trigger printing method for Python modules that are already open
in the Python IDE.
For all I know, the Python IDE (or the Python interpreter) are not
AS-scriptable (no dictionary). I already wrote a working script that
takes care of the Python-formatted printing with the help of Tex-Edit Plus.
But for this script to work I have to type the name of the file that is
already open in the Python IDE. Is there any AS way to get the name of the
file, and so bypass the need of typing?
I usually select and open the Python modules from HyperCard. So it is
certainly possible to store the Python module path at launch time in a
HyperCard field that I can, when needed, read with the AS printing script.
But I wonder, is there a more direct method?
I am aware that Python offers hooks to AS through Apple Events, and these
can be identified with the Lasso Capture AE (the Python recommended way).
But that, sincerely, is all I know at present. Could anybody suggest a
source (more thorough than the AS Language Guide) from which I could learn
how to use Apple Events directly from AS or HyperTalk?
I would very much appreciate any comment or help. Thank you. Fernando