CoolTerm & AppleScript Hex2Str problem

If you have specific questions or problems with any of my Freeware applications, post them here.
Post Reply
tommya
Posts: 1
Joined: Tue Sep 20, 2016 12:28 pm

CoolTerm & AppleScript Hex2Str problem

Post 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.
User avatar
roger
Site Admin
Posts: 431
Joined: Fri Apr 24, 2009 12:41 am
Contact:

Re: CoolTerm & AppleScript Hex2Str problem

Post 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
Post Reply