Jump to content

Help me to continue my autoit script


Recommended Posts

On 2018-11-04 at 4:05 PM, Jos said:

So something like this?:

Global $Filename = ""
While $filename = ""
    $Filename=InputBox("new Document","Enter the new Document filename")
    If @error then
        ; Cancel pressed - Exit script
        Exit
    EndIf
WEnd
FileWrite($filename&".docx","")
ShellExecute("WinWord",$filename&".docx")

Jos

@Jos Thank you for the example! Works very well!

Thank everyone for helped me!

@Jos My last question is : 

How would you add a ”Send(”^S”) ”  to a line

after the ShellExecute?

Link to comment
Share on other sites

  • Developers

Asking this question means you are not understanding your own script so start with studying it and learn by trying. ;)

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Why don't you use the Word UDF that comes with AutoIt to create / modify Word documents?

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

 

Link to comment
Share on other sites

Simple example:

#include <Word.au3>

Global $sFilename = ""
While $sFilename = ""
    $sFilename = InputBox("New Document", "Enter the new Document filename")
    If @error Then Exit ; Cancel pressed - Exit script
WEnd

; Start up the Word application
Global $oWord = _Word_Create()

; Create a new word document
Global $oDoc = _Word_DocAdd($oWord)

; Insert some text in bold at the beginning
Local $oRange = _Word_DocRangeSet($oDoc, -1)
$oRange.Text = "Bold text at the beginning. "
$oRange.Bold = True

; Save the document to the script directory
_Word_DocSaveAs($oDoc, @ScriptDir & "\" & $sFilename & ".docx", $WdFormatDocumentDefault)

 

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

 

Link to comment
Share on other sites

29 minutes ago, water said:

Simple example:

#include <Word.au3>

Global $sFilename = ""
While $sFilename = ""
    $sFilename = InputBox("New Document", "Enter the new Document filename")
    If @error Then Exit ; Cancel pressed - Exit script
WEnd

; Start up the Word application
Global $oWord = _Word_Create()

; Create a new word document
Global $oDoc = _Word_DocAdd($oWord)

; Insert some text in bold at the beginning
Local $oRange = _Word_DocRangeSet($oDoc, -1)
$oRange.Text = "Bold text at the beginning. "
$oRange.Bold = True

; Save the document to the script directory
_Word_DocSaveAs($oDoc, @ScriptDir & "\" & $sFilename & ".docx", $WdFormatDocumentDefault)

 

@water Can the destination be the Documents folder? 

Link to comment
Share on other sites

12 minutes ago, FrancescoDiMuro said:

Putting some effort to see in the Help file the macro @DocumentsCommonDir...

@FrancescoDiMuro Hello!

I tested your suggestion and then realized it Wasnt what result I looked for so I searched on Google, then I found out @MyDocumentsDir and tested it. @MyDocumentsDir is the one that suits my needs best! 

 

 

Link to comment
Share on other sites

The help file provides a full list of all available macros: https://www.autoitscript.com/autoit3/docs/macros.htm

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

 

Link to comment
Share on other sites

Hello everyone!

I want to say thank you to everyone here for your help!

Help is worth gold!

Just signed in to let everyone here to know that my final product is done now, thanks to everyone here!

All your help has been worth GOLD for a AutoIt beginner like me!

My final product is now a icon on my desktop that asks me for a filename, creates a .docx  document with my input as the name and opens the newly created document in Word.

My final product is now also a backup folder :

https://drive.google.com/open?id=1OrqbAwK52upH8rqhrPYGh-Pb4Ytp3sws

Have a great day!

Myran1178

 

 

Edited by myran1178
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...