forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Email program template...

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Dec 28, 2002 8:47 pm    Post subject: Email program template... Reply with quote

Had a couple of requests for this code. It's not finished (and
it's been a while since I worked on it) but I think it will check
your ISP email (NOT dload it) if you fill in the required info.
I think all the controls are set up OK...

NOTE - You'll have to add a comma for a GROUP tooltip for
VDS4 (line 51). I think everything else should be VDS3 and
VDS4 compatible, but an extra comma in a GROUP causes
an error in VDS3.

Anyway, here it is - feel free to modify it as you see fit...
____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Code:

if @not(@file(@path(%0)mail_inbox, D))
   DIRECTORY CREATE, @path(%0)mail_inbox
end
if @not(@file(@path(%0)mail_outbox, D))
   DIRECTORY CREATE, @path(%0)mail_outbox
end
if @not(@file(@path(%0)mail_attach, D))
   DIRECTORY CREATE, @path(%0)mail_attach
end
if @not(@file(@path(%0)mail_inbox, D))@not(@file(@path(%0)mail_outbox, D))@not(@file(@path(%0)mail_attach, D))
   WARN "ERROR - Cannot find/create required folder(s)...."@tab()
   EXIT
end

EXTERNAL VDSIPP.DLL
OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
%%wintitle = "Mac's Email Program"
DIALOG CREATE,%%wintitle,0,0,634,428,RESIZABLE,CLICK
  DIALOG ADD,STYLE,S1,Wingdings,14,C,,BLACK
  DIALOG ADD,STYLE,S2,Webdings,14,C,,BLACK
  DIALOG ADD,STYLE,S2A,Webdings,12,C,,BLACK
  DIALOG ADD,STYLE,S3,MS Sans Serif,8,B
  DIALOG ADD,STYLE,S4,MS Sans Serif,10
  DIALOG ADD,STYLE,S5,Comic Sans MS,7
  DIALOG ADD,STYLE,S6,Small Fonts,7,B
  DIALOG ADD,STYLE,S7,Small Fonts,7,B,,RED
  DIALOG ADD,STYLE,S8,Courier New,8

  DIALOG ADD,BUTTON,Setup,0,0,38,25,@chr(93),,S1
  DIALOG ADD,BUTTON,Help,0,38,38,25,@chr(115),,S2
  DIALOG ADD,BUTTON,Search,0,76,38,25,@chr(36),,S1
  DIALOG ADD,BUTTON,AddrBook,0,114,38,25,@chr(165),,S2

  DIALOG ADD,BUTTON,Compose,0,152,38,25,@chr(43),,S1
  DIALOG ADD,BUTTON,Reply,0,190,38,25,@chr(63),,S1

  DIALOG ADD,BUTTON,Attach,0,228,38,25,@chr(235),,S2
  DIALOG ADD,BUTTON,Send,0,266,38,25,@chr(154),,S2
  DIALOG ADD,BUTTON,Save,0,304,38,25,@chr(60),,S1
  DIALOG ADD,BUTTON,Print,0,342,38,25,@chr(202),,S2
  DIALOG ADD,BUTTON,Delete,0,380,38,25,@chr(114),,S2
  DIALOG ADD,BUTTON,Move,0,418,38,25,@chr(96),,S2

  DIALOG ADD,BUTTON,GoInbox,0,456,38,25,@chr(202),,S1
  DIALOG ADD,BUTTON,GoOutbox,0,494,38,25,@chr(198),,S1
  DIALOG ADD,BUTTON,GoSent,0,532,38,25,@chr(216),,S1
  DIALOG ADD,BUTTON,SendRec,0,570,64,25,@chr(44),,S1

  DIALOG ADD,GROUP,G1,23,-1,636,16,,S2
  DIALOG ADD,TEXT,T1,24,7,,,"Setup     Help    Search  Address  Compose   Reply    Attach    Send      Save      Print    Delete     Move    Inbox    Outbox    Sent    Send/Receive",,S5,TRANSPARENT
  DIALOG ADD,TEXT,T3,39,0,,10,"Atch    To-From                                                             Subject                                                                             Sent-Received",,S6

  rem -- Resized/moved elements ---------------------------------
  DIALOG ADD,LIST,L1,50,0,634,46,,CLICK,DBLCLICK,S8
  DIALOG ADD,BUTTON,Up,97,1,16,10,@chr(53),,S2A
  DIALOG ADD,BUTTON,Down,107,1,16,10,@chr(54),,S2A

  DIALOG ADD,TEXT,T4,96,24,,,"    To"@cr()"From",,S6
  DIALOG ADD,EDIT,E1,97,54,150,20

  DIALOG ADD,TEXT,T5,102,212,,,"Subject",,S6
  DIALOG ADD,EDIT,E2,97,253,180,20

  DIALOG ADD,TEXT,Stat,96,434,,,"INBOX",,S7
  DIALOG ADD,PROGRESS,Progbar,107,434,200,10

  DIALOG ADD,EDIT,E3,118,0,634,280,,,MULTI,SCROLL,S4
  DIALOG ADD,LIST,L2,399,0,634,30,,CLICK
  rem -----------------------------------------------------------
