Kevitto Posted July 24, 2013 Share 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 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 24, 2013 Moderators Share 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! Link to comment Share on other sites More sharing options...
water Posted July 24, 2013 Share 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Kevitto Posted July 25, 2013 Author Share 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 Link to comment Share on other sites More sharing options...
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