SUB openurl(s AS STRING)
ht$="http://"
IF LCASE$(LEFT$(s,LEN(ht$)))<>ht$ THEN s=ht$+s
RUN "Explorer "+CHR$(34)+s+CHR$(34)
END SUB
SUB openasfile(s AS STRING)
IF s="" THEN EXIT SUB
IF shellexecute(form.handle,"",s,"","",SW_SHOW) <=32 THEN SHOWMESSAGE(s_filenotfound)
END SUB
SUB dial(s AS STRING)
DIM c AS STRING
CHDIR appdir
IF addphoneprefix THEN PLAYWAV("data\chiffres\0.wav",snd_sync)
FOR i=1 TO LEN(s)
c=MID$(s,i,1)
SELECT CASE c
CASE "0" TO "9"
PLAYWAV("data\chiffres\"+c+".wav",snd_sync)
CASE "*"
PLAYWAV("data\chiffres\etoile.wav",snd_sync)
CASE "#"
PLAYWAV("data\chiffres\diese.wav",snd_sync)
END SELECT
NEXT
END SUB
SUB use(s AS STRING)
DIM c AS STRING, phone AS STRING, thiskey AS STRING
DIM dummy AS INTEGER, toto AS QSTRINGLIST
s=s-CHR$(9)
IF s="" THEN EXIT SUB
IF UsespecialKey<>"" THEN
keylength=LEN(UsespecialKey)
thiskey=LEFT$(s,keylength)
IF LCASE$(thiskey)=LCASE$(UsespecialKey) THEN
s=MID$(s,LEN(UsespecialKey)+1,LEN(s)-LEN(UsespecialKey))
s=UsespecialPrefix+LTRIM$(RTRIM$(s))+UsespecialSuffix
use(s)
EXIT SUB
END IF
END IF
IF INSTR(s,"@")<>0 THEN
toto.clear
toto.additems("start mailto:"+s)
CHDIR appdir
toto.savetofile("data\email.bat")
dummy=SHELL("data\email.bat",0)
ELSEIF (INSTR(s,"http")<>0)OR(INSTR(s,"www")<>0)OR(INSTR(s,".com")<>0)OR(INSTR(s,"//")<>0) _
OR(INSTR(s,".htm")<>0) THEN
openurl(s)
ELSEIF (INSTR(s,"\")<>0)OR(MID$(s,2,1)=":") THEN
openasfile(s)
ELSE
nbchiffres=0:nblettres=0
phone=""
FOR i=1 TO LEN(s)
c=MID$(s,i,1)
IF (c>="0")AND(c<="9") THEN
nbchiffres++
phone=phone+c
ELSEIF c<>" " THEN
nblettres++
END IF
NEXT
IF nbchiffres>=nblettres/2 THEN
dial(phone)
ELSE
openurl(s)
END IF
END IF
END SUB
|