DIALOG SHOW

rem -- Current box being viewed --
%%box = "INBOX"
rem -- Center divide --
%%median = 100

LIST ADD,L1,0    Test1
LIST ADD,L1,0    Test2
LIST ADD,L1,0    Test3
LIST ADD,L1,0    Test4
LIST ADD,L2,Attach1
LIST ADD,L2,Attach2
LIST ADD,L2,Attach3

GOSUB LoadInbox

:CancelMENU
:EVLOOP
  if @not(%%child)
     DIALOG FOCUS, L1
     DIALOG SET, Stat, %%box
  end
  %e = @event()
  WAIT EVENT
  rem -- %e is event, %d is dialog number that issued it (0,1,2,etc.) --
  PARSE "%e;%d", @event(d)
  goto %e

:CLICK
  GOSUB CloseChild
  goto EVLOOP

:RESIZE
  %%width = @diff(@winpos(%%wintitle, W), 8)
  %%height = @winpos(%%wintitle, H)
  DIALOG SETPOS,L1,,,%%width,@diff(%%median, 54)
  DIALOG SETPOS,Up,@diff(%%median, 3)
  DIALOG SETPOS,Down,@sum(%%median, 7)
  DIALOG SETPOS,T4,@diff(%%median, 4)
  DIALOG SETPOS,E1,@diff(%%median, 3)
  DIALOG SETPOS,T5,@sum(%%median, 2)
  DIALOG SETPOS,E2,@diff(%%median, 3)
  DIALOG SETPOS,Stat,@diff(%%median, 4)
  DIALOG SETPOS,Progbar,@sum(%%median, 7)
  DIALOG SETPOS,E3,@sum(%%median, 18),,%%width,@diff(@diff(%%height, 57),@sum(%%median, 18))
  DIALOG SETPOS,L2,@diff(%%height, 56),,%%width
  goto EVLOOP

:UpBUTTON
  if @greater(%%median, 100)
     %%median = @diff(%%median, 100)
  end
  goto RESIZE

:DownBUTTON
  if @greater(@diff(@winpos(%%wintitle, H), %%median), 210)
     %%median = @sum(%%median, 100)
  end
  goto RESIZE

:SetupBUTTON
  GOSUB CloseChild
  GOSUB CreateSetupWindow
  goto EVLOOP
  :SetupOKBUTTON
    %%server = @dlgtext(SetupE1)
    %%user = @dlgtext(SetupE2)
    %%pass = @dlgtext(SetupE3)
  :SetupCancelBUTTON
    GOSUB CloseChild
    goto EVLOOP

:HelpBUTTON
  goto EVLOOP
:SearchBUTTON
  goto EVLOOP
:AddrBookBUTTON
  goto EVLOOP

:ComposeBUTTON
  goto EVLOOP
:ReplyBUTTON
  goto EVLOOP

:AttachBUTTON
  goto EVLOOP
:SaveBUTTON
  goto EVLOOP
:PrintBUTTON
  goto EVLOOP
:DeleteBUTTON
  goto EVLOOP

:MoveBUTTON
  GOSUB CloseChild
  GOSUB CreateMoveWindow
  goto EVLOOP
  :MoveL1CLICK

  :MoveCancelBUTTON
    GOSUB CloseChild
    goto EVLOOP

:SendBUTTON
  INFO Your email has been sent to the OUTBOX folder.@cr()@cr()OUTBOX items are sent to the server by pressing SEND/RECEIVE.@tab()
  goto EVLOOP

:GoInboxBUTTON
  goto EVLOOP
:GoOutboxBUTTON
  goto EVLOOP
:GoSentBUTTON
  goto EVLOOP

