Greet,
New to development, I seek help with an applescript to access a USB->Serial adapater to allow me to send a simple text string command down the wire to the device on the other end.
I have installed the serialport x applescript extension.
MacSoft
Here is my applescript:
Here is the output:
Nothing happens, the script seems to run and close the port but the command never makes it to the other end (radio). If I use a serialport test program like this one:
http://homepage.mac.com/chen/w7ay/Serial Tools/index.html
everthing works, I connect to the port, and type md1; in the window and the mode changes on the radio. So it seems the only issue is getting applescript to send the serialport write command correctly?
Thanks,
Lee
New to development, I seek help with an applescript to access a USB->Serial adapater to allow me to send a simple text string command down the wire to the device on the other end.
I have installed the serialport x applescript extension.
MacSoft
Here is my applescript:
Code:
--Send a simple mode command to the K3
set the lsb to "md1;"
set thePorts to serialport list
set port_name to choose from list thePorts
try
set usbserial to serialport open port_name bps rate 9600
on error theErr number errNum
if usbserial is -1 then
display dialog "serial port is in use " & usbserial
return "ERROR: " & theErr & " --- " & errNum
end if
end try
serialport write "lsb"
delay 0.25
serialport close usbserial
Here is the output:
Code:
tell application "AppleScript Editor"
serialport list
--> {"/dev/cu.usbserial-A70062jT", "/dev/cu.KeySerial1", "/dev/cu.USA19Hfa22P1.1", "/dev/cu.Bluetooth-PDA-Sync", "/dev/cu.Bluetooth-Modem"}
choose from list {"/dev/cu.usbserial-A70062jT", "/dev/cu.KeySerial1", "/dev/cu.USA19Hfa22P1.1", "/dev/cu.Bluetooth-PDA-Sync", "/dev/cu.Bluetooth-Modem"}
--> {"/dev/cu.KeySerial1"}
serialport open {"/dev/cu.KeySerial1"} bps rate 9600
--> -1
serialport write "lsb"
serialport close -1
end tell
Nothing happens, the script seems to run and close the port but the command never makes it to the other end (radio). If I use a serialport test program like this one:
http://homepage.mac.com/chen/w7ay/Serial Tools/index.html
everthing works, I connect to the port, and type md1; in the window and the mode changes on the radio. So it seems the only issue is getting applescript to send the serialport write command correctly?
Thanks,
Lee