Jump to content

Recommended Posts

Posted

Hello, again I felt into trouble... :sweating:

I would like to ask, how can you read from .txt file or write to it in autoit? (something similar to fstream functions in c++). I tried to write somewhat of a code, but it isn't working, maybe I'm on the wrong path, I need some guidance ^.^

To save time, I would like to ask, if there is function that includes email options, for example send to email, in autoit?

#include <FileConstants.au3>
#include <MsgBoxConstants.au3>


Local Const $sFilePath = "C:\Users\Adolfas\Desktop\Prog\Autoit\result.txt"
Local $hFileOpen = FileOpen($sFilePath, $FO_READ)
FileWrite ($hFileOpen,"Hello")
Posted

Check example 2 of FileOpen in the help file. It explains how to read and write from a file at the same time.

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

 

Posted

 

To save time, I would like to ask, if there is function that includes email options, for example send to email, in autoit?

Depends on the mail client you want to use (Outlook, SMTP ...)?

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

 

Posted

Stripped down:

#include <FileConstants.au3>
#include <MsgBoxConstants.au3>


Example()


Func Example()
    ; Create a constant variable in Local scope of the filepath that will be read/written to.
    Local Const $sFilePath = "c:\LiqList.txt"


    ; Open the file for read/write access.
    Local $hFileOpen = FileOpen($sFilePath, $FO_READ + $FO_OVERWRITE)


    ; Write some data.
    FileWrite($hFileOpen, "Hello" & @CRLF)


    ; Close the handle returned by FileOpen.
    FileClose($hFileOpen)


EndFunc

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

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
  • Recently Browsing   0 members

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