Page 1 of 1
CoolTermn Applescript to send Hex
Posted: Wed Feb 15, 2012 3:08 am
by badrabbit
I'm trying to send a Hex string via Applescript but it doesn't work...
Code: Select all
tell application "CoolTerm"
Write {"21890149533344330A"}
end tell
It's not as easy as that, right?
Maybe someone can help? Thanks.
hubert
Re: CoolTerm Applescript to send Hex
Posted: Wed Feb 15, 2012 8:40 pm
by roger
It's pretty easy, but not THAT easy
I suggest you take a look at the examples that come with the latest version of CoolTerm and check out the "AppleScript ReadMe.txt" file.
Here is an example of how to send your data
Code: Select all
tell application "CoolTerm"
# Setting up local variables
local w
local d
# Assigning the name of the CoolTerm window to w
set w to "CoolTerm_0"
# Open the serial port
if Connect w then
# Generate Data from a hex string
set d to Hex2Str ("21 89 01 49 53 33 44 33 0A")
# Send the data
Write {w, d}
else
display alert ("Not Connected")
end if
# Close the port
Disconnect w
end tell
Re: CoolTermn Applescript to send Hex
Posted: Thu Feb 16, 2012 12:53 am
by badrabbit
Thanks Roger!
Will try that later. Wonderful app you have here!