Automatic file print script...??

Questions, problems, and other issues for Ascendis Caller ID that aren't covered by the other forums.
Post Reply
EnRoj
Posts: 4
Joined: Wed Jul 05, 2006 10:00 am

Automatic file print script...??

Post by EnRoj »

Hello sir, I'd like to know if I can print a file automatically after Ascendis registers a new call and if that's possible how can I do it?

Thanks a lot,
Enrique
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Re: Automatic file print script...??

Post by Bill Root »

Hello Enrique,

What kind of file would you like to print?

If the program that created the file has a command line print option, like Windows Notepad, you can do it with an advanced script such as this:

Code: Select all

// LANGUAGE=DWS

Log('temp.txt', 'ABCDEFG');
Run('notepad.exe', '/p temp.txt');
Note that the above script uses the "Log" command to put something into the file. If you have an existing file, you don't need this.

Finest regards,
Bill Root
Ascendis Software
EnRoj
Posts: 4
Joined: Wed Jul 05, 2006 10:00 am

Excel file automatically print

Post by EnRoj »

Well, I'd like to print a file from Excel but I think that this program doesn't recognize the /p command...

Is there any other command or script that I can use?

Thanks agian.

Enrique
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Re: Excel file automatically print

Post by Bill Root »

I couldn't find a command-line option for Excel, either. But, I did find the following:

Code: Select all

' from http://groups.google.com/group/microsoft.public.excel.misc/msg/88267cfecdb4fd9c?dmode=source
' Author: Steve Yandl
'
' Print an Excel XLS file

Const xlDoNotSaveChanges = 2 

Dim fso, oXL, oWkbk 

Set fso = CreateObject("Scripting.FileSystemObject") 
Set oXL = CreateObject("Excel.Application") 

oXL.Visible = False 

If WScript.Arguments.Count = 0 Then 
WScript.Quit 
Else 
   For A = 0 To (WScript.Arguments.Count - 1) 
   If (Right(WScript.Arguments.Item(A), 3) = "xls")  _ 
   AND fso.FileExists(WScript.Arguments.Item(A)) Then 
      Set oWkbk = oXL.Workbooks.Open(WScript.Arguments.Item(A)) 
      oWkbk.PrintOut 
      oWkbk.Close xlDoNotSaveChanges 
   End If 
   Next 
End If 

oXL.Quit 
Set fso = Nothing 
Set oXL = Nothing
Put the above code into a file named 'PrintXls.vbs'. Save it somewhere convenient.

Now, use this script from Ascendis Caller ID to print:

Code: Select all

// LANGUAGE=DWS

// print from Excel:
// replace "c:\transfer\" with the location of PrintXLS.vbs
// replace "c:\transfer\temp.xls" with the name of the Excel file to print
Run('c:\transfer\PrintXLS.vbs', 'c:\transfer\temp.xls');
That worked in my tests. It requires Windows Script Host, which is installed by default on recent versions of Windows, I think. See the URL in the first script for more information.

Finest regards,
Bill Root
Ascendis Software
EnRoj
Posts: 4
Joined: Wed Jul 05, 2006 10:00 am

THANKS!!!

Post by EnRoj »

That's perfect!!! :D

Thank you very much sir!!!

Enrique
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Re: THANKS!!!

Post by Bill Root »

You are most welcome! :D

-Bill
Post Reply