Choosing printer from within a script

Ken Ray kray at sonsothunder.com
Thu Jun 23 14:18:53 EDT 2005


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



More information about the use-livecode mailing list