Guidance
指路人
g.yi.org
software / rapidq / Examples / Date & Time / Carnet v2 / use.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'--OPENURL: open as url
     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

'--OPENASFILE
     SUB openasfile(s AS STRING)
      IF s="" THEN EXIT SUB
      IF shellexecute(form.handle,"",s,"","",SW_SHOW) <=32 THEN SHOWMESSAGE(s_filenotfound)
     END SUB

'--DIAL: dial digits
     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

'--USE: use string (mailto, dial or url)
     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) 'remove tabs
      IF s="" THEN EXIT SUB
      IF UsespecialKey<>"" THEN  'Special
       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   'email
       toto.clear
       toto.additems("start mailto:"+s)
       CHDIR appdir
       toto.savetofile("data\email.bat")
       dummy=SHELL("data\email.bat",0)
'    dummy=run("cmd.exe start mailto:"+s)
'    debug(dummy)
    'ReturnCode& = eMail (s+chr$(0), "sujet", "", "")
      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  'if contains \ or if 2nd character is : consider it's a filename
        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 'if more than 1/3 of digits then consider it's a phone number
         dial(phone)
        ELSE
         openurl(s)
        END IF
       END IF
      END SUB
掌柜推荐
 
 
¥860.00 ·
 
 
¥900.00 ·
 
 
¥810.00 ·
 
 
¥317.00 ·
 
 
¥1,370.00 ·
 
 
¥660.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:44:11