Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


WordPerfect conversion to Word (finished script)

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,3374
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> WordPerfect conversion to Word (finished script)
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 WordPerfect conversion to Word (finished script) - 6/14/2005 7:40:53 AM   
  enderokc

 

Posts: 12
Score: 0
Joined: 6/9/2005
From:
Status: offline
Is it possible to convert a WordPerfect document to a Word Document?

I have a bunch of old wordperfect files that need to be converted to word, and I was hoping that there would be a script that could handle that. so any help would be greatly appreciated
 
 
Post #: 1
 
 Re: WordPerfect conversion to Word (finished script) - 6/14/2005 3:55:01 PM   
  TNO


Posts: 1061
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
Word has an inherent ability to open Wordperfect files and vice-versa. So you don't really need to automate a script to convert the files.

a quick pseudocode:

open Word application,

for each file in folder
open in word
save as Word document with same name
close word document
next

cleanup

(in reply to enderokc)
 
 
Post #: 2
 
 Re: WordPerfect conversion to Word (finished script) - 6/15/2005 3:04:07 AM   
  enderokc

 

Posts: 12
Score: 0
Joined: 6/9/2005
From:
Status: offline
yes I know that, but when its 50,000+ files its going to take a while :) also desktop search doesnt index wordperfect files so it makes it hard to find them. that is why I want to convert them all.

(in reply to enderokc)
 
 
Post #: 3
 
 Re: WordPerfect conversion to Word (finished script) - 6/15/2005 3:35:31 AM   
  rockocubs

 

Posts: 65
Score: 0
Joined: 4/8/2005
From:
Status: offline
The script to convert would be Easy. But the identification of the file's sound like the Hard Part. What file extension does wordperfect have?

(in reply to enderokc)
 
 
Post #: 4
 
 Re: WordPerfect conversion to Word (finished script) - 6/15/2005 3:37:54 AM   
  enderokc

 

Posts: 12
Score: 0
Joined: 6/9/2005
From:
Status: offline
well I renamed all the files to .doc's but when you open them they are still in a wordperfect format eventhough it opened in word. Word does have a batch conversion but it only works with one folder at a time. and there are a bunch of folders.

(in reply to enderokc)
 
 
Post #: 5
 
 Re: WordPerfect conversion to Word (finished script) - 6/15/2005 3:45:31 AM   
  rockocubs

 

Posts: 65
Score: 0
Joined: 4/8/2005
From:
Status: offline
Do the folders only contain these documents, or do they contain other documents as well? If so generating a text file with a list of the folders woud be a big help. If you used a script to rename the file's , that would have probally been the time to have the conversion done.

(in reply to enderokc)
 
 
Post #: 6
 
 Re: WordPerfect conversion to Word (finished script) - 6/15/2005 3:56:20 AM   
  enderokc

 

Posts: 12
Score: 0
Joined: 6/9/2005
From:
Status: offline
all I need is the syntax to do the conversion. I can run the script again and put that extra line of code in an be done with it. do you know it??

(in reply to enderokc)
 
 
Post #: 7
 
 Re: WordPerfect conversion to Word (finished script) - 6/15/2005 7:10:28 AM   
  enderokc

 

Posts: 12
Score: 0
Joined: 6/9/2005
From:
Status: offline
anybody??

(in reply to enderokc)
 
 
Post #: 8
 
 Re: WordPerfect conversion to Word (finished script) - 6/15/2005 7:51:44 AM   
  rockocubs

 

Posts: 65
Score: 0
Joined: 4/8/2005
From:
Status: offline
If you still have the word perfect document as .doc file and just want them in a word format the folwoing shoud do the trick, just pass the sub full path and file name.Change objWord.Visible to false if you dont want to see word.

Sub OpenDoc1(strLocation)

Const wdFormatDocument = 0
Const wdFormatTemplate = 0
Set objWord = CreateObject("Word.Application")
set objNewDoc = objWord.Documents.Add(strLocation,false)
objWord.Visible = true
objNewDoc.SaveAs strLocation, wdFormatDocument
Set objFile = Nothing
Set objFso = Nothing
objWord.Quit
End Sub

(in reply to enderokc)
 
 
Post #: 9
 
 Re: WordPerfect conversion to Word (finished script) - 6/16/2005 2:16:22 AM   
  enderokc

 

Posts: 12
Score: 0
Joined: 6/9/2005
From:
Status: offline
I would like to thank everyone that helped me out on this!! it works great!!! here is the finished script for anybody that wants to know. This script will go through all files and sub directories and save all the files in Word format no matter what the current format is.

'on error resume next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Const ForReading = 1
strFolderName = "C:\wordperfect_files"

Set colSubfolders = objWMIService.ExecQuery _
("Associators of {Win32_Directory.Name='" & strFolderName & "'} " _
& "Where AssocClass = Win32_Subdirectory " _
& "ResultRole = PartComponent")

Wscript.Echo strFolderName

arrFolderPath = Split(strFolderName, "\")
strNewPath = ""
For i = 1 to Ubound(arrFolderPath)
strNewPath = strNewPath & "\\" & arrFolderPath(i)
Next
strPath = strNewPath & "\\"

Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_DataFile where Path = '" & strPath & "'")

For Each objFile in colFiles

Set objWord = CreateObject("Word.Application")
set objNewDoc = objWord.Documents.Add(objfile.name,false)
objWord.Visible = false
objNewDoc.SaveAs objfile.name
Set objFile = Nothing
Set objFso = Nothing
objWord.Quit

Next


For Each objFolder in colSubfolders
GetSubFolders strFolderName
Next

Sub GetSubFolders(strFolderName)
Set colSubfolders2 = objWMIService.ExecQuery _
("Associators of {Win32_Directory.Name='" & strFolderName & "'} " _
& "Where AssocClass = Win32_Subdirectory " _
& "ResultRole = PartComponent")

For Each objFolder2 in colSubfolders2
strFolderName = objFolder2.Name
Wscript.Echo
Wscript.Echo objFolder2.Name
arrFolderPath = Split(strFolderName, "\")
strNewPath = ""
For i = 1 to Ubound(arrFolderPath)
strNewPath = strNewPath & "\\" & arrFolderPath(i)
Next
strPath = strNewPath & "\\"

Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_DataFile where Path = '" & strPath & "'")

For Each objFile in colFiles

Set objWord = CreateObject("Word.Application")
set objNewDoc = objWord.Documents.Add(objfile.name,false)
objWord.Visible = false
objNewDoc.SaveAs objfile.name
Set objFile = Nothing
Set objFso = Nothing
objWord.Quit

Next

GetSubFolders strFolderName
Next
End Sub

(in reply to enderokc)
 
 
Post #: 10
 
 Re: WordPerfect conversion to Word (finished script) - 6/16/2005 4:18:34 AM   
  rockocubs

 

Posts: 65
Score: 0
Joined: 4/8/2005
From:
Status: offline
Glad it worked and thanks for sharing finished product, there is stuff in there i can learn from.

(in reply to enderokc)
 
 
Post #: 11
 
 Re: WordPerfect conversion to Word (finished script) - 6/16/2005 5:31:12 AM   
  enderokc

 

Posts: 12
Score: 0
Joined: 6/9/2005
From:
Status: offline
yeah its a good one that can be used for other things too. thanks for the help Rock :)

(in reply to enderokc)
 
 
Post #: 12
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> WordPerfect conversion to Word (finished script) Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts