Page 1 of 1

CoolTerm & AppleScript Hex2Str problem

Posted: Thu Sep 22, 2016 9:59 am
by tommya
This AppleScript:

Code: Select all

set ackb to Hex2Str ("14 EB")
results is this error:

Code: Select all

error "Can’t make some data into the expected type." number -1700
Environment:
CoolTerm 1.4.6
Script editor Version 2.8.1 (183.1)
AppleScript 2.5
OSX 10.11.6 (15G1004)

A similar AppleScript worked fine about 18 months ago, but now returns the same error.
Manually entering the hex digits in the CoolTerm "Send String" window works fine.
A little experiment shows that Hex2Str works for values <= 127 (0x7F) and fails for greater values.
So it appears that something is enforcing a 7 bit limit for characters now.
Is there a way around this?

Thanks, CoolTerm and AppleScript make for a very useful tool.

Re: CoolTerm & AppleScript Hex2Str problem

Posted: Thu Sep 22, 2016 10:27 am
by roger
Hi,

Yes, I'm aware of this issue. It is due to a change Apple has made (I think since OS X Yosemite) where the text encoding of string objects exchange with AppleScript has to be properly defined now. Unless that is the case, ASCII is assumed, which doesn't allow byte values of 0x80 (128) or higher. In your case, the "EB" character is what causes AppleScript to burp on newer OS X releases while older ones work just fine.
I have already implemented a fix for the next release. I will send you information on how to get your hands on the latest beta to try this out.

Roger