Page 2 of 2 <12
Topic Options
#96262 - 2002-11-29 11:43 PM Re: RFC - Send a print job from KiX ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
the reason why it did nothing was that forgot to rename one object.
the line with invokeverbs should be:
$printer.invokeverb(""+$verb)
_________________________
!

download KiXnet

Top
#96263 - 2002-11-29 11:53 PM Re: RFC - Send a print job from KiX ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
actually, it was wrong too [Big Grin]
this is the function that did it:
code:
function PrintFile($file)
dim $shell,$printer,$action
$shell=createobject("shell.application")
$printer=$Shell.namespace($file).self
for each $action in $printer.verbs
if join(split($action,"&"),"")=join(split(readvalue("HKEY_CLASSES_ROOT\htmlfile\shell\Print",""),"&"),"")
$printer.invokeverb(""+$action)
endif
next
endfunction



[ 30. November 2002, 03:25: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#96264 - 2002-11-30 03:19 AM Re: RFC - Send a print job from KiX ?
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
...no finnish friends allowed - it's one of the conditions of my parole... [Razz]
...at home...can't test properly... [Frown]
...where does $actionname get dimmed/passed in this latest version? [Confused]
_________________________
We all live in a Yellow Subroutine...

Top
#96265 - 2002-11-30 03:26 AM Re: RFC - Send a print job from KiX ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
forgot that too.
fixed above code.
_________________________
!

download KiXnet

Top
#96266 - 2002-12-02 08:33 PM Re: RFC - Send a print job from KiX ?
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Lonkero...
FWIW...
Back from Amarillo and this...
code:
$file="myword.doc"
$pf=printfile($file)
"rc4 "+@error+" "+@serror?
;
function PrintFile($file)
dim $shell,$printer,$action
$shell=createobject("shell.application")
"rc1 "+@error+" "+@serror?
$printer=$Shell.namespace($file).self
"rc2 "+@error+" "+@serror?
for each $action in $printer.verbs
if join(split($action,"&"),"")=join(split(readvalue("HKEY_CLASSES_ROOT\htmlfile\shell\Print",""),"&"),"")
$printer.invokeverb(""+$action)
"rc3 "+@error+" "+@serror?
endif
next
endfunction

returns this...
quote:
rc1 0 The operation completed successfully.
rc2 -2147352573 Member not found.
rc4 0 The operation completed successfully.

_________________________
We all live in a Yellow Subroutine...

Top
#96267 - 2002-12-02 08:35 PM Re: RFC - Send a print job from KiX ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hehee [Razz]
full path to file, nothing else.

also, you could check the new udf fileaction()
_________________________
!

download KiXnet

Top
#96268 - 2002-12-02 10:15 PM Re: RFC - Send a print job from KiX ?
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
heehaw...
hehee==no
fileaction() returning error code 2
_________________________
We all live in a Yellow Subroutine...

Top
#96269 - 2002-12-02 10:47 PM Re: RFC - Send a print job from KiX ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
what parameters used?
_________________________
!

download KiXnet

Top
#96270 - 2002-12-03 04:38 PM Re: RFC - Send a print job from KiX ?
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Lonkero...
I'm not trying anything 'fancy'...
code:
;test.kix
dim $file
$file=@scriptdir+"\myword.doc"
If Exist ($file)
"Printing file "+$file?
If FileAction($file,"Print")
"error occured:" @error?
Else
"File Printed."?
Endif
Else
"File "+$file+" not found"?
Endif
;
function FileAction($file,$action)
dim $shell,$
$fileaction=1
$shell=createobject("shell.application")
$file=$Shell.namespace($file).self
if @error $fileaction=2 exit 2 endif
for each $ in $file.verbs
if join(split($,"&"),"")=$action
$shell.invokeverb(""+$)
$fileaction=0
endif
next
if $fileaction exit 1 endif
endfunction

barfs and returns
quote:
"error occured:2"
_________________________
We all live in a Yellow Subroutine...

Top
#96271 - 2002-12-03 05:07 PM Re: RFC - Send a print job from KiX ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
sorry for doubting you.
somehow the code that got on board was the testing halfworking code.

change:
$shell.invokeverb(""+$)

to:
$file.invokeverb(""+$)

and say whats output then...
_________________________
!

download KiXnet

Top
#96272 - 2002-12-03 05:18 PM Re: RFC - Send a print job from KiX ?
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
same result...
failing on this line...?
code:
$file=$Shell.namespace($file).self  

_________________________
We all live in a Yellow Subroutine...

Top
#96273 - 2002-12-03 05:21 PM Re: RFC - Send a print job from KiX ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
try it with changing your filename var in code.
I used $filer...

there might be some thing, anyway, mine worked just fine.

there is with this function two things to consider:
1) os version, correct shell32.dll
2) os language, the action changes by language (mine for print is tulosta)
_________________________
!

download KiXnet

Top
#96274 - 2002-12-05 02:28 PM Re: RFC - Send a print job from KiX ?
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
fwiw...
...still no go with fileaction()...
WinXp Pro v 5.1.2600
shell32.dll v 6.0.2600.0
comctl32.dll v 6.0.2600.0
shlwapi.dll v 6.0.2600.0
os language english (us)
...you've lost me with (tulosta)?
_________________________
We all live in a Yellow Subroutine...

Top
#96275 - 2002-12-05 09:30 PM Re: RFC - Send a print job from KiX ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
it's finnish version of "print"

anyone else using xp could you try it out?
haven't found it not working.
_________________________
!

download KiXnet

Top
Page 2 of 2 <12


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

Who's Online
0 registered and 302 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.068 seconds in which 0.022 seconds were spent on a total of 13 queries. Zlib compression enabled.

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