Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


sendin email

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,45644
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> sendin email
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1] 2   next >   >>
Login
Message << Older Topic   Newer Topic >>
 sendin email - 4/10/2007 2:15:32 AM   
  tell

 

Posts: 14
Score: 0
Joined: 4/10/2007
Status: offline
Hello everybody,

I try to write a script for sending emails....

when I specify the body of the email:   objEmail.Textbody = ...   we need to put a String.... this is my problem,  how do you do if you want to send a 2 dimension array ?  (as a summary)...

thanks very much ...
 
 
Post #: 1
 
 RE: sendin email - 4/10/2007 2:18:26 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
You will need to write a routine to change the array from an array into a formatted string.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to tell)
 
 
Post #: 2
 
 RE: sendin email - 4/10/2007 2:23:35 AM   
  tell

 

Posts: 14
Score: 0
Joined: 4/10/2007
Status: offline
Firstly thanks for the quick answer...;-)

but... do you have an example.. ? I tried it all this morning.. with no results .. I think that i really miss something....
and more important.. am i going to loose the alignement of the data ? (which is the aim to use a 2-dimension array...)

< Message edited by tell -- 4/10/2007 2:31:31 AM >

(in reply to tell)
 
 
Post #: 3
 
 RE: sendin email - 4/10/2007 2:31:32 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
Could you post an example of what the array consists of and what you would like the output to look like?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to tell)
 
 
Post #: 4
 
 RE: sendin email - 4/10/2007 2:35:09 AM   
  tell

 

Posts: 14
Score: 0
Joined: 4/10/2007
Status: offline
The result that I would like ... (with the alignment of a 2-dimension array, which is my aim ..... in this exemple I did manually :-(     )


Name:      Drive:    Size:        Free:         Free: (%)       Status:
=========================================================================
FREY        C:        33.84          1.61          5                   Healthy


the array just consists of 6 columns and X rows generate in function of the number of disks of my computer ......

(in reply to ebgreen)
 
 
Post #: 5
 
 RE: sendin email - 4/10/2007 2:37:51 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
Ok, so your array is (x, 5) dimensions. The first step is to figure out how to iterate through each element in the array. Have you figured that out yet?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to tell)
 
 
Post #: 6
 
 RE: sendin email - 4/10/2007 2:51:11 AM   
  tell

 

Posts: 14
Score: 0
Joined: 4/10/2007
Status: offline
For the iteration i think it's quiet ok ..

For Each objItem in colItems
             
  strMessage = strMessage & strLine & vbCrLf & strComputer & vbTab & vbTab & _         etc.......
Next

for the moment i constructed my string like that,i'll add a counter and it s ok ............. but i left the alignemnt in result.

i think that i have to build a dynamic array:

Dim DArray()

But after i had problems creating a dynamic array......

After how do you do your routine?  to convert your perfect 2-dimension array to a String ?


(in reply to ebgreen)
 
 
Post #: 7
 
 RE: sendin email - 4/10/2007 2:55:15 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
I think you will need to post more if not all of your code. I need to know how the array is constructed.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to tell)
 
 
Post #: 8
 
 RE: sendin email - 4/10/2007 3:02:29 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
Here is a quick general example of displaying a (2, 2) array:

Option Explicit
Dim arr
Dim arrSub
arr = Array(Array("one", "two", "three"), Array("four", "five", "six"), Array("seven", "eight", "nine"))
For Each arrSub In arr
WScript.Echo Join(arrSub, vbTab & vbTab)
Next

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ebgreen)
 
 
Post #: 9
 
 RE: sendin email - 4/10/2007 3:11:08 AM   
  tell

 

Posts: 14
Score: 0
Joined: 4/10/2007
Status: offline
Here is a part of my script ....  

Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk where DriveType=3",,48)

   Dim DArray()
   Dim numberRows =  colitems.count
   DArray(numberRows,5)
   Dim Counter = 0
   
   For Each objItem in colItems
      
               strStatus = Round(((cDbl(0.5) + cDbl(objItem.FreeSpace)) / CONVERSION_FACTOR), Decimals)
              
               'Verifies whether the disk is running low
               If strStatus < WARNING_THRESHOLD  Then
                   strStatus = strStatusError
                   strLine = "===================================================================================="
               Else
                   strStatus = strStatusOK
                   strLine = "========================================================================="
               End If
                      
   DArray(Counter,1)    = objItem.Name
   'etc.....
  
   'strMessage = strMessage & strLine & vbCrLf & strComputer & vbTab & vbTab & _
   '             objItem.Name & vbTab & vbTab & _
   '             CStr( Round(((cDbl(0.5) + cDbl(objItem.Size)) / CONVERSION_FACTOR), Decimals)) & _
   '             "          " & _
   '             CStr( Round(((cDbl(0.5) + cDbl(objItem.FreeSpace)) / CONVERSION_FACTOR), Decimals)) & _
   '             "          " & _
   '             CStr( Int( 0.5 + ( 100 * objItem.FreeSpace / objItem.Size) ) ) & _
   '             "                   " & _
   '             CStr( strStatus ) & _
   '             vbCrLf
   Counter = Counter + 1
               
   Next


