Here is a VBscript that runs a scan and then renames the output file 
after the scan is finished.  An output file is given an unique name by 
inserting todays date in the name of the output file.  This means 
running the scan on successive days will not overwrite a previous day's 
output file.

Both Windows XP and Vista can run VBscript files.  This capability is 
built into Windows XP and Vista.  For more information on this 
capability look up the subject "Windows Script Host" in Windows XP or 
Vista  "Help and Support".

To use the script you will first need to get answers to the following 4 
questions.
1. What is your scans output file name?
2. What is the path to your Quotes Plus Lists directory?
3. What is the path to Quotes Plus qp_rpts program?
4. What is the name of your scan profile

To create a scan profile name, first Open Quotes Plus Scan Database, 
then select File and Run.
Next in the SelectReports/Scans Window select the scan you want to use 
with this script and Click On Save Profile. Next enter the name for your 
scan profile in the File Name Textbox in the Save Reports Profile 
Dialog.  Accept the default values provided by Quotes Plus for the rest 
of the items in  the Save Reports Profile Dialog. Finally Click On OK in 
the Scan Reports Dialog.

The next step is to copy everything between "Rem Start of script" and 
"Rem End of script" to the Clipboard and then paste the Clipboard 
contents into NotePad.  Next customize the script for your use by 
inserting your 4 answers to the questions asked above into the script.   
Comments in the script indicate where your answers should be inserted.   
After modifying the script save the script.  The name of the script must 
have an extension of ".vbs".   Otherwise the name may be any name you 
choose. I suggest you save the script in the Quotes Plus Lists directory 
although you may save the script to any folder on your hard disk.

Although there are numerous ways to run the script I suggest you create 
a shortcut.  To do this Right Click on your Desktop, select New and 
Shortcut, Browse to the location of your script file,  Click on the name 
of your script and OK, next click on Next in the Create Shortcut Window, 
next if you prefer enter a new name for the Shortcut in the Select a 
Title for the Program Window and finally click on Finish.

Then to run the script Double Click on the shortcut.

Rem Start of Script
Rem Script Name:  RenameDailyScan.vbs
Rem Description:  This scrip runs a scan profile and inserts todays date
Rem into the output file name.
Option Explicit
Dim WshShl
Dim TodaysDate
Dim Yr, Mnth, Dy
Dim FSObj, FileName, InputFile, OutputFile
Rem Change "DailyScan" to your scans output file name.
Rem Do not include the output file name's extension in ListName
Rem Question 1 answer goes here
Const ListName = "DailyScan"
Rem If you stick with Quotes Plus naming convention don't  
Rem change the "ListNameExt" constant
Const ListNameExt = ".lst"
Rem Change "C:\Financial\QpData\" to your computer's path
Rem to the Quotes Plus Lists Directory.
Rem Question 2 answer goes here.
Const FilePath = "C:\Financial\Qpdata\Lists\"
Set WshShl = WScript.CreateObject("WScript.Shell")
Set FsObj = WScript.CreateObject("Scripting.FileSystemObject")

Rem Change "C:\Financial\QuotesPL\" to your computer's path
Rem to the qp_rpts program's directory.
Rem Change" May27.rpf" to the name of your scan profile
Rem Questions 3 and 4 answers go here.
WshShl.Run "C:\Financial\QuotesPl\qp_rpts  may27.rpf"
TodaysDate = Now
Yr = DatePart("yyyy" , TodaysDate)
Mnth = DatePart("m" , TodaysDate)
Dy = DatePart("d" , TodaysDate)
FileName = ListName & Mnth & "-" & Dy & "-" & Yr  & ListNameExt
InputFile = FilePath & ListName & ListNameExt
OutputFile = FilePath & FileName
Rem because the results of a scan may not be immediately written to
Rem disk I added a 3 second pause as work around to an "InputFile" not
Rem found problem.
WScript.Sleep 3000
FSObj.MoveFile InputFile, OutputFile
Rem If you run this Script more than once a day you will get a
Rem "File already exists" error. The work around is delete the
Rem  OutputFile before you run this script again. The "OutputFile is
Rem in the QpData\Lists directory and it is the one that has
Rem Todays Date included in its file name.
Rem End of script

Howard

[EMAIL PROTECTED] wrote:
>
> I need some help in solving a daily problem I have.
>  
> I programmed a Scan. Every day I run the scan and it outputs a list of 
> filtered stocks.
>  
> The next day I run the same scan again. It outputs a new list of 
> filtered stocks, but the name of the list is the same as the name of 
> the list created the day before. The old list is written over with the 
> current day's output.
>  
> How can I program my scan so that every time I run it, it does not 
> create an identically named list file that overwrites an existing 
> file? I've addressed this problem by moving each created file created 
> by my daily use of the scan to individually created folders so that a 
> new scan will not have the opportunity to overwrite any previously 
> existing scan.
>  
> The procedure I use permits me to save every day's scan to study 
> later, but I'm physically tied to the computer in order for this to 
> happen.
>  
> A possible solution to my dilemma is to try and program the scan so 
> that the output is identified as a list that is tied to the day, i.e. 
> a May 5, 2007 scan would be created as 05052007.lst. The next day's 
> list would be identified as 05062007.lst, and so on. Does any one how 
> to do this? Or is there a more elegant solution that is readily 
> available but I just haven't figure it out yet. Thanks for any help.
>
>
>
> ------------------------------------------------------------------------
> See what's free at AOL.com 
> <http://www.aol.com?ncid=AOLAOF00020000000503>.
>  


Reply via email to