Jump to content
myran1178

Help me to continue my autoit script

Recommended Posts

myran1178
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?

Share this post


Link to post
Share on other sites
Jos

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

Jos

Edited by Jos
  • Thanks 1

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

Share this post


Link to post
Share on other sites
water

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 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
water

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 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
myran1178
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? 

Share this post


Link to post
Share on other sites
FrancescoDiMuro
2 minutes ago, myran1178 said:

Can the destination be the Documents folder? 

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

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
myran1178
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! 

 

 

Share this post


Link to post
Share on other sites
water

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 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
myran1178

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

Share this post


Link to post
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

×