accueilIl y a quoi dans un Script de Modem?

mise à jour le 25/10/99

C'est beaucoup plus complet et perfectionné que je le supposais. Exemple : c'est lui qui gère l'affichage de la vitesse du modem et de la phrase "Connexion à une vitesse inconnue."

Apple Internal Modem 56k

	Author:	OIivier Mardinian (based on Kris Kreutzman's and Apple/GV V.90 Scripts)
	Copyright:	(c) 1991-1998 Apple Computer, Inc.	All Rights Reserved.
	revision history:
		v1.0	6/22/98		Designed for the iMac, Wallstreet and PDQ 
'mlts' resource info for this modem:
  byte 1 == 01 -> modem HAS built-in error correction protocols
  byte 2 == 01 -> modem HAS built-in data compression protocols
  byte 3 == 40 -> max number of chars in varstr 7
  byte 4 == 40 -> max number of chars in varstr 8
  byte 5 == 40 -> max number of chars in varstr 9
@ORIGINATE
@ANSWER
 
 ---- Initial modem setup ----
 
In originate mode, set serial port speed depending upon the compression flag
- A higher rate with compression on (PPP) to handle expanded data from the modem
- A lower rate closer to the DCE when compression is off (ARA)
ifstr 5 1 "0"
serreset 115200, 0, 8, 1
jump 2
@LABEL 1
serreset 57600, 0, 8, 1
@LABEL 2
hsreset 0 0 0 0 0 0
settries 0
 
Get the modem's attention
matchclr
matchstr 1 3 "OK\13\10"
write "AT\13"
matchread 60
pause 90
 
@LABEL 3
matchclr
matchstr 1 4   "OK\13\10"
matchstr 2 101 "ERROR\13\10"
write "AT&FE0W1Q0V1X4&C1&K3S95=1&D3S7=75S0=0\13"
write "AT&FE0Q0V1X4&C1&K3S95=1S7=75S0=0\13"			(modified on 8/31/98)
write "AT&FE0W2S95=45S0=0&D3S7=60\13"					(ooooo Original GV script)
matchread 90
inctries
iftries 3 101
 
Reset the Modem on setup failure
 
DTRClear
pause 5
DTRSet
flush
pause 90
jump 3
 
@LABEL 4
 
Modem now responding and configured for full EC/DC functions.
 
Varstring 4 , reliable link protocol:
  = 0, handled by computer (ARAP)
  = 1, handled by modem (PPP)
  = 2, MNP10 protocol (Cellular protocol, no longer supported)
 
If PPP or Cellular mode, jump to 5, otherwise (ARA) disable EC/DC.
 
ifstr 4 5 "1"
ifstr 4 5 "2"
 
Varstring 4 == 0, turn off reliable link protocol in modem (ARAP)
 
matchclr
matchstr 1 9 "OK\13\10"
write "AT\\N0\13"
matchread 30
jump 101
 
@LABEL 5
 
This is where MNP10 (or MNP10EC) could go, if/when we support that.
 
Standard EC/DC is still on.  Decide whether to turn off DC.
Varstring 5, compression protocol:
  = 0, handled by computer 
  = 1, handled by modem
 
ifstr 5 9 "1"
Varstring 5 == 0, turn off compression protocol in modem.
matchclr
matchstr 1 9 "OK\13\10"
write "AT%C0\13"
matchread 30
jump 101
 
@LABEL 9
If speaker on flag is true, jump to 13.  Otherwise, turn the speaker off.
Varstring 2, modem speaker:
  = 0, speaker off
  = 1, speaker on
ifstr 2 13 "1"
pause 5
matchclr
matchstr 1 13 "OK\13\10"
write "ATM0\13"
matchread 30
jump 101
Modem ready, wait for a call or originate a call
 
@LABEL 13
 
ifANSWER 32
 
---- Originating a call ----
 
For normal dialing, jump to 19.  Otherwise, manual dial jumps to 15, blind dial jumps to 17.
 
Varstring 6, dialing mode:
  = 0, normal dialing
  = 1, blind dialing
  = 2, manual dialing
ifstr 6 17 "1"
ifstr 6 15 "2"
jump 19
 
@LABEL 15
! 
! Display ASK dialog with message.  Goto label 107 if dialog canceled.
! 
ASK 2 "Décrochez le téléphone et composez le ^1. À la première sonnerie, cliquez sur "OK" puis raccrochez." 107
note "Composition manuelle en cours" 3
! 
! X1S6=4 to ignore dialtone 4 seconds, & ignore busy, D to dial, \^ generates data tone
!write "ATX1D\^\13"							(ooooo Original Wallstreet script)
write "ATX1S6=4D\13"
jump 32
!
@LABEL 17
note "Composition sans tonalité" 3
matchclr
matchstr 1 19 "OK\13\10"
! X1S6=4 to ignore dialtone 4 seconds, & ignore busy for blind dialing.
!write "ATX1\13"							(ooooo Original Wallstreet script)
write "ATX1S6=4\13"
matchread 30
jump 101
!
!
@LABEL 19
! 
! This is where we break up long dialstrings
! 
! Display the full dialstring contained in Varstring 1
note "Composition du ^1" 3
!
! Varstrings 7, 8 and 9, contain dialstring fragments
  Long phone numbers may have been split into smaller groups
  so that the modem can use them
! Check to see whether these fragments exist.  If they do, dial them one at a time.
! If not, jump ahead and dial the remaining phone number.  Use the data tone.
! 
! Varstring 3:  "p" for pulse & "t" for tone dialing
! Varstring 8 == blank (dialstring in varstring 7)
! Varstring 9 == blank (dialstring in varstrings 7 & 8)
! Otherwise (dialstring in varstrings 7, 8 & 9)
! \^ is added to the dialstring to force the modem to generate a data tone
ifstr 8 27 " "
ifstr 9 24 " "
!
Write dialstring in varstrings 7, 8 & 9
matchclr
matchstr 1 21 "OK\13\10"
write "ATD^3^7;\13"
matchread 400
jump 101
! 
@LABEL 21
matchclr
matchstr 1 22 "OK\13\10"
write "ATD^3^8;\13"
matchread 400
jump 101
! 
@LABEL 22
write "ATD^3^9\13"
jump 32
!
!
@LABEL 24
Write dialstring in varstrings 7 & 8
matchclr
matchstr 1 25 "OK\13\10"
write "ATD^3^7;\13"
matchread 400
jump 101
! 
@LABEL 25
write "ATD^3^8\13"
jump 32
!
@LABEL 27
Write dialstring in varstring 7
write "ATD^3^7\13"
 
  ---- Connection response ----
!
! The following section will parse modem responses of five types:
 1) PROTOCOL: xxx, COMPRESSION: xxx, CONNECT xxx
 2) CONNECT xxx/ARQ/V42
 3) Standard incoming and outgoing call progress messages
 4) FAX/DATA discrimination messages
 5) International DELAYED & BLACKLISTED restrictions.
