I’ve spent about the last 15hours (no joke) looking for related to my issue but to no avail so here i am
I’ve a lil arduino project which involves an arduino applet executing an applescript command. the arduino code has IR sensors that prints somethings when the distance is less than 30. the aim is skip to the track in iTunes when the IR sensor distance is less than 30. my applescript is as follows
#set use_port to item 1 of (get serialport list)
#set myPort to serialport open use_port bps rate 9600 data bits 8 parity 0 stop bits 1 handshake 0
#serialport read 9600
global portRef
on run
set portRef to serialport open "/dev/tty.usbmodem411" bps rate 9600 data bits 8 parity 0 stop bits 1 handshake 0
tell application "iTunes"
activate
if player state is not stopped then
tell application "System Events" to key code 124 using command down
end if
end tell
end run
#serialport close
as you can see i’ve been playing around the applescript so it might not make sense with the commented code.
behold, nothing happens, each code works on its own but they’re not linked together. i’ve looked for ASProxy by Banzi but it doesn’t exist anymore. I tried SerialPortX but i’m not sure if i’m doing it right. i think there might be something wrong with the serial communication and that’s what i’m not certain. I’m pretty new when it comes to arduino let alone applescript but i’m eager to learn so please go easy on me. i’m the noobest of all noobs
Any thoughts on where i’ve gone wrong or is there anything i’ve missed? Your help would be greatly appreciated.