O p t i o n   E x p l i c i t 
 
 
 
 s u b   H a n d l e T h i n C l i e n t R e q u e s t 
 
 D i m   D a t a 
 
 D i m   S e s s i o n 
 
 D i m   I P 
 
 D i m   A c t i o n 
 
 D i m   C l i e n t 
 
 D i m   U s e r A g e n t 
 
 D i m   M e s s a g e 
 
 D i m   R e p o r t 
 
     I f   R S c r . G e t C u r r e n t S c r i p t D a t a E x ( D a t a )   T h e n 
 
         S e s s i o n   =   D a t a . S t r P a r 1 
 
         I P   =   D a t a . S t r P a r 2 
 
         U s e r A g e n t   =   D a t a . S t r P a r 6 
 
         A c t i o n   =   " " 
 
         S e l e c t   C a s e   D a t a . I n t P a r 1 
 
             C a s e   0 
 
                 A c t i o n   =   " D i s c o n n e c t   ( E x p i r e d   S e s s i o n ) " 
 
             C a s e   1 
 
                 A c t i o n   =   " C o n n e c t " 
 
                 R T a g . I n c T a g V a l u e   " S y s t e m " ,   " T h i n C l i e n t C o u n t " ,   1 
 
             C a s e   2 
 
                 A c t i o n   =   " D i s c o n n e c t " 
 
             C a s e   3 
 
                 A c t i o n   =   " U s e r   L o g o n " 
 
             C a s e   4 
 
                 A c t i o n   =   " U s e r   L o g o u t " 
 
         E n d   S e l e c t 
 
         C l i e n t   =   " " 
 
         S e l e c t   C a s e   D a t a . I n t P a r 2 
 
             C a s e   0 
 
                 C l i e n t   =   " W e b   C l i e n t " 
 
             C a s e   1 
 
                 C l i e n t   =   " M o b i l e   C l i e n t " 
 
             C a s e   2 
 
                 C l i e n t   =   " S m a r t   C l i e n t " 
 
         E n d   S e l e c t 
 
         M e s s a g e   =   " > > >   "   &   C S t r ( D a t e )   &   "   "   &   C S t r ( T i m e )   &   " ,   "   &   C l i e n t   &   " :   "   &   A c t i o n   &   "   h t t p : / / w h a t i s m y i p a d d r e s s . c o m / i p / "   &   I P 
 
         i f   D a t a . I n t P a r 2   =   2   t h e n 
 
             M e s s a g e   =   M e s s a g e   &   "   ( "   &   U s e r A g e n t   &   " ) " 
 
         e n d   i f 
 
         M e s s a g e   =   M e s s a g e   &   " ,   "   &   S e s s i o n 
 
         R e p o r t   =   R T a g . G e t T a g V a l u e ( " S y s t e m " ,   " T h i n C l i e n t R e p o r t " ) 
 
         R e p o r t   =   R e p o r t   &   M e s s a g e   &   v b C r L f 
 
         R T a g . S e t T a g V a l u e   " S y s t e m " ,   " T h i n C l i e n t R e p o r t " ,   R e p o r t 
 
     E n d   I f 
 
 e n d   s u b 
 
 
 
 s u b   S i m u l a t e H u m i d i t y 
 
 D i m   H u m i d i t y ,   H u m i d I f y ,   C o o l i n g ,   C o e f f i c i e n t 
 
     H u m i d i t y   =   R T a g . G e t T a g V a l u e ( " S y s t e m " ,   " H u m i d i t y " ) 
 
     I f   R T a g . G e t T a g V a l u e ( " S y s t e m " ,   " D a m p e r " )   T h e n   H u m i d I f y   =   1   E l s e   H u m i d I f y   =   0 
 
     H u m i d I f y     =   H u m i d I f y   *   1 0 0 
 
     C o o l i n g   =   R T a g . G e t T a g V a l u e ( " S y s t e m " ,   " C o o l e r " )   *   - 1 
 
 
 
     C o e f f i c i e n t   =   ( H u m i d I f y   +   C o o l i n g )   /   1 0 0 
 
 
 
     I f   H u m i d i t y   >   7 0   T h e n 
 
         H u m i d i t y   =   7 0 
 
         R T a g . S e t T a g V a l u e   " S y s t e m " ,   " D a m p e r " ,   F a l s e 
 
         R T a g . S e t T a g V a l u e   " S y s t e m " ,   " C o o l e r " ,   5 0 
 
     E n d   I f 
 
 
 
     I f   H u m i d i t y   <   3 5   T h e n 
 
         H u m i d i t y   =   3 5 
 
         R T a g . S e t T a g V a l u e   " S y s t e m " ,   " D a m p e r " ,   T r u e 
 
         R T a g . S e t T a g V a l u e   " S y s t e m " ,   " C o o l e r " ,   0 
 
     E n d   I f 
 
 
 
     H u m i d i t y   =   H u m i d i t y   +   C o e f f i c i e n t 
 
     R T a g . S e t T a g V a l u e   " S y s t e m " ,   " H u m i d i t y " ,   H u m i d i t y 
 
 e n d   s u b 
 
 
 
 s u b   S i m u l a t e T e m p e r a t u r e 
 
 D i m   T e m p e r a t u r e ,   C o o l i n g ,   H e a t i n g ,   C o e f f i c i e n t 
 
     T e m p e r a t u r e   =   R T a g . G e t T a g V a l u e ( " S y s t e m " ,   " T e m p e r a t u r e " ) 
 
 
 
     C o o l i n g   =   R T a g . G e t T a g V a l u e ( " S y s t e m " ,   " C o o l e r " )   *   - 1 
 
     H e a t i n g   =   R T a g . G e t T a g V a l u e ( " S y s t e m " ,   " H e a t e r " ) 
 
 
 
     C o e f f i c i e n t   =   ( ( C o o l i n g   +   H e a t i n g )   /   1 0 0 )   *   0 . 1 
 
 
 
     T e m p e r a t u r e   =   T e m p e r a t u r e   +   C o e f f i c i e n t 
 
     I f   T e m p e r a t u r e   >   2 8   T h e n   T e m p e r a t u r e   =   2 8 
 
 
 
     I f   ( T e m p e r a t u r e   >   1 8 )   A n d   ( C o e f f i c i e n t   =   0 )   A n d   ( H e a t i n g   =   0 )   T h e n   T e m p e r a t u r e   =   T e m p e r a t u r e   -   0 . 1 
 
     I f   ( T e m p e r a t u r e   <   1 8 )   A n d   ( C o e f f i c i e n t   =   0 )   A n d   ( H e a t i n g   =   0 )   T h e n   T e m p e r a t u r e   =   T e m p e r a t u r e   +   0 . 1 
 
     I f   ( T e m p e r a t u r e   <   1 5 )   A n d   ( C o e f f i c i e n t   <   0 )   T h e n   T e m p e r a t u r e   =   1 5 
 
 
 
 
 
     R T a g . S e t T a g V a l u e   " S y s t e m " ,   " T e m p e r a t u r e " ,   T e m p e r a t u r e 
 
 e n d   s u b 
 
 
 
 s u b   S i m u l a t e V e n t i l a t i o n 
 
 D i m   H e a t i n g ,   C o o l i n g 
 
     H e a t i n g   =   0 
 
     C o o l i n g   =   0 
 
     I f   R T a g . G e t T a g V a l u e ( " S y s t e m " ,   " F a n I n _ C m d " )   T h e n 
 
         I f   R T a g . G e t T a g V a l u e ( " S y s t e m " ,   " H e a t e r " )   >   0   T h e n 
 
             H e a t i n g   =   1 
 
         E n d   I f 
 
         I f   R T a g . G e t T a g V a l u e ( " S y s t e m " ,   " H e a t e r " )   < =   0   T h e n 
 
             C o o l i n g   =   1 
 
         E n d   I f 
 
     E n d   I f 
 
 
 
     R T a g . S e t T a g V a l u e   " S y s t e m " ,   " C o o l i n g " ,   C o o l i n g 
 
     R T a g . S e t T a g V a l u e   " S y s t e m " ,   " H e a t i n g " ,   H e a t i n g 
 
 e n d   s u b 
 
 
 
 s u b   S e n d T h i n C l i e n t R e p o r t 
 
 D i m   F i l e N a m e 
 
 D i m   D a t a 
 
 D i m   F S O 
 
 D i m   F i l e O b j e c t 
 
 D i m   E M a i l A d d r e s s 
 
 D i m   C o u n t 
 
 D i m   S u b j e c t 
 
 D i m   T e x t 
 
     F i l e N a m e   =   R S y s . G e t P r o j e c t D i r   +   " R e c i p i e n t s . t x t " 
 
     I f   R S y s . F i l e E x i s t s ( F i l e N a m e )   T h e n 
 
         S e t   F S O   =   C r e a t e O b j e c t ( " S c r i p t i n g . F i l e S y s t e m O b j e c t " ) 
 
         S e t   F i l e O b j e c t   =   F S O . O p e n T e x t F i l e ( F i l e N a m e ,   1 ,   F a l s e ) 
 
         E M a i l A d d r e s s   =   F i l e O b j e c t . R e a d L i n e 
 
         F i l e O b j e c t . C l o s e 
 
         S e t   F i l e O b j e c t   =   N o t h i n g 
 
         S e t   F S O   =     N o t h i n g 
 
         C o u n t   =   R T a g . G e t T a g V a l u e ( " S y s t e m " ,   " T h i n C l i e n t C o u n t " ) 
 
         S u b j e c t   =   " A i r C o n d i t i o n :   "   &   C S t r ( C o u n t )   &   "   s e s s i o n s " 
 
         T e x t   =   R T a g . G e t T a g V a l u e ( " S y s t e m " ,   " T h i n C l i e n t R e p o r t " ) 
 
         R I n e t . S e n d M a i l   E M a i l A d d r e s s ,   S u b j e c t ,   T e x t ,   " " 
 
     E n d   I f 
 
     R T a g . S e t T a g V a l u e   " S y s t e m " ,   " T h i n C l i e n t C o u n t " ,   0 
 
     R T a g . S e t T a g V a l u e   " S y s t e m " ,   " T h i n C l i e n t R e p o r t " ,   " " 
 
 e n d   s u b 
 
 
 
 