!
@LABEL 32
matchclr
matchstr  1 88  "RING\13\10"
matchstr  2 102 "NO DIALTONE\13\10"
matchstr  3 103 "NO CARRIER"
matchstr  4 103 "ERROR\13\10"
matchstr  5 104 "BUSY\13\10"
matchstr  6 105 "NO ANSWER\13\10"
matchstr  7 33  "CONNECT "
matchstr  8 32  "CARRIER"
matchstr  9 40  "CONNECT\13\10"
matchstr 10 82  "PROTOCOL: LAP"
matchstr 11 82  "PROTOCOL: MNP"
matchstr 12 82  "PROTOCOL: ALT"
matchstr 13 84  "COMPRESSION: V"
matchstr 14 84  "COMPRESSION: MNP5"
matchstr 15 84  "COMPRESSION: CLASS"
matchstr 16 110  "DELAYED  "
matchstr 17 111  "BLACKLISTED\13\10"
matchread 700
ifANSWER 32
jump 101
!
@LABEL 33
matchclr
 
matchstr  1 39 "2400\13"
matchstr  2 39 "2400/"
matchstr  3 40 "4800\13"
matchstr  4 40 "4800/"
matchstr  5 41 "7200"
matchstr  6 42 "9600"
matchstr  7 43 "12000"
matchstr  8 44 "14400"
matchstr  9 45 "16800"
matchstr 10 46 "19200"
matchstr 11 47 "21600"
matchstr 12 48 "24000"
matchstr 13 49 "26400"
matchstr 14 50 "28800"
matchstr 15 51 "29333"
matchstr 16 52 "30667"
matchstr 17 53 "31200"
matchstr 18 54 "32000"
matchstr 19 55 "33333"
matchstr 20 56 "33600"
matchstr 21 57 "34000"
matchstr 22 58 "34667"
matchstr 23 59 "36000"
matchstr 24 60 "37333"
matchstr 25 61 "38000"
matchstr 26 62 "38667"
matchstr 27 63 "40000"
matchstr 28 64 "41333"
matchstr 29 65 "42000"
matchstr 30 66 "42667"
matchstr 31 67 "44000"
matchstr 32 68 "45333"
matchstr 33 69 "46000"
matchstr 34 70 "46667"
matchstr 35 71 "48000"
matchstr 36 72 "49333"
matchstr 37 73 "50000"
matchstr 38 74 "50667"
matchstr 39 75 "52000"
matchstr 40 76 "53333"
matchstr 41 77 "54000"
matchstr 42 78 "54667"
matchstr 43 79 "56000"
matchread 30
jump 80
!
! -- Connection rates --
! CommunicatingAt informs ARA of the raw modem to modem
! connection speed.
!
@LABEL 39
note "Connexion à 2400 bps." 2
CommunicatingAt 2400
jump 81
!
@LABEL 40
note "Connexion à 4800 bps." 2
CommunicatingAt 4800
jump 81
!
@LABEL 41
note "Connexion à 7200 bps." 2
CommunicatingAt 7200
jump 81
!
@LABEL 42
note "Connexion à 9600 bps." 2
CommunicatingAt 9600
jump 81
!
@LABEL 43
note "Connexion à 12400 bps." 2
CommunicatingAt 12400
jump 81
!
@LABEL 44
note "Connexion à 14400 bps." 2
CommunicatingAt 14400
jump 81
!
@LABEL 45
note "Connexion à 16800 bps." 2
CommunicatingAt 16800
jump 81
!
@LABEL 46
note "Connexion à 19200 bps." 2
CommunicatingAt 19200
jump 81
!
@LABEL 47
note "Connexion à 21600 bps." 2
CommunicatingAt 21600
jump 81
!
@LABEL 48
note "Connexion à 24000 bps." 2
CommunicatingAt 24000
jump 81
!
@LABEL 49
note "Connexion à 26400 bps." 2
CommunicatingAt 26400
jump 81
!
@LABEL 50
note "Connexion à 28800 bps." 2
CommunicatingAt 28800
jump 81
!
@LABEL 51
note "Connexion à 29333 bps." 2
CommunicatingAt 29333
jump 81
!
@LABEL 52
note "Connexion à 30667 bps." 2
CommunicatingAt 30667
jump 81
!
@LABEL 53
note "Connexion à 31200 bps." 2
CommunicatingAt 31200
jump 81
!
@LABEL 54
note "Connexion à 32000 bps." 2
CommunicatingAt 32000
jump 81
!
@LABEL 55
note "Connexion à 33333 bps." 2
CommunicatingAt 33333
jump 81
!
@LABEL 56
note "Connexion à 33600 bps." 2
CommunicatingAt 33600
jump 81
!
@LABEL 57
note "Connexion à 34000 bps." 2
CommunicatingAt 34000
jump 81
!
@LABEL 58
note "Connexion à 34667 bps." 2
CommunicatingAt 34667
jump 81
!
@LABEL 59
note "Connexion à 36000 bps." 2
CommunicatingAt 36000
jump 81
!
@LABEL 60
note "Connexion à 37333 bps." 2
CommunicatingAt 37333
jump 81
!
@LABEL 61
note "Connexion à 38000 bps." 2
CommunicatingAt 38000
jump 81
!
@LABEL 62
note "Connexion à 38667 bps." 2
CommunicatingAt 38667
jump 81
!
@LABEL 63
note "Connexion à 40000 bps." 2
CommunicatingAt 40000
jump 81
!
@LABEL 64
note "Connexion à 41333 bps." 2
CommunicatingAt 41333
jump 81
!
@LABEL 65
note "Connexion à 42000 bps." 2
CommunicatingAt 42000
jump 81
!
@LABEL 66
note "Connexion à 42667 bps." 2
CommunicatingAt 42667
jump 81
!
@LABEL 67
note "Connexion à 44000 bps." 2
CommunicatingAt 44000
jump 81
!
@LABEL 68
note "Connexion à 45333 bps." 2
CommunicatingAt 45333
jump 81
!
@LABEL 69
note "Connexion à 46000 bps." 2
CommunicatingAt 46000
jump 81
!
@LABEL 70
note "Connexion à 46667 bps." 2
CommunicatingAt 46667
jump 81
!
@LABEL 71
note "Connexion à 48000 bps." 2
CommunicatingAt 48000
jump 81
!
@LABEL 72
note "Connexion à 49333 bps." 2
CommunicatingAt 49333
jump 81
!
@LABEL 73
note "Connexion à 50000 bps." 2
CommunicatingAt 50000
jump 81
!
@LABEL 74
note "Connexion à 50667 bps." 2
CommunicatingAt 50667
jump 81
!
@LABEL 75
note "Connexion à 52000 bps." 2
CommunicatingAt 52000
jump 81
!
@LABEL 76
note "Connexion à 53333 bps." 2
CommunicatingAt 53333
jump 81
!
@LABEL 77
note "Connexion à 54000 bps." 2
CommunicatingAt 54000
jump 81
!
@LABEL 78
no