rem =================== SEND/RECEIVE ===================================
:SendRecBUTTON
  rem -- CREATE the POP3 client and turn THREAD ON --
  DIALOG SET, Stat, CREATING THREAD...
  INTERNET POP3,CREATE,1
  INTERNET POP3,THREADS,1,ON
  WAIT ".5"

  rem -- Authenticate username/password with POP3 server --
  DIALOG SET, Stat, AUTHENTICATING...
  INTERNET POP3,AUTHENTICATE,1,%%user,%%pass
  WAIT ".5"

  rem -- Connect to the server --
  DIALOG SET, Stat, CONNECTING...
  INTERNET POP3,CONNECT,1,%%server
  rem -- Wait for "POP31ONCONNECT" event, or 10 seconds... --
  WAIT EVENT, 10
  if @not(@equal(@event(), "POP31ONCONNECT"))
     WARN Cannot connect to POP3 server...@tab()
     goto DESTROY
  end     

  rem -- Make sure connection to the server has been made --
  if @equal(@internet(pop3,connected,1),1)
     rem -- return the number of email messages on the server --
     DIALOG SET, Stat, CHECKING MAIL...
     %%msgcount = @internet(pop3,msgcount,1)
     if @greater(%%msgcount, 0)
        %%num = 1
        %m = ""
        REPEAT
          DIALOG SET, Stat, RETRIEVING MAIL %%num...
          INTERNET POP3,GETHEADER,1,%%num
          rem -- Wait for "POP31ONGETHEADERDONE" event, or 3 minutes... --
          WAIT EVENT,180
          if @equal(@event(),"POP31ONGETHEADERDONE")
             %m = %m@cr()@cr()From: @internet(pop3,from,1)@cr()Subject: @internet(pop3,subject,1)@cr()@internet(pop3,msgsize,1,%%num) bytes
             %%num = @succ(%%num)
          else
             %%num = "ERROR"
          end
        UNTIL @greater(%%num, %%msgcount)@equal(%%num, "ERROR")
     end
  else
     WARN Cannot connect to mail server...@tab()
     goto DESTROY
  end

  rem -- Disconnect from the POP3 server --
  INTERNET POP3,DISCONNECT,1
  rem -- Wait for "POP31ONDISCONNECT" event, or 10 seconds... --
  WAIT EVENT, 10
  if @not(@equal(@event(), "POP31ONDISCONNECT"))
     WARN Cannot disconnect from POP3 server...@tab()
  end     

:DESTROY
  INTERNET POP3,DESTROY,1
  if @greater(%%msgcount, 0)
     %t = @datetime(mm-dd-yy  hh:nn am/pm)
     if @file(@path(%0)gotmail.wav)
        PLAY @path(%0)gotmail.wav
     end
     INFO "You have "%%msgcount" email(s)  "%t@tab()@tab()@tab()%m
  else
     INFO You have no new email...@tab()
  end
  goto EVLOOP
rem =================== END SEND/RECEIVE ===============================

:L1CLICK
  goto EVLOOP
:L1DBLCLICK
  DIALOG POPUP,Cancel|Move|View|-|Delete this Email
  %e = @event()
  goto EVLOOP
:L2CLICK
  DIALOG POPUP,Cancel|Virus Scan|View|Save As|-|Delete this Attachment
  %e = @event()
  goto EVLOOP

:CLOSE
  if @greater(%d, 0)
     DIALOG SELECT, %d
     DIALOG CLOSE
     rem -- Kill any extra events -
     %e = @event()
     %%child = ""
     goto EVLOOP
  end
  EXIT

rem -------- SUB --------

:LoadInbox
  if @greater(@count(L1), 0)
     LIST SEEK, L1, @pred(@count(L1))
  end
  exit

:CloseChild
  rem -- Only one child to be open at any time --
  if %%child
     DIALOG SELECT, 1
     DIALOG CLOSE
     %%child = ""
  end
  exit

:CreateSetupWindow
  DIALOG CREATE,"Email Setup",-1,0,235,110,ONTOP
    DIALOG ADD,TEXT,SetupT1,8,22,,,"Server"
    DIALOG ADD,EDIT,SetupE1,5,55,176,19,%%server
    DIALOG ADD,TEXT,SetupT2,33,5,,,"Username"
    DIALOG ADD,EDIT,SetupE2,30,55,176,19,%%user
    DIALOG ADD,TEXT,SetupT3,58,6,,,"Password"
    DIALOG ADD,EDIT,SetupE3,55,55,176,19,%%pass
    DIALOG ADD,BUTTON,SetupOK,80,55,60,25,"OK"
    DIALOG ADD,BUTTON,SetupCancel,80,120,60,25,"Cancel"
  DIALOG SHOW
  %%child = 1
  exit

:CreateMoveWindow
  DIALOG CREATE,"Move To...",-1,0,235,110,ONTOP
    DIALOG ADD,STYLE,MoveS1,MS Sans Serif,10,B
    DIALOG ADD,LIST,MoveL1,5,5,225,65,,MoveS1,CLICK
    DIALOG ADD,BUTTON,MoveCancel,80,90,60,25,"Cancel"
  DIALOG SHOW
  LIST ADD, MoveL1, Inbox
  LIST ADD, MoveL1, Outbox
  %%child = 1
  exit

Cheers, Mac

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Sat Dec 28, 2002 9:02 pm    Post subject: Reply with quote

Nice program. I'll use that. Very Happy
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group