Page 1 of 1 1
Topic Options
#145820 - 2005-08-17 01:30 PM Print UDF, error 6 - The handle is invalid
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Guy's,

Does anybody know why I get error "6 - The handle is invalid" when using the print UDF to print a file that supports printing? Running WinXP SP2 and kix 4.50. Checked if the file might be opened by some other app but that’s not true.

Print() udf

Code:

Print('c:\test.txt')
If @error
"ERROR OCCURED:" @serror
Sleep 3
EndIf



content of the test.txt file:
Code:

bla
some more bla
even more bla
bla bla bla



Edited by Mart (2005-08-17 01:33 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#145821 - 2005-08-17 03:54 PM Re: Print UDF, error 6 - The handle is invalid
Stanley Offline
Starting to like KiXtart

Registered: 2004-06-03
Posts: 130
Loc: Upstate NY, USA
"ERROR OCCURED:" @serror
should be
? "ERROR OCCURED:" @serror

Assuming you want to output to the screen.
_________________________
Taxation WITH representation isn't so hot, either!

Top
#145822 - 2005-08-17 04:18 PM Re: Print UDF, error 6 - The handle is invalid
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

"ERROR OCCURED:" @serror
should be
? "ERROR OCCURED:" @serror

Assuming you want to output to the screen.



No, it shouldn't.

"?" is not a "print" command. It's a common mistake.

Top
#145823 - 2005-08-17 04:45 PM Re: Print UDF, error 6 - The handle is invalid
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Like Richard said the ? is sort of the same as @CRLF it displays the output in console on a new line just like @CRLF lets you start at the beginning of a new line.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#145824 - 2005-08-17 04:55 PM Re: Print UDF, error 6 - The handle is invalid
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
If this is so (is not but lets assume it is) then the printer should at least barf out the document because the print command is before the output and it does not print anything.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#145825 - 2005-08-17 04:56 PM Re: Print UDF, error 6 - The handle is invalid
Stanley Offline
Starting to like KiXtart

Registered: 2004-06-03
Posts: 130
Loc: Upstate NY, USA
OK OK I get it.
I guess my Irish coffee hasn't kicked in yet.

Using
OS W2K PRO
KIX 4.23

There is an error returned from this line
$!=$.namespace($_).parsename($_file)
"Member not found."
Which I am assuming causes the error in this line
$!.invokeverbex("print")
"The handle is invalid."
_________________________
Taxation WITH representation isn't so hot, either!

Top
#145826 - 2005-08-17 05:04 PM Re: Print UDF, error 6 - The handle is invalid
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Stanley,
Sorry about the cold showers we gave you
Ok, getting one step further.

Paging Lonkero!
Lonk, you wrote the UDF. Is there an issue with XPSP2 as far as you know?
I'm unable to see because I don’t get the createobject stuff yet.


Edited by Mart (2005-08-17 05:05 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#145827 - 2005-08-17 05:31 PM Re: Print UDF, error 6 - The handle is invalid
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
I think the Join() is incorrect in the Print() udf. Try changing the join line to

$_=join($_,'\')

Top
#145828 - 2005-08-17 05:44 PM Re: Print UDF, error 6 - The handle is invalid
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Oke, now it does print the file but it still does not work like said in the UDF comments:

Quote:


Invokes Printer selection GUI and Prints the file to selected printer





The printer selection GUI is displayed breefly but it just prints to the default printer.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#145829 - 2005-08-17 10:18 PM Re: Print UDF, error 6 - The handle is invalid
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
oh.
weird.
I don't have any xp machines to test with, so what I said there was about w2k.
_________________________
!

download KiXnet

Top
#145830 - 2005-08-17 10:37 PM Re: Print UDF, error 6 - The handle is invalid
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Hmmmm....that s#ucks. Would like to use it on XPSP2. Maybe someone else has an idea?
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#145831 - 2005-08-27 02:00 AM Re: Print UDF, error 6 - The handle is invalid
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you could try to replace:
$!=$.namespace($_).parsename($_file)

with:
"Connect to folder " $_ " errors with: "
$!=$.namespace($_)
@error ?
"Connect to file " $_file " in that folder errors with: "
$!=$!.parsename($_file)
@error ?
_________________________
!

download KiXnet

Top
#145832 - 2005-08-28 07:48 PM Re: Print UDF, error 6 - The handle is invalid
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
No joy yet. Well at least it prints but that has been achieved whit the earlier by maciep suggested modification.
Keeps on printing to the default printer. No matter if it is a .doc .txt .xls or whatever.
No errors all 0's

Quote:


Connect to folder c:\ errors with: 0
Connect to file test.doc in that folder errors with: 0
Connect to folder c:\ errors with: 0
Connect to file test.doc in that folder errors with: 0





Used code:
Code:

ReDirectOutput ("c:\error.txt")
Call @SCRIPTDIR + "\print.kix"
Print("c:\test.doc")
Sleep 3



Edited by Mart (2005-08-28 07:51 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#145833 - 2005-08-28 08:08 PM Re: Print UDF, error 6 - The handle is invalid
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ah, so your only problem is the lack of the print dialog?
_________________________
!

download KiXnet

Top
#145834 - 2005-08-28 08:12 PM Re: Print UDF, error 6 - The handle is invalid
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Yep.
The error stuff about invalid handle has been solved with the suggestion maciep did.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

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 201 anonymous users online.
Newest Members
SERoyalty, mytar, Gabriel, Alex_Evos, Dansen
17869 Registered Users

Generated in 0.356 seconds in which 0.29 seconds were spent on a total of 14 queries. Zlib compression enabled.

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