When I use FileAppend via a hotkey to test it out, it works just fine (see PgDn). However, when I try to do the same thing inside of a function, it doesn't write to the file nor does it throw any kind of error (see PgUp). What's happening here and what can I do to fix this?
Code: Select all
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: A.N.Other <[email protected]>
;
; Script Function:
; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
LogFile = %A_ScriptDir%\Log.txt
FileDelete %LogFile%
FakeFunction(X, Y)
{
LogLine := X . ", " . Y
FileAppend, %LogLine%`n, %LogFile%
return True
}
PgUp::
if (FakeFunction(200,500))
{
MsgBox True
} else {
MsgBox False
}
return
PgDn::
X := 200
Y := 500
LogLine := X . ", " . Y
FileAppend, %LogLine%`n, %LogFile%
return
Del::
ExitApp
return