Kevitto Posted July 24, 2013 Posted July 24, 2013 Hello, I have an issue with my current script and the answer alludes me! I have a script that reads from a Word file and puts all the content into an html document (generates tags and whatnot), but I cannot find a way to export/save/link to the images contained within the Word document. I was wondering if there was a way to do this. Also, same issue with the word comments. I can't pull those out either. I know VBS/VBA might have been a better tool, but I'm used to AutoIT and most of the script was written and working by the time people started inserting pictures and comments into their word documents! FYI, this is for a script that automatically takes a preformatted word document (containing a wiki-like solution for an internal knowledge base) and converts it into HTML. This was all done manually before, but I can't be bothered to read/copy 5,000+ documents by hand. Thank you, Kevitto
Moderators JLogan3o13 Posted July 24, 2013 Moderators Posted July 24, 2013 Hi, Kevitto. Are you using the built-in Word functions, or some other method? How about posting a reproducer to show what you're doing? Otherwise, we have to guess at what you're doing in your script, and then try to help you troubleshoot "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
water Posted July 24, 2013 Posted July 24, 2013 Check the new Word UDF that comes with the latest beta version of AutoIt. Function _Word_DocSaveAs allows to save a document as format $WdFormatHTML. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Kevitto Posted July 25, 2013 Author Posted July 25, 2013 (edited) Sorry, should have included at least part of the function. Here it is. I'm basically just opening the word file, reading every line and transposing it into a temp text file in a specific order and then the script makes it into an html page (not included). I basically can't get tables, images and comments. it only gets text. I know it's a bit messy, but I'm working with the knowledge I got Thanks! $files_array = _FileListToArrayEx($path, "*.doc", Default, "~*") $oWordApp = ObjCreate("Word.Application") $all_solutions = "" If(isArray($files_array)) Then For $i = 1 to UBound($files_array)-1 $oDoc = _WordDocOpen($oWordApp, $files_array[$i]) $oDoc.Range.WholeStory() $oDoc.Range.Copy $temp_file = FileOpen("C:\Output\temp.txt", 1) FileWrite($temp_file, ClipGet()) FileClose($temp_file) _WordDocClose($oDoc) _MakeSolution() Next _WordQuit($oWordApp) MsgBox(0,"Success","Loaded " & UBound($files_array)-1 & " word documents." & @CRLF & $all_solutions) ClipPut($all_solutions) Else Edited July 25, 2013 by Kevitto
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now