Sign in to follow this  
Followers 0
MasonMill

open new text document

5 posts in this topic

Hi it seems very simple and just need pointed in the write direction in the help file to open a new text document, so i can Consolewrite i guess? I dont want to specify a file path if at all possible, thanks!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Easiest way is as follows

$file = FileOpen("file.txt", 33)

The 33 denotes a specific read/write mode. Look in the help file for which one is specific to you. (this will create the file if it doesn't exist btw)

Edited by DoubleMcLovin

Share this post


Link to post
Share on other sites

cool, thanks!

Share this post


Link to post
Share on other sites

If i want it to open a new text file when i push F1, why doesnt this work?

HotKeySet("{F1}", "NewTextFile")

While 1
     sleep(100)
WEnd

Func NewTextFile()
    $file = FileOpen("file.txt", 33)
    Local $var = "Test"

    If $file = -1 Then
        FileOpen("file.txt", 2)
        WinWaitActive("file.txt")
        sleep(500)
        ConsoleWrite("var=" & $var & @CRLF)
    EndIf
        
EndFunc

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

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
Sign in to follow this  
Followers 0