Re: Evaluating Double Byte
Re: Evaluating Double Byte
- Subject: Re: Evaluating Double Byte
- From: has <email@hidden>
- Date: Tue, 5 Feb 2008 22:42:21 +0000
On 5 Feb 2008, at 21:36, <email@hidden> <email@hidden
> wrote:
> Does anybody know of a means to evaluate a double byte character
> without using the chevron notation i.e.:
>
> «data utxt1603»
Depends what you mean by "double byte character". Hex string?
unichar?
Sounds like you're trying to do code generation of some sort, which
for most problems is the wrong solution anyway. More information
would
be helpful.
Sure, I am using my main application to pull data to be inserted in
a Word Document.
thus pulling dynamic text in insert into preformed applescript code
i.e.
insert text "pulled text from db here" at text object of selection
This works fine until I come across any Japanese, Chinese, ect.
languages, which I can test if they are and then wrap them in code
such as:
insert text "pulled text " & «data utxt1575» as Unicode text & "from
db here" at text object of selection
however, when the NSApplescript event attempts to pass that to
applescript, it seems to not recognize the chevrons. It will
replace them with what looks like a different character.
Sounds like a text encoding issue, though not sure why without seeing
code. At any rate, code generation isn't a good solution here, and the
best thing would be to redesign your program to avoid it in the first
place.
1. If you need to use AppleScript, pack the "pulled text ... here"
string and any other parameters your code needs to pass into an Apple
event and invoke -[NSAppleScript executeAppleEvent:error:]. There's a
sample project - CallAppleScriptHandler - in the objc-appscript
repository (see below) that shows how to do this, or Google around for
other examples.
2. If AppleScript isn't required - and really, the only time you need
to muck about with NSAppleScript is if your program needs to run user-
supplied scripts - then the simplest thing would be to send all your
Word commands directly from ObjC. There are two high-level ObjC-Apple
event bridges available:
- Leopard's Scripting Bridge; the API's obfuscated and klunky, it's
prone to incompatibility problems with various applications, and I
personally wouldn't recommend it, but I mention it anyway for
completeness (and to put the boot in at the same time, natch). See
Apple's developer docs for details.
- objc-appscript; it's still officially alpha-ware, but already quite
usable (it's based on the very mature, capable Python appscript) and
should work on anything from Panther onwards:
http://appscript.sourceforge.net/objc-appscript.html
Any questions, just ask.
HTH
has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden