Re: boring ole modem stuff
- Posted by Kenneth Rhodes <ken_rhodes30436 at yahoo.com> Feb 02, 2006
- 404 views
Some Slacker wrote: Sorry I can't help you with your real problem, but you can get Syntax Coloring for your code posted to the EuForum. Instructions are at the bottom of the "Send a Message to EUforum" web interface page. Good luck!
--dial.ex Example program --Sample program to dial a pager --Change all 5555555 numbers to real phone numbers before running!!! --delay might need to be changed for different services. this works --for me Use at own risk. Not responsible for any damage caused by this --program --Greg Harris 1997 sequence s, word, pn integer x ,ox, y, RING x=10 ox=x y=0 RING=0 s={} word={} pn={} include serial.e COMPORT=COM3 --Init the modem -- init_ports(38400, W_8BIT, P_NONE, S_1BIT) enable_ports() --Turn on caller ID -- StringToPort("AT+VCID=2",1) delay(3) while get_key()=-1 do --while ox=x do x=GetSerialByte(3) if x != -1 then s=append(s,x) end if if RING=1 then position(3,1) puts(1,"Ringing...\n") pn={} RING=0 end if if length(s)>10 then for i = 1 to length(s)-10 do if s[i]=10 and s[i+1]=13 and s[i+2]=10 and s[i+3]=82 and s[i+4]=73 and s[i+5]=78 and s[i+6]=71 and s[i+7]=13 and s[i+8]=10 and s[i+9]=13 and s[i+10]=10 then RING=1 s=s[i+11..$] end if end for end if if length(s)>9 then for i = 1 to length(s)-9 do if s[i]=13 and s[i+1]=10 and s[i+2]=82 and s[i+3]=73 and s[i+4]=78 and s[i+5]=71 and s[i+6]=13 and s[i+7]=10 and s[i+8]=13 and s[i+9]=10 then RING=1 s=s[i+10..$] end if end for end if if length(s)>7 then for i = 1 to length(s)-7 do if s[i]=13 and s[i+1]=10 and s[i+2]=82 and s[i+3]=73 and s[i+4]=78 and s[i+5]=71 and s[i+6]=13 and s[i+7]=10 then RING=1 s=s[i+8..$] end if end for end if if length(s) >=50 and length(pn)<10 then for i= 18 to 0 by -2 do pn &= s[$-i] end for s={} position(4,1) puts(1,pn) end if position(6,1) ?s end while --Tell pager who called-- --StringToPort("ATDT5555555;",1) --delay(3) --Hang up the modem -- StringToPort("+++ATH0",1) delay(3) --Disable the modem disable_ports() while get_key() = -1 do end while
Ken Rhodes 100% MicroSoft Free SuSE Linux 10.0 No AddWare, SpyWare, or Viruses! Life is Good :)