Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using Delphi3 with Wordperfect

Posted on 1998-05-27
5
Medium Priority
?
236 Views
Last Modified: 2010-04-06
How do I accomplish the following: Start Wordperfect8, open an existing document having bookmarks, insert some text into certain bookmarked fields from my Delphi3 paradox app, saveas another document name and then let the user take control of Wp to finish the document.
0
Comment
Question by:jfreisen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
ahalya earned 400 total points
ID: 1348145
i do this with WP7 & guess this shoud work with 8 as well.


Var WP : Variant;

begin
WP := CreateOleObject( 'WordPerfect.PerfectScript');
WP.FileOpen (YourFileName) ;
WP.BookmarkFind ('Introduction') ;
WP.KeyType ('typing some text at bookmark introduction') ;
WP.BookmarkFind ('theory') ;
WP.KeyType ('some more texty into the second bookmark') ;
WP.FileSave (NewFileName,  4 ) ;
end;

0
 

Author Comment

by:jfreisen
ID: 1348146
That worked great except how can I first check to see if WP is loaded and if it is use that instance else start it up. I get an error on the fileopen line if WP was already loaded.
0
 
LVL 7

Expert Comment

by:ahalya
ID: 1348147
i'm not sure why. normally if WP is already loaded then the CreateOLE function activates the already loaded instance (at least it does so in my machine).

i check the "Number of Open Documents" function and the "document blank" functions to see whether some other documents are open in WP or it is only my OLE doc. (at the end i do the following)

var i : intreger;
    b : boolean;

WP.FileClose;
i := WP.EnvNumberOpenDocuments;
b := WP.EnvDocBlank ;
if (i =1) and b then  //there is only one blank doc open !
    objWP.ExitWordPerfect;

0
 

Author Comment

by:jfreisen
ID: 1348148
Thanks, I will give that a try.  Where do I find a list of all the functions I can use in Delphi to control WP?
0
 
LVL 7

Expert Comment

by:ahalya
ID: 1348149
In Word perfect macro help you can find all the available commands and the variables. (wp variable ?DocBlank becomes EnvDocBlank in delphi).

You can get the complete syntax in WP help. (WP macro programming -since the introduction of PerfectScript- is essentially the same as OLE commands)
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question