ajit Posted February 17, 2010 Share Posted February 17, 2010 HI: I want to have Msword open a document in MY GUI. I searched the forum without any sucess. Could someone help me do it or guide me to a link, or share a script they have. Thanking in anticipation. Regards Ajit Link to comment Share on other sites More sharing options...
jchd Posted February 17, 2010 Share Posted February 17, 2010 Why not open the Word document, grab the contents as RTF and paste it into a RichEdit control? Should be very close. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
ajit Posted February 17, 2010 Author Share Posted February 17, 2010 (edited) @jchd Thanks very much for your quick reply. I would want to use modify, save, and SaveAs in my GUI and also get word tools in my GUI. I am unsure whether Richedit would allow that. I am not very sure I have understood you properly either. I was thinking of something like ObjCreate. Thanks again. Ajit Edited February 17, 2010 by ajit Link to comment Share on other sites More sharing options...
jchd Posted February 17, 2010 Share Posted February 17, 2010 I would want to use modify, save, and SaveAs in my GUIThat I believe isn't very difficult with the available GUI machinery. and also get word tools in my GUI. I am unsure whether Richedit would allow that.I hardly see an instance of Word cope with any homebrew GUI, yours or mine. It needs to handle its own controls, which you can't implement yourself.I seem to recall that MS Office is also special in the way some (all?) controls are made. But this is possibly outdated knowledge. Just tried Au3Info: not that much success in finding standard stuff in a Word window.I was thinking of something like ObjCreate.That creates a Word instance (visible or not) with all bells and whistles but not in your garden. You might be able to fake it: cut down a child transparent window in your GUI and arrange to place it modal over the Word frame + toolbars & menus ... But I can't imagine Word acting with/on your own controls. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
ajit Posted February 17, 2010 Author Share Posted February 17, 2010 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Test Webbrowser", 400,300,400,300, _ BitOr($GUI_SS_DEFAULT_GUI, $WS_SYSMENU ,$WS_SIZEBOX, $WS_MAXIMIZEBOX), $WS_EX_COMPOSITED) $Obj = ObjCreate("Shell.Explorer.2") $browser = GUICtrlCreateObj($Obj, 0, 0, 400, 300) GUICtrlSetResizing ( -1, $GUI_DOCKRIGHT ) $wordfile = FileOpenDialog("Select MSword File", @DesktopDir & "\", "Docs (*.doc;*.dot)", 1 ) $Obj.Navigate($wordfile) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Exit @jchd Thanks for your help. I have a code using objectcreate but it does not seem to be working fine. I do not know whether it is the correct way of getting a word document in a GUI. Furthermore it is not at all stable flickering all the time although the document can be modified. Thanks in advance. Ajit Link to comment Share on other sites More sharing options...
XKahn Posted February 17, 2010 Share Posted February 17, 2010 The problem lies inside your case statement. Your loop is just waiting for you to close the GUI. You should study the example given under Examples - GUI - Advanced called "menu.au3" see section posted below: While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton ExitLoop ;You need a statement like this Case $msg = $fileitem $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)") If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu) ;This is where the actual loading should be done Case $msg = $exititem ExitLoop Case $msg = $okbutton MsgBox(0, "Click", "You clicked OK!") Case $msg = $aboutitem MsgBox(0, "About", "GUI Menu Test") EndSelect WEnd You should look in help and try using; #include <Word.au3> _WordDocOpen ( ByRef $o_object , $s_FilePath [, $b_ConfirmConversions = 0 [, $i_Format = 0 [, $b_ReadOnly = 0 [, $b_Revert = 0 [, $b_AddToRecentFiles = 0 [, $s_PasswordDocument = "" [, $s_WritePasswordDocument = ""]]]]]]] ) Link to comment Share on other sites More sharing options...
ajit Posted February 17, 2010 Author Share Posted February 17, 2010 (edited) @XKahn Thanks for your help. I will work on those lines. Thanks again. Ajit Edited February 17, 2010 by ajit 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