vendredi 17 janvier 2014

VBScript for a dummy (that's me)

Here's the scenario. I'm not a programmer! But here at work I'm trying to become one because the line between pre press work and programming is getting more and more blurry between variable data programs and whatnot. Since we're a small shop we tend to wear more than one hat.



With that in mind, I've been tasked with creating an automated process. Part of that process entails sending out an email when a job has been printed. The automation software does not use GMail, so I can't use their easy-peasy plugin to send an email. I have to use VB Script or JavaScript. I chose VB Script because that's the script I stole wrote that most closely resembles what I need.



I somehow need this script to embed the file names(plural) located in a folder. Using the script below, I've managed to get ONE of the filenames embedded in an email, but not all. I'm looking at the Watch.GetOriginalFileName and wondering if there's an equivalent that can list all the files, not just the first one in the folder, which is what it does now.



Displaying a list of files should be fairly easy but i'm having a hard time. Alternatively, a VB Script or JavaScript that will even put the list of filenames on a PDF would be really cool.



I'm rather hoping someone already has this and can just copy-and-paste it because I don't want any of you fine folks to give any great effort....



THANKS for listening!




Quote:








Option explicit

Dim MyMsg

Set MyMsg = CreateObject("CDO.Message")



''Change the values below to meet your own settings

''Port 25 is used for standard mail. Port 465 or 587 is used for SSL mail

SMTPConfig MyMsg, "smtp.gmail.com", 465, "email@email.com", "password", True





MyMsg.From = "email@email.com"

MyMsg.To = "thefinefolksatJREF@groovy.net"

MyMsg.Subject = "Testing Email"

MyMsg.TextBody = Watch.GetOriginalFileName



' Uncomment following line if your want to attach

' the current job file to the email



'MyMsg.AddAttachment

Watch.GetJobFileName



MyMsg.Send



Sub SMTPConfig(msg, srv, port, user, pw,useSSL)

Const cdoFieldPrefix = "http://ift.tt/1awIWHW;

with msg

.Configuration.Fields.Item (cdoFieldPrefix & "sendusing" ) = 2

.Configuration.Fields.Item (cdoFieldPrefix & "smtpserver" ) = srv

.Configuration.Fields.Item (cdoFieldPrefix & "smtpserverport" ) = port

.Configuration.Fields.Item (cdoFieldPrefix & "sendusername" ) = user

.Configuration.Fields.Item (cdoFieldPrefix & "sendpassword" ) = pw

.Configuration.Fields.Item (cdoFieldPrefix & "smtpauthenticate") = 1

.Configuration.Fields.Item (cdoFieldPrefix & "smtpusessl") = useSSL

.Configuration.Fields.Update

end with

end sub








via JREF Forum http://ift.tt/1gW4Ple

Aucun commentaire:

Enregistrer un commentaire