Hi,
I think that you may be able to use the VB File Scripting Object to
accomplish the first two items here. First, you need to add a reference
to you Boston application to the Microsoft Scripting Runtime. Load your
project into Boston Workstation, click on the Visual Basic Editor, click
on Tools, click on References and scroll down the list until you locate
"Microsoft Scripting Runtime". Click once on this item, and then click
OK. You can then add code similar to below :
Dim fso as new FileSystemObject
Dim oFolder as folder
Dim oFile as file
Set oFolder = fso.GetFolder("{Source Folder}") ' This
will be the physical location of the files (ie "C:\MyFiles")
For each oFile in oFolder.Files
' here you can check to see if the filename matches some criteria such
as :
If left(oFile.name,24) = "HOSP REMIT OH MEDICARE A" then
.... ' Do something with the file if the left 24 characters of the file
name equal the specified name.
Or...
If oFile.DateCreated = {SOME DATE} then .... ' This
checks to see if the date the file was created is equal to the day you
specified ie:
Now() for the day you are running the script
DateAdd("d",-2,Now()) two days previous to the day you are running the
script
Or...
If DateDiff("d",oFile.DateCreated,Now()) <= 2 then ....
' This checks to see if the date the file was created is less than or
equal to 2 days from the date you are running the script.
And then you can copy, move, delete ...etc
oFile.move("{Destination Folder}")
oFile.Copy("{Destination Folder}",{Boolean to force
overwrite})
oFile.Delete, {Boolean to force delete}
Next oFile
Set oFolder = nothing
Set oFile = nothng
For the third question I would probably use a UserForm instead of a
message box. Create a new form called frmMessage, add a label with the
message you want displayed. Have your script show the form (ie.
frmMessage.Show) when you want the message to display, and then loop for
5 seconds and unload the form.
Dim tmpTime as Date
Frmmessage.show
tmpTime = now
Do until DateDiff("s",tmptime,Now) >= 5
DoEvents
Loop
Tim France
Salinas Valley Memorial Hospital
(831) 759-1984
[EMAIL PROTECTED]
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Carol Cayhoe
Sent: Friday, October 12, 2007 12:01 PM
To: [email protected]
Subject: [Talk] Wildcards / Message Timeouts
Hello Everyone:
I am new to Boston Workstation and I have a few questions. What I am
attempting to accomplish is to save a file each week which is
downloaded to a server by an outside vendor to a local drive. The
files have a slightly different name each week and, further, these are
not the only files downloaded to this server there are others in the
same directory but, my script is to run the remittance for Medicare
files only. Thus, can wildcards be used in Boston Workstation scripts
and, if so, please provide me an example. I have tried different ways
using various wildcard characters but, none seem to work. The following
are examples of the file names for the last three weeks:
HOSP REMIT OH MEDICARE A 010628PF01 ANS.DAT
HOSP REMIT OH MEDICARE A 010720RT01 ANS.DAT
HOSP REMIT OH MEDICARE A 011323GH01 ANS.DAT
Part two of this question, as you can see from above, all the file names
are just slightly different and they are downloaded, to the same folder
on the server and the older copies are not deleted. Thus, is there a
way that once the files have been identified (by using the wildcard
characters) can I just get the latest version of the file for my weekly
script? Presently I'm doing this manually and have to look at the last
date the file was modified but, do not know how to do this in BW or, if
it is even possible.
My last question is how do I show a message box for a specified amount
of time, for example 5 seconds, then have it disappear and the script
continue to the next step without any user interaction?
Hopefully I explained this correctly.
Thanks,
PRIVILEGE AND CONFIDENTIALITY NOTICE
The information in this electronic mail is intended for the named
recipients only. It may contain privileged and confidential material and
may be protected under law by the Health Insurance Portability and
Accountability Act. Any use of this information by anyone other than the
intended receiver is prohibited. If the reader of this message is not
the intended recipient, you are hereby notified that any dissemination,
distribution, copying or other use of this message or its attachments is
strictly prohibited. If you have received this message in error, please
notify the sender immediately by replying to this electronic e-mail.
Please delete it from your computer. Thank you
CONFIDENTIALITY NOTICE: This message and any included attachments are from
Salinas Valley Memorial Hospital and are intended only for the addressee. The
information contained in this message is confidential and may constitute inside
or non-public information under international, federal, or state securities
laws. Unauthorized forwarding, printing, copying, distribution, or use of such
information is strictly prohibited and may be unlawful. If you are not the
addressee, please promptly delete this message and notify the sender of the
delivery error by e-mail or you may call Salinas Valley Memorial Healthcare
System's Privacy Officer in Salinas, California, U.S.A at (+1) (831) 755-0751.
<<image001.jpg>>
