December 16, 2003 at 9:15 am
I have created a Web page "report" (.htm) and all is good. Now I want to print it, without prompting a user. It sounds easy but I have never used anything other than the T-SQL script type. Would this be a good application for javascript/vbscript or is there a better (more simple) way?
This job will run once per day at 1:00AM.
I am using SQL 7.0 and IE/IIS if that makes a difference. I am a beginner at this so please don't use any big words:)
December 16, 2003 at 10:44 am
How do you create the report? Is it some batch job?
Will the server "print" the report automatically? If so, you need to log in as the SQL Server Agent account and attach a printer, then VBScript would be my choice.
Steve Jones
http://www.sqlservercentral.com/columnists/sjones
The Best of SQL Server Central.com 2002 - http://www.sqlservercentral.com/bestof/
December 16, 2003 at 11:15 am
I use sp_runwebtask..., as a step in a job that is scheduled to run at Midnight, with an HTML template file.
Yes I would like to print the report automatically.
How do I log into the SQL Server Agent Account?
How do I attach a printer?
Would I be able to run the VBScript as a step in a job?
And if that is not enough... Can anyone give me some sample VBScript? OR Give me a link to where I can see some sample code?
Thanks, (I know I am asking for a lot, but I am out of my element)
December 16, 2003 at 3:43 pm
OK, to log in as the sql server agent, you need to check the account under which SQL server Agent runs. This in in the Control Panel | Admin Tools | Services,check the SQL Server Agent server and see what account it logs in as. It needs to be a "domain account" to access a domain printer.
From there log in as this account to the server and under Control PAnel | Printers, select your printer.
Now, you can add the VBScript as a step in the job. The call usually is "cscript printthis.vbs" as a command text type step. As for the exact code, I don't have a sample handy, but here is the VBScript reference:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vtoriVBScript.asp
Steve Jones
http://www.sqlservercentral.com/columnists/sjones
The Best of SQL Server Central.com 2002 - http://www.sqlservercentral.com/bestof/
December 17, 2003 at 5:55 am
Now I see what you mean about the printer.
I will tackle the VBScript reference and maybe I can make this happen.
Thanks Steve, for getting me started in the right direction.
December 17, 2003 at 9:54 am
Anytime, and please continue the thread if you have more questions. IF you get it working, please drop the print script in our library. I'm sure someone else will appreciate it
Steve Jones
http://www.sqlservercentral.com/columnists/sjones
The Best of SQL Server Central.com 2002 - http://www.sqlservercentral.com/bestof/
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply