Choosing printer from within a script

Lynch, Jonathan bnz2 at cdc.gov
Thu Jun 23 14:23:42 EDT 2005


Thanks Ken!

What versions of windows allow you to use Vbscript in this way? I see
many uses for such a thing.

-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Ken Ray
Sent: Thursday, June 23, 2005 2:19 PM
To: Use Revolution List
Subject: Re: Choosing printer from within a script

On 6/23/05 11:13 AM, "Lynch, Jonathan" <bnz2 at cdc.gov> wrote:

>
> Are there shell commands that either return a list of available
> printers, and that allow you to pick your printer?

You can use VBScript for this, and run VBScript from Rev. Here's a page
where they talk about getting the list of printers
(EnumPrinterConnections):

http://www.computerperformance.co.uk/Logon/logon_enumprinterconnections.
htm

To call VBS from Rev, you basically create a file with the extension
".vbs"
(through put url("file:") or open file/write file/close file) and then
execute it, and then delete it (so it doesn't lie around). Here's what I
use:


function doVBS pVBScript,pDirectConsole
  if pDirectConsole = "" then
    put "C:\vbs_temp.vbs" into tVBSPath
    put pVBScript into url ("file:" & tVBSPath)
    set the hideConsoleWindows to true
    get shell("cscript.exe //nologo" && tVBSPath)
  else
    set the hideConsoleWindows to true
    get shell("cscript.exe" && pVBScript)
  end if
  put it into tResult
  if there is a file tVBSPath then
    send "delete file" && quote & tVBSPath & quote to me in 1 second
  end if
  if tResult <> "" then return tResult
end doVBS

HTH,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com

_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list