One way to address this would be to side step the Save As window by using a couple macros in the NPR report to specify the download path and filename.  Here's what I have used:
 
1.) In NPR where you set up your Report (ADM.PAT.zcus.your.reportname), set up the following macro named "setup" (no quotes):
 
; bypass Print On prompt
1^/Z.SCHED.LOG,
; set printer name
".PRT"^NODE,
"DOWNLOAD"^/[NODE],
; Report Title goes on next line as you'll be replacing it on the Enter/Edit Screen
"YOUR REPORT TITLE";
 
2.) Create a second macro named "start" (again, no quotes):
 
1^/ZDOWN^/Z.SCHED.RPT^/NO.SUBMERGE^s.print.priority^s.num.copies,
""^/Z.SCHED.LOG,
"DOWNLOAD"^s.group,
; build name of file
/.DAT^/DATE,
/DATE%3^/DATE,
@.now^/TIME,
/DATE_/TIME_".txt"^/FILENAME,
; set download path, don't exceed 8 character folder & filenames
"C:\TEMP\"_/FILENAME^MIS.SPOOL.c.filename,
; get spool file
%MIS.SPOOL.get.spool.saf(""),
; reset printer characteristics
%Z.printer(/R.CPI,/R.LPI,/R.PS,/R.CPL,/R.LP)
 
3.) On Enter/Edit Report screen, change your Report Title to the following, and quotes must be included this time!
 
"_%ADM.PAT.zcus.your.reportname.M.setup(0)_"
 
 
This will call the setup macro instead of printing the report name when the report is run.
 
4.) Add the following macro call to the top of your footnote on the Edit Footnotes screen of Enter / Edit Report:
 
AL START start
 
 
This will call the "start" macro, which will configure the rest of the info you need to create the downloaded report file, including the path and filename. I've chosen to use a file name of MMDDhhmm.txt format. File and Translate, and then give it a test.
 
That's it.  The comments say not to exceed 8 character folder and filenames, but I've used it successfully with longer filenames. I've also used it with both mapped network drive letters and UNC folder paths; your mileage may vary.
 
Cheers,
 
Kevin Meagher
Programmer / Analyst
Mid-Columbia Medical Center - Information Systems
 
Disclaimer: The above code is provided "AS IS". The sender makes no warranty, express or implied, or assumes any legal liability or responsibility for the accuracy or completeness of any information contained in this email message. Have a nice day.


>>> [EMAIL PROTECTED] 3/20/2007 11:16 AM >>>
I built a script to open Meditech and download a report to a location on
our server.  It runs great, when I execute it manually.
However, when I schedule it to run at 6AM in the morning, it appears
that my "locked" computer window is taking away the focus from the
'Activate "Save As"' line code within the script.
Has anyone been able to work around this?
Due to policy, our company computers "lock" after a certain time of
inactivity.
Here's the line of code that works only when ran when my computer is
"unlocked":

Enter "DOWNLOAD"
Wait 0.4
Enter
Stable 3
Activate "Save As"
Stable 0.3
SendKeys (rptName)
Stable 1
SendKeys ("%S")
Activate "Save As"
Stable 0.3
SendKeys ("%Y")
Pause "End of report."
Enter
Wait 0.5

Any feedback is MUCH appreciated!
Thanks,
Chase Rodgers
Financial Reporting Manager
Medical Center of Plano
*214-473-7490
[EMAIL PROTECTED]

Reply via email to