Aliisonline Posted November 18, 2010 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
UEZ Posted November 18, 2010 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
KaFu Posted November 18, 2010 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-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
UEZ Posted November 18, 2010 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
passimage Posted January 13, 2014 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
water Posted January 13, 2014 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 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
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