Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Applescript > Re: 10.5 change...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 4 Topic 1548 of 1643
Post > Topic >>

Re: 10.5 change to unicode text causes AppleWorks problems

by has <has.temp3@[EMAIL PROTECTED] > Dec 18, 2007 at 03:03 PM

On 18 Dec, 17:42, Simon Slavin
<slavins.delete.these.four.wo...@[EMAIL PROTECTED]
> wrote:
> I have a longstanding AppleScript Studio tool which uses AppleScript
> Studio to draw a drawing in AppleWorks, then save the results as a .png
or
> .pict file.  It did this using a line like the following
> -- ...
> -- code to tell AppleWorks 6 to open a Drawing do***ent and put
something in
> -- ...
> -- ...
> set theTranslator to "PNG [QT]"
> tell application "AppleWorks 6"
>     save the front do***ent in fileAlias using translator theTranslator
> end tell
>
> This code no longer works under Leopard, yielding the following error
message:
>
>         AppleWorks 6 got an error: do***ent 1 doesn't
>         understand the save message. (-1708)
>
> .  My theory is this: the text "PNG [QT]", which used to be 8-bit text,
is now unicode text.  The value being passed is thus scrambled by the time
it gets to AppleWorks (which is still Carbon, not Cocoa).

Not scrambled; however, there are some not-so-well-designed
applications that will require a parameter to be of a specific type
and will throw an error if given anything else. (The correct approach
is to specify the desired type when asking the Apple Event Manager for
a parameter; the AEM will then coerce the supplied value as
necessary.)

If your guess is correct, the only AppleScript-based solution I can
suggest is to write the "PNG [QT]" string literal in raw form:

<<data TEXT504E47205B51545D>>

Bear in mind that this only works for literals; if your text comes
from any other source then you're stuffed in AppleScript AFAIK, and
your only other option would be to use appscript, which allows you to
customise this stuff as needed, or roll your own low-level code in C/
ObjC.

As for eventually replacing AppleWorks there's no shortage of options
available to you, including Cocoa itself (although the relevant APIs
aren't directly bridged in Studio). Depends what you want to do and
where you're willng to go. e.g. If you want to stick with AppleScript,
there's various options such as Smile and Illustrator. Or you might
consider this an op****tunity for broadening your toolkit by picking up
another language; e.g. Python and Ruby both have excellent application
scripting and Cocoa sup****t along with scads of libraries of their
own, while ObjC is well worth learning if you do a lot of Cocoa-based
application development.

HTH

has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
 




 4 Posts in Topic:
10.5 change to unicode text causes AppleWorks problems
Simon Slavin <slavins.  2007-12-18 17:42:04 
Re: 10.5 change to unicode text causes AppleWorks problems
has <has.temp3@[EMAIL   2007-12-18 15:03:37 
Re: 10.5 change to unicode text causes AppleWorks problems
Simon Slavin <slavins.  2007-12-19 11:44:35 
Re: 10.5 change to unicode text causes AppleWorks problems
John Rethorst <nobody@  2007-12-18 19:07:00 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 13:36:02 CDT 2008.