DLL use

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Robbyn
Junior Coder
Posts: 43
Joined: Tue Feb 15, 2005 9:55 pm

DLL use

Post by Robbyn » Tue Dec 27, 2005 3:03 pm

I wish to run a dll from within MS. This is the sample code for Visual Basic. How should I change it for MS?

Public Declare Function GetPDFText Lib "PDFtext.dll" (ByVal FileName As String, ByVal opt As Long, ByVal target As String) As String
. . .

Private Sub option3_Click()
' Save the text-content into a returning string
Text2.Text = GetPDFText(Text1.Text, 3, "")
End Sub
. . .

Comment and further question:

I am not used to VB but it seems to me that filename and target above are variables. If not I would like them to be so that I can substitute different file names from within the MS routine. Is that type of literal variable possible from within MS so that MS reads it as if it were the full path and file name as previously stored into the variable?
Robin

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Dec 27, 2005 3:23 pm

Hi,

I don't think that DLL will work with Macro Scheduler because it returns a string, not a number. Are you able to email me a copy of that DLL, or tell me where I can download it? I could then test it and if necessary write you a DLL or ActiveX wrapper for it that will work in Macro Scheduler.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Robbyn
Junior Coder
Posts: 43
Joined: Tue Feb 15, 2005 9:55 pm

Post by Robbyn » Tue Dec 27, 2005 5:17 pm

The dll can be obtained from:

http://www.pdf-analyzer.com/

it is called pdftext

Thank you for offering to make it useable in MS.
Robin

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Dec 27, 2005 5:34 pm

Hi,

Ok, it already works fine with Macro Scheduler since it offers an option to return the text to the clipboard or a file. So either way we have a method to put the returned text in a Macro Scheduler variable.

Using the clipboard:

//modify the next line to point to pdftext.dll
Let>lib=C:\Documents and Settings\Marcus\My Documents\pdftext\pdftext.dll

//modify the next line to point to a PDF file
Let>pdffile=C:\Documents and Settings\Marcus\My Documents\pdftext\pricing.pdf

//Call GetPDFText, passing the pdffile and putting result on clipboard
LibFunc>lib,GetPDFText,r,pdffile,2,

//Get text from the clipboard
GetClipBoard>thetext
MessageModal>thetext

Using a temporary text file:

//Using a text file
//modify the next line to point to pdftext.dll
Let>lib=C:\Documents and Settings\Marcus\My Documents\pdftext\pdftext.dll

//modify the next line to point to a PDF file
Let>pdffile=C:\Documents and Settings\Marcus\My Documents\pdftext\pricing.pdf

//Temp text file name
Let>tempfile=c:\pdftext.txt

//Call GetPDFText, passing the pdffile and putting result in tempfile
LibFunc>lib,GetPDFText,r,pdffile,1,tempfile

//Get text from tempfile
ReadFile>tempfile,thetext
MessageModal>thetext

//Delete tempfile
DeleteFile>tempfile
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Robbyn
Junior Coder
Posts: 43
Joined: Tue Feb 15, 2005 9:55 pm

Post by Robbyn » Tue Dec 27, 2005 7:05 pm

Thank you for that help. I will now proceed to get the rest of the macro to work.
Robin

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts