I am trying to send an ascii command to a stepper motor using the applescript ‘compatible’ software “SerialPort X”. Am quite new to MacScripter and AppleScript. In the past I used Z-Term or Cool-Term to drive the stepper motor, but now I want to use AppleScript so I can control two applications. I believe I am connecting with the device, but my attempts to send a command have failed. Following is my simple AppleScript at this point:
[«event SPA_oSPA» "/dev/cu.usbserial-A400fkbg"
"bps rate 9600"
"data bits 8"
"parity 0"
"stop bits 1"
"handshake 1"
«event SPA_wSPA» "/2D1280R^M"
"to 1"
"for 10"
«event SPA_cSPA» 1]
The command line is a typical one. With the ^M, it works in Z-Term. Without the ^M, the command works in Cool-Term if the Enter Key Emulation is set to CR+LF (I have no idea what this means!).
I have searched the FAQ and used the search functions of MacScripter, but gotten nowhere. Have found a number of AppleScript references that might be applicable to my situation, but my attempts to implement them have failed.
The above cut/paste looks different from how the AppleScript appears in my Script editor, in that, e.g. «event SPA_oSPA» appears as “serialport open” which is part of the Serialport X ‘dictionary’. Has anyone used Serialport X with a USBGear adapter? Can anyone suggest the proper format for the command line?
Thanks in advance! MRA
Model: iMac
AppleScript: 1.10.7
Browser: Safari 528.16) Version/5.10.3 OmniWeb/622.14.0
Operating System: Mac OS X (10.4)