Page 1 of 1 1
Topic Options
#150811 - 2005-10-31 04:46 PM Problems converting VBS to KiX...
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Need some help guys. Never really learned how to convert VBS's to KiX Anyone who can give a clue? This is the VBS example:
Code:
' $Id: hello.vbs,v 1.11 2004/05/23 11:25:51 tm Exp $
'
' PDFlib client: hello example for COM with Windows Script Host and VBS
' Requires the PDFlib COM component
'
Option Explicit

Dim font
Dim oPDF

Set oPDF = WScript.CreateObject("PDFlib_com.PDF")

if (oPDF.begin_document("hello.pdf", "") = -1) then
WScript.Echo "Error: " & oPDF.get_errmsg
WScript.Quit(1)
end if

oPDF.set_info "Creator", "hello.vbs"
oPDF.set_info "Author", "Thomas Merz"
oPDF.set_info "Title", "Hello, world (COM/WSH)!"

oPDF.begin_page_ext 595, 842, ""

font = oPDF.load_font("Helvetica-Bold", "unicode", "")

oPDF.setfont font, 24

oPDF.set_text_pos 50, 700
oPDF.show "Hello, world!"
oPDF.continue_text "(says COM/VBS)"

oPDF.end_page_ext ""
oPDF.end_document ""

Set oPDF = Nothing


..and this is my failing attempt in KiX: Code:
$oPDF = CREATEOBJECT("PDFlib_com.PDF")
IF @ERROR
? "ERROR creating object: @ERROR (@SERROR)"
EXIT 1
ENDIF

IF $oPDF.begin_document("hello.pdf", "") = -1
? "ERROR: " + $oPDF.get_errmsg
EXIT 1
ENDIF

$oPDF.set_info = "Creator", "hello.vbs"
$oPDF.set_info = "Author", "Thomas Merz"
$oPDF.set_info = "Title", "Hello, world (COM/WSH)!"

$oPDF.begin_page_ext = 595, 842, ""

$font = $oPDF.load_font("Helvetica-Bold", "unicode", "")

$oPDF.setfont = $font, 24

$oPDF.set_text_pos = 50, 700
$oPDF.show = "Hello, world!"
$oPDF.continue_text = "(says COM/VBS)"

$oPDF.end_page_ext = ""
$oPDF.end_document = ""

_________________________
The tart is out there

Top
#150812 - 2005-10-31 05:06 PM Re: Problems converting VBS to KiX...
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Here's my quick stab at it... totally untested ...

Code:

break on

Dim $font
Dim $oPDF

$oPDF = CreateObject("PDFlib_com.PDF")

if $oPDF.begin_document("hello.pdf", "") = -1
? "Error: " + $oPDF.get_errmsg
Quit(1)
endif

$oPDF.set_info("Creator", "hello.vbs")
$oPDF.set_info("Author", "Thomas Merz")
$oPDF.set_info("Title", "Hello, world (COM/WSH)!")

$= $oPDF.begin_page_ext(595, 842, "")

$font = $oPDF.load_font("Helvetica-Bold", "unicode", "")

$oPDF.setfont($font, 24)

$oPDF.set_text_pos(50, 700)
$oPDF.show("Hello, world!")
$oPDF.continue_text("(says COM/VBS)")

$oPDF.end_page_ext("")
$oPDF.end_document("")

$oPDF = 0

exit 0


Top
#150813 - 2005-10-31 05:25 PM Re: Problems converting VBS to KiX...
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
uhm... hehe, it works!

But how does one know when to use paranthesises and not?
_________________________
The tart is out there

Top
#150814 - 2005-10-31 05:28 PM Re: Problems converting VBS to KiX...
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Like on this line here ?

$oPDF.set_info = "Creator", "hello.vbs"

idk - just a guess - based on the name of the "member" ... "set_info", sounded like a method, not a property - properties usually don't have "set" as part of the property name (but you never know). Plus the dead give-away was that this line had multiple params, which properties (usually) never have.

Top
#150815 - 2005-10-31 06:05 PM Re: Problems converting VBS to KiX...
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
yeah, that's what I meant Feels like there should be a FAQ on this or something. I just tried putting it like "=" cause I saw it done like that in this thread for example.

Thanks alot for the help shawn


Edited by masken (2005-10-31 06:07 PM)
_________________________
The tart is out there

Top
#150816 - 2005-10-31 06:19 PM Re: Problems converting VBS to KiX...
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
where did this pdf object come from ? did adobe develop it ? is there any help doc or chm file for it ? wouldn't mind having a lookie, sounds kinda neat.
Top
#150817 - 2005-11-01 12:01 AM Re: Problems converting VBS to KiX...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
actually...
methods never have "=" sign in vbs.
property related lines do.

no guessing.
_________________________
!

download KiXnet

Top
#150818 - 2005-11-01 01:14 AM Re: Problems converting VBS to KiX...
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
ja good point. no guessing required.
Top
#150819 - 2005-11-01 04:16 AM Re: Problems converting VBS to KiX...
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Looks like it might have come from Planet PDF.
Top
#150820 - 2005-11-01 04:30 AM Re: Problems converting VBS to KiX...
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Not a COM object, but still a nice deal for creating PDF files without having to buy the full Acrobat product or similar programs. You can't edit them, but just about anything you can print, you can create a PDF. It uses the Ghost Writer tool from many years ago.


$FREE PDF printer driver
http://www.primopdf.com/

Top
#150821 - 2005-11-01 08:44 AM Re: Problems converting VBS to KiX...
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Close, but the one I'm plaing around with is PDFlib It's been on the market for a long time and is problably one of the very best for "programming" PDF's with.
_________________________
The tart is out there

Top
Page 1 of 1 1


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

Who's Online
0 registered and 323 anonymous users online.
Newest Members
Audio, Hoschi, Comet, rrosell, PatrickPinto
17880 Registered Users

Generated in 0.064 seconds in which 0.026 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