There are several mistakes (obviously it doesnt work)

(in reply to ebgreen)
 
 
Post #: 10
 
 RE: sendin email - 4/10/2007 3:12:57 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
So in your case I think you would be able to modify the generic example that I showed.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to tell)
 
 
Post #: 11
 
 RE: sendin email - 4/10/2007 3:21:11 AM   
  tell

 

Posts: 14
Score: 0
Joined: 4/10/2007
Status: offline
Thanks very much.. ill try your code .. i tell you later or tomorrow thanks again

(in reply to ebgreen)
 
 
Post #: 12
 
 RE: sendin email - 4/10/2007 8:26:13 PM   
  tell

 

Posts: 14
Score: 0
Joined: 4/10/2007
Status: offline
 
Hello again,.. i have a solution but with so many errors, (and unspecified error reports),.. do you have a rough idea about it ? thanks    (in many parts sry)

< Message edited by tell -- 4/10/2007 8:28:07 PM >

(in reply to tell)
 
 
Post #: 13
 
 RE: sendin email - 4/10/2007 8:29:33 PM   
  tell

 

Posts: 14
Score: 0
Joined: 4/10/2007
Status: offline
    strMessage = ""
    Dim DArray()
   
    Dim numberRows
    numberRows = colitems.Count
   
    Dim Counter
    Counter = 0
   
    Redim DArray(numberRows+1,5)
   
    ' the six first static build columns
    DArray = Array(Array("Name:","Drive:","Size:","Free:","Free: (%)","Status:"))

(in reply to tell)
 
 
Post #: 14
 
 RE: sendin email - 4/10/2007 8:30:08 PM   
  tell

 

Posts: 14
Score: 0
Joined: 4/10/2007
Status: offline
For Each objItem in colItems
       
                'build the rest of the array
                DArray(Counter,0) = strComputer
                DArray(Counter,1) = objItem.Name
                DArray(Counter,2) = CStr( Round(((cDbl(0.5) + cDbl(objItem.Size)) / CONVERSION_FACTOR), Decimals))
                'etc....
   
    Counter = Counter + 1
                
    Next

(in reply to tell)
 
 
Post #: 15
 
 RE: sendin email - 4/10/2007 8:30:32 PM   
  tell

 

Posts: 14
Score: 0
Joined: 4/10/2007
Status: offline
    Dim CellArray
    CellArray = 0
    Do While Counter >= 0
   
        strMessage = strMessage & vbTab & DArray(CellArray,0) & vbTab & DArray(CellArray,1) & vbTab  & DArray(CellArray,2) &_
        vbTab & DArray(CellArray,3) & vbTab & DArray(CellArray,4) & vbTab & DArray(CellArray,5) & vbCrLf
        Counter = Counter - 1
        CellArray = CellArray + 1
    Loop

(in reply to tell)
 
 
Post #: 16
 
 RE: sendin email - 4/11/2007 1:16:53 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
What specifically doesn't work?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to tell)
 
 
Post #: 17
 
 RE: sendin email - 4/11/2007 3:27:59 AM   
  tell

 

Posts: 14
Score: 0
Joined: 4/10/2007
Status: offline
I dont know.. i have a "unspecied error" thats my problem......

but is the "spelling" of my code correct ?  do you do like that ? (the fill the array and to build the string ?)

(in reply to ebgreen)
 
 
Post #: 18
 
 RE: sendin email - 4/11/2007 4:15:41 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
Which line does the error occur on?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to tell)
 
 
Post #: 19
 
 RE: sendin email - 4/11/2007 8:41:44 PM   
  tell

 

Posts: 14
Score: 0
Joined: 4/10/2007
Status: offline
i ve tried that (suggested by dm_4ever, )


      

it seemed easy and correct but it doesnt work... do you know how to put HTML directly inside the code ??

(in reply to ebgreen)
 
 
Post #: 20
 
 
Page:   [1] 2   next >   >>
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> sendin email Page: [1] 2   next >   >>
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts