[Python-bugs-list] [ python-Bugs-598981 ] Python not handling cText
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 11 Sep 2002 11:38:32 -0700
Bugs item #598981, was opened at 2002-08-22 13:44
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=598981&group_id=5470
Category: Macintosh
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Robin Siebler (robinsiebler)
Assigned to: Jack Jansen (jackjansen)
Summary: Python not handling cText
Initial Comment:
I have the following AppleScript which I have also converted
to Python:
tell application "CodeWarrior IDE"
activate
open file file1
disassemble file file2
set xText to (get text of document 1)
end tell
I had some difficulty converting the last command into
Python, but the below should work (or so I have been told):
import CodeWarrior, time
cw = CodeWarrior.CodeWarrior(start=1)
time.sleep(5)
cw.activate()
cw.open(file1)
cw.disassemble_file(file2)
time.sleep(5)
xtext = app('CodeWarrior IDE').document[1].text
However, instead of the text that I expect, xtext is equal to
'app('CodeWarrior IDE').document[1].text.all'
Bill Fancher looked at CodeWarrior and said that it is
returning cText which is not being handled by Python.
----------------------------------------------------------------------
>Comment By: Robin Siebler (robinsiebler)
Date: 2002-09-11 11:38
Message:
Logged In: YES
user_id=572605
Oops! I forgot to check the stupid (and unneccessary) checkbox.
----------------------------------------------------------------------
Comment By: Robin Siebler (robinsiebler)
Date: 2002-09-11 11:37
Message:
Logged In: YES
user_id=572605
Here is a project, applescript and python script. You will have to
change the paths in the script to wherever you place the project.
Also, there is a bug in the last line of the python script because I
can't remember the exact syntax I had to use to capture the text
from CodeWarrior. Maybe you will have better luck than me.
----------------------------------------------------------------------
Comment By: Robin Siebler (robinsiebler)
Date: 2002-09-11 11:01
Message:
Logged In: YES
user_id=572605
I will create a project and attach it, however, you cannot use
CodeWarrior IDE 4.2.5 because there is are bugs in it that have
to do with AppleEvents. You have to use v 5.0 of the IDE.
----------------------------------------------------------------------
Comment By: Jack Jansen (jackjansen)
Date: 2002-09-11 08:02
Message:
Logged In: YES
user_id=45365
Robin,
you have to give a more complete example. I can get neither the applescript nor the Python program to work. I've filled in valid filenames for file1 and file2, but the Applescript keeps giving the error "CodeWarrior IDE 4.2.5 got an error: Bad name for file. some object".
Could you maybe create a sample soucre file (plus project?) and the real AppleScript you used, and pack it all up?
----------------------------------------------------------------------
Comment By: Robin Siebler (robinsiebler)
Date: 2002-08-22 13:48
Message:
Logged In: YES
user_id=572605
I made a typo:
xtext = app('CodeWarrior IDE').document[1].text
should be:
xtext = cw.get(CodeWarrior.text(CodeWarrior.document(1)))
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=598981&group_id=5470