Page 1 of 1 1
Topic Options
#73066 - 2003-02-13 09:10 AM How to view a queue from script
Schuliebug Offline
Hey THIS is FUN
*****

Registered: 2002-01-18
Posts: 379
Loc: Netherlands
Hi,

I'm working on a script that users can use to choose a printer or open a printer queue. I'm having problem to open a view to a queue. When i try to use
code:
Shell '%ComSpec% /c start $queue'

it doesn't do anything. When doing the same on a command line it works.

Some background info on why writing this tool: some of our apps still needs LPT1 mapped to the queue. Thats why of write this, when choosing a default queue the LPT1 is automatically mapped to the same queue.
_________________________
Kind regards,

Top
#73067 - 2003-02-13 09:22 AM Re: How to view a queue from script
Schuliebug Offline
Hey THIS is FUN
*****

Registered: 2002-01-18
Posts: 379
Loc: Netherlands
Slow morning on the BB, huh ?
_________________________
Kind regards,

Top
#73068 - 2003-02-13 01:24 PM Re: How to view a queue from script
Schuliebug Offline
Hey THIS is FUN
*****

Registered: 2002-01-18
Posts: 379
Loc: Netherlands
Extra info: when creating a link with just the queue in it, it also doesn't start from an Shell '%ComSpec% /c start $queue'.. Better said: it spawn and immidiate closes the window ? Test code:



$URL='\\server\queue'
; $URL='%SystemRoot%\explorer.exe'        ; no params (yet)
; $URL='\\server\share'                ; share may contain $

$=ViewURL($URL)

Exit


Function ViewURL($URL)
  If $URL=''
      $ViewURL='Error: No URL defined !'
      Exit(1)
  EndIf
 
  ; Temporary URL link..
  $URLLnk='%Temp%\'+SubStr($URL,InStrRev($URL,'\')+1)+'.lnk'
 
  ; Create temporary URL link..
  $Shell=CreateObject('WScript.Shell')
  If $Shell
      $Shrtcut=$Shell.CreateShortcut($URLLnk)
      If $Shrtcut
          $Shrtcut.TargetPath=$URL
          $CreateShCut=$Shrtcut.Save
          $Shrtcut = 0
      EndIf
  EndIf
 
  ; Spawn shortcut..
  If Exist($URLLnk)
      Shell '%ComSpec% /c start $URLLnk'
      Del $URLLnk
  EndIf
EndFunction



Only when using a queue it failes, the other two works fine ??

Heh, PostPrep for the first time. Must be one of the last ones using it [Smile] [Smile]

[ 13. February 2003, 13:25: Message edited by: Schuliebug ]
_________________________
Kind regards,

Top
#73069 - 2003-02-13 03:08 PM Re: How to view a queue from script
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
off of the top of my head... adsi has functions to open and view printer queue's.

a quick example on how to display all printjobs in a given print queue.

code:
$computer = getobject("WinNT://@wksta")
$computer.filter = "printqueue",""


for each $printer in $computer
? $printer.name
for each $job in $printer.printjobs
" " + $job.user + " " + $job.TimeSubmitted + " " + $job.totalpages
next
next


Top
#73070 - 2003-02-13 03:11 PM Re: How to view a queue from script
Schuliebug Offline
Hey THIS is FUN
*****

Registered: 2002-01-18
Posts: 379
Loc: Netherlands
Bryce,

The problem is not the functionality you described (lot's of examples available throught msdn) but just to open de printer, functionality you get when going to a printer you've connected and klick on it. It'l then open up the queue..
_________________________
Kind regards,

Top
#73071 - 2003-02-13 03:23 PM Re: How to view a queue from script
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
ahhh i think i understand now.

you just want to open up the GUI window that you get when you double click on a printer queue name in the start|settings|printers menu....

hmmmm

this is a control panel applet... and might be able to open using the run32dll shell trick...

Top
#73072 - 2003-02-13 04:10 PM Re: How to view a queue from script
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
You can try using the printui.dll commands.

rundll32 printui.dll,PrintUIEntry /o /n\\machine\printer

will open a printer queue. You can also do a..

rundll32 printui.dll,PrintUIEntry /?

to view all other options. Dont know if this is exactly what you were looking for.

Top
#73073 - 2003-02-13 04:37 PM Re: How to view a queue from script
Schuliebug Offline
Hey THIS is FUN
*****

Registered: 2002-01-18
Posts: 379
Loc: Netherlands
CitrixMan, works like a charm !! I've put start in front of the command, resulting in:



Shell '%ComSpec% /c start rundll32 printui.dll,PrintUIEntry /o /n'+$Queue



In this case the script will create the queue window, and the normal window will close afterwards [Smile]

Thankz !!
_________________________
Kind regards,

Top
#73074 - 2003-04-23 10:40 AM Re: How to view a queue from script
Schuliebug Offline
Hey THIS is FUN
*****

Registered: 2002-01-18
Posts: 379
Loc: Netherlands
CitrixMan,

Do you, by any chance, also know if is there something alike for Dial-Up connections ?? Trying to rewrite rasphone.exe to a KiXforms GUI, need to start, add or delete a connection from there.
_________________________
Kind regards,

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 400 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.046 seconds in which 0.021 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org