Jump to content

Recommended Posts

Posted

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!

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
Posted

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

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
×
×
  • Create New...