Aliisonline 0 Posted November 18, 2010 I want to create a great many word documents based on names and dates and types. Simply i just need to know that how can i call strings which are mentioned either earlier or by collected by gui created with AUTOIT. FOR EXAMPLE Like in this script#Include <Misc.au3> #include <GUIConstants.au3> GUICreate( "Get date", 210,190) $document = 'Follow-Up' $Date = GUICtrlCreateMonthCal ("",10, 10) GUISetState() While 1 Sleep ( 50 ) If _IsPressed("01") Then #include <Word.au3> ;$calldate = GUICtrlRead($Date) $oWordApp = _WordCreate (@DesktopDir & "\Test.doc"); RIGHT HERE I WANT TO SEND THE STRING $Date and $document ;Run ('notepad.exe') ;WinWaitActive ("Untitled - Notepad") ;Send (GUICtrlRead($Date)) ExitLoop EndIf WEnd Share this post Link to post Share on other sites
UEZ 1,278 Posted November 18, 2010 Try this: expandcollapse popup#include <Word.au3> #include <ButtonConstants.au3> #include <DateTimeConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Test", 342, 133) $Label1 = GUICtrlCreateLabel("How many Word files should be created?", 8, 8, 198, 17) $Input1 = GUICtrlCreateInput("10", 208, 4, 121, 20) $Button1 = GUICtrlCreateButton("GO", 208, 72, 123, 49) $Label2 = GUICtrlCreateLabel("Ouput Path:", 8, 40, 61, 17) $Input2 = GUICtrlCreateInput(@ScriptDir, 72, 36, 257, 21) ;~ $Date1 = GUICtrlCreateDate("", 8, 88, 186, 21, $DTS_SHORTDATEFORMAT) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Create_Word(GUICtrlRead($Input1)) EndSwitch WEnd Func Create_Word($n) GUICtrlSetState($Button1, $GUI_DISABLE) Local $i, $path = GUICtrlRead($Input2) Local $filename For $i = 1 To $n $filename = $path & "\Test_" & @YEAR & @MON & @MDAY & "_" & @HOUR & @MIN & @SEC & ".doc" $oWordApp = _WordCreate ($path & $filename, 0, 0) If @error Then Return SetError(1, @extended, _WinAPI_ShowError("Unable to create Word doc!")) $oDoc = _WordDocGetCollection ($oWordApp, 0) $oDoc.Range.InsertAfter ($filename) _WordDocSave ($oDoc) _WordQuit ($oWordApp) Sleep(1000) Next GUICtrlSetState($Button1, $GUI_ENABLE) MsgBox(0, "Ready", "Done!", 10) Return SetError(0) EndFunc For me it is not working because Word.au3 seems to be not compatible with Word2010! Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Share this post Link to post Share on other sites
KaFu 295 Posted November 18, 2010 Just tested a little and found that if you're running on a 64bit machine having 32bit Office 2010 installed, Word needs to be open and running (winword32.exe process exist) and the script needs to be started as 32bit (#AutoIt3Wrapper_UseX64=n), then it works for me. OS: Win10-1909 - 64bit - German, AutoIt Version: 3.3.14.5, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2019-Dec-21) BIC - Batch-Image-Cropper (2019-Dec-11) COP - Color Picker (2009-May-21) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2019-Dec-07) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Share this post Link to post Share on other sites
UEZ 1,278 Posted November 18, 2010 Indeed, I'm using Win7 x64 but I'm using also Office2010 x64! And it is not working for me with #AutoIt3Wrapper_UseX64=n, compiled, nor when Word is running. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Share this post Link to post Share on other sites
passimage 0 Posted January 13, 2014 (edited) here are some word creating APIs i have been using to create work documents. check out: Public Function CreateEmptyDOCXDocumentDemo(pageCount As Integer) As DOCXDocument Return New DOCXDocument(pageCount) End Function while i was compliing word document creating codes, i want to add some processing method into it. so i can edit created word. any help would be appreciated. Edited January 13, 2014 by passimage Share this post Link to post Share on other sites
water 2,391 Posted January 13, 2014 Welcome to AutoIt and the forum! This thread is more than 3 years old. I suggest to create a new one. Now AutoIt comes with a new Word UDF. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites