Trejuzz Posted July 26, 2014 Share Posted July 26, 2014 Hello, again I felt into trouble... 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") Link to comment Share on other sites More sharing options...
Developers Jos Posted July 26, 2014 Developers Share Posted July 26, 2014 (edited) So you think that when you open a file for read you can write to it? Maybe opening it for Write or Append works better. Edited July 26, 2014 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 More sharing options...
water Posted July 26, 2014 Share Posted July 26, 2014 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 Link to comment Share on other sites More sharing options...
water Posted July 26, 2014 Share Posted July 26, 2014 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 Link to comment Share on other sites More sharing options...
computergroove Posted July 26, 2014 Share Posted July 26, 2014 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 Link to comment Share on other sites More sharing options...
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