CoolTermn Applescript to send Hex

If you have specific questions or problems with any of my Freeware applications, post them here.
Post Reply
badrabbit
Posts: 2
Joined: Tue Feb 14, 2012 11:15 am

CoolTermn Applescript to send Hex

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

Re: CoolTerm Applescript to send Hex

Post 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
badrabbit
Posts: 2
Joined: Tue Feb 14, 2012 11:15 am

Re: CoolTermn Applescript to send Hex

Post by badrabbit »

Thanks Roger!

Will try that later. Wonderful app you have here!
Post Reply