I know that I am not able to dial, I just want to write and read text messages with it - writing sms is easy, and receiving also, but I want to have the received messages in a loop - so every text message on the simcard will be presenting in a text field…
if dial is equal to -1 then
display dialog " could not open port "
else
set xstr to "at+cmgf=1" & return
serialport write xstr to dial
delay 1
set theNumber to 0
repeat until read_numb does not contain "+"
set xstr to "at+cmgr=" & theNumber & return
serialport write xstr to dial
delay 1
(*
set xstr to "at+cnmi=2,1,0,0,1" & return
serialport write xstr to dial
delay 2
*)
set theNumber to theNumber + 1
set read_numb to serialport read dial
end repeat
end if
serialport close dial
set contents of text view "text" of scroll view "text" of window id 1 to read_numb
This is not working, but it shouldn´t be so different from that…
if dial is equal to -1 then
display dialog " could not open port "
else
set xstr to "at+cmgf=1" & return
serialport write xstr to dial
delay 1
set xstr to "at+cnmi=2,1,0,0,1" & return
serialport write xstr to dial
delay 1
set read_numb1 to serialport read dial
set theNumber to 0
repeat with i from 0 to 20
set xstr to "at+cmgr=" & theNumber & return
serialport write xstr to dial
delay 1
set theNumber to theNumber + 1
set read_numb to serialport read dial
set contents of text view "text" of scroll view "text" of window id 1 to read_numb
end repeat
end if
serialport close dial
This is a loop from 0 to 20 presenting the output every second! The thing I know need is how to store the output in a variable which can not be overwritten and how to present the variable one after the other…
Background: this loop is presenting text messages of cell phones using osax serialport x!