You mentioned Windows XP. Maybe give this code a try:
; Delete Print Jobs
; Stop the Spooler Service
AddExtender("wwwnt34i.dll")
aService = "Spooler"
state = wntSvcStatus("", aService, 0, 2) ; Get the current state of the service
If state==4 ; Service is running
wntSvcControl("", aService, 0, 1) ; Stop the Service
; Wait for service to stop
While state != 1
TimeDelay(1)
state = wntSvcStatus("", aService, 0, 2) ; get the current state of the service
Endif
Endif
; Delete files in Spool
FileDelete( DirWindows(0):'\system32\spool\printers\*.shd' )
FileDelete( DirWindows(0):'\system32\spool\printers\*.spl' )
; Restart the Spooler Service
wntSvcStart("", aService, 0, "", "") ; start the Spooler service
Exit
Ok here is an undebugged code sample I came up with for Windows 7:
; Delete Print Jobs
; Stop the Spooler Service
AddExtender("wwwnt34i.dll")
aService = "Print Spooler" ;Win 7
state = wntSvcStatus("", aService, 0, 2) ; Get the current state of the service
If state==4 ; Service is running
wntSvcControl("", aService, 0, 1) ; Stop the Service
; Wait for service to stop
While state != 1
TimeDelay(1)
state = wntSvcStatus("", aService, 0, 2) ; get the current state of the service
Endwhile
Endif
; Delete files in Spool
oldvalue = IntControl( 92, "disable", 0, 0, 0 )
FileDelete( DirWindows(0):'\system32\spool\printers\*.shd' )
FileDelete( DirWindows(0):'\system32\spool\printers\*.spl' )
IntControl( 92, "revert", oldvalue, 0, 0 )
; Restart the Spooler Service
wntSvcStart("", aService, 0, "", "") ; start the Spooler service
Exit