Link to home
Start Free TrialLog in
Avatar of weiroblpay
weiroblpayFlag for United States of America

asked on

WordPerfect won't save RTF format file to a Web Folder

I have a web application that uses documents in RTF format. It opens them in either MS Word or WordPerfect. I have no problems with Word, but WordPerfect will NOT allow me to save files with an RTF format to a web folder. Actually, it does a couple of weird things. It first says the file exists and asks if I want to overwrite it, but the file does NOT exist already. The 2nd thing it does is when I try to save it, the save seems to work, then it gives me the Access Denied error message and wants me to save it again.

Some details:  The web application is written in Java and is running on Apache/Tomcat on my laptop. The web folder is being watched by another small application so when a RTF file gets saved there, it grabs it and moves it to a folder where it can find it later (a reference to the path and filename is stored in a database, so the location is critical).
The application saves the document first (in a folder based on document name / date), then it sends it to WordPerfect to open. The file is opened from a temporary folder on the local computer, so when saving, I have to do Save As and navigate to my web folder. This is not a problem, it's just inherent in the design of the web application.

WordPerfect will save it if I save it in WPD format, but the application can't use WPD format. It has to use RTF (long explanation as to why, but there's a good reason we need to use RTF). There is no security on this web folder that should prevent access.
There's something else happening that I can't figure out.

Can anyone tell me why I keep getting an Access Denied error?  I wonder if it has something to do with the issue that the application is grabbing the file very soon after it's saved (about 10-50 milliseconds I think).

Thanks.
Ron
Avatar of moorhouselondon
moorhouselondon
Flag of United Kingdom of Great Britain and Northern Ireland image

1. Try getting WordPerfect to save it on the hard drive in RTF, then Close the file, then getting it to copy to the web folder: all using a Macro.  Otherwise get an External app to copy it to the Web Folder.

2. Check where your Document Backup directory is.  Force it to be on the local hard drive, in a folder separate from the ones used by the incoming document stream.  (This setting is in WordPerfect's Settings).

Avatar of weiroblpay

ASKER

Good suggestions!  Do you mean use a WordPerfect Macro?  I don't have a lot of experience with WP macros, but I can work one out that will do it I think. Can a Macro be put on the toolbar as a button for easy access?

I'll try this out and report back.

Thanks.
Yes, you can Record a WordPerfect Macro rather than starting off with a blank one and typing in the commands yourself.  Try to start off in a position that is well-defined.  For instance you have just loaded WordPerfect.

The Macro can indeed be put onto the toolbar.  Righ-click on the Toolbar, choose Edit, choose the Macro tab and there's a button there for Adding a Macro.  
I've tried doing a macro, but get an error. Please advise if I should make this a separate question. This sounds like a good idea, but I guess I could use some help getting a macro that works.

Note:  http://localHost:8085/cmsDocs/autoFile is defined as a web folder on my computer.

I get an error whenever it's run:
File @PFDesktop\:internet\...\autoFile/Declin.rtf cannot be moved or copied onto itself.

movePath var = "http://localhost:8085/cmsDocs/autoFile/"
myFile var = "Declin.rtf"  (name of current doc)
myPath var = "C:\UPC"


Macro:
1. Application (WordPerfect; "WordPerfect"; Default!; "EN")
2. Assign(myPath; "C:\UPC\")
3. Assign(movePath; "http://localhost:8085/cmsDocs/autoFile/")
4. Assign(myFile; ?Name)
5. FileSave (Filename: myPath + myFile; ExportType: RTF!)
6. close()
7. FileMove (myPath + myFile; movePath + myFile)


The error happens on the line:  FileMove (myPath + myFile; movePath + myFile)

I've tried using FileCopy with the same results.

The file does get copied successfully onn line 5 and WP closes it, but then line 7 blows up.
Any idea what's going wrong here?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of moorhouselondon
moorhouselondon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm using WP 11. I haven't added any patches for it since installing.
Visit www.corel.com to update WP, just to rule that out as the problem.
SOLUTION
Avatar of Kenneth Hobson
Kenneth Hobson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK, here's the macro with the changes ...

Application (WordPerfect; "WordPerfect"; Default!; "EN")
Assign(myPath; "C:\UPC\")
Assign(myFile; ?Name)
Assign(oldFile; myPath + myFile)
FileSave (Filename: myPath + myFile; ExportType: RTF!)
close()
wait(12)
//* create a mapped drive to the movePath
DLLCall Prototype WinExec("kernel32.dll";"WinExec";DWord!;{AnsiString(lpCmdLine);nCmdShow})
WinExec("subst m: http://localhost:8085/cmsDocs/autoFile/";0)
// copy file to m
FileMove (oldFile; "m:\")
wait(10)
winExec("subst m: /D";0)


The subst command does NOT recognize a web folder. It says it can't find it, so a drive M is never created.

So I'm back to why WP won't copy or move a file to a web folder. I'll get the latest service packs (I have WP 11, SP1 installed - I see that there is SP 2 and 3 too, so I'll try those and see what I get.)

Any other suggestions are welcome.

Thanks,

Ron
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Don't forget that WPD files work fine.  It is only RTF files that have a problem.
As an experiment: save to a WPD within your Macro.  Does this work?
WPD files may work, but with our application, it has to be RTF because the application can't deal with WPD or DOC files. It has to work with basic text format files to be more generic.

khobson:  The web folder is already set up on the computer, but it is in the http://... format. I can't create a mapped drive manually with a web folder. That would have been a good solution, but Windows won't let me. I guess that's why the macro can't handle it.

I can build a program that will take a file and can copy it to the web folder, but we were hoping to avoid needing to install any programs on the client computers. That was one of the reasons we designed a web application. I think it's goofy that WordPerfect won't save to a web folder, but MS Word has no problem with it.

Do you know if a more current version (WP 12 or 13) would work?  I'm getting ver. 12 later this week. I guess I'll try it and see.
I really appreciate your help. This has been a nightmare.

Any more ideas would be appreciated.

Thanks,

Ron
From the looks of it to me, you are not able to use PerfectScript commands to copy any file to a web folder with an http path.

The problem is that the PerfectScript commands were designed for the UNC or standard paths for saving.  Try a copy from a DOS prompt.  If that works, you can use AppExecute() to do the job.  If you know of a DLL command that does it, you can use PerfectScript to do the DLL command by DLLCALL().

You say MSWord can do this?  Do you have example vba code?
>WPD files may work, but with our application, it has to be RTF because the application can't deal with WPD or DOC files. It has to work with basic text format files to be more generic.

I mentioned "As an experiment".  It would be helpful to see if the macro works using WPD.  Whether or not it works may help identify a way round this problem.
I can't save it using a DOS prompt either. When I use copy, I get an error that http: is not a recognized device. If I use xcopy, it asks if http://.... is a directory or a file. If I respond directory, it creates a directory called http:.... under the source folder and copies it there. If I respond it's a file, it gives me an error saying Invalid path.
So it looks like the copy won't work in any case.

When I save the same file using MS Word, I don't need any VBA, I just use the file save dialog and select the web folder under My Network Places. I can do the same thing in WordPerfect, but it gives me an error saying Access Denied.

The macro doesn't work using WPD and it also doesn't work directly from WordPerfect using the File Save dialog and selecting the web folder under My Network Places.

I'm going to try WP 12 and see what happens, but it doesn't look like WP supports saving to a web folder.

I've searched all over the web trying to find answers to this and can't get it. Even Corel's website has no reference to this issue that I can find.

Anyway, any more thoughts are appreciated.

Thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for all your help. I used an updated version of WordPerfect and it resolved most of the problems.

It stil does one weird thing - it saves the document OK, but gives me an Access denied message AFTER saving it.  
I think that is because when I do a Save AS it tries to open it up again from where it was saved.

The problem is that our application is sweeping the saved directory and moving it to a location on the server that it stores all documents in, so when WP tries to open it in the just saved location, it gets an error saying Access denied - not sure why.

Anyway, I think with the suggestions you gave I'll be able to finally solve it, so I'm awarding points to both of you who gave good suggestions.

Thanks,

Ron