Okay, I just change the FileExist function and provide the full path to that file. An arbitrary path is C:\Users\Folder. And I noticed, when I run the task, the file is actually created in C:\Windows\System32.
Is the flow correct ?
-
- Posts: 136
- Joined: 06 May 2020, 17:16
Re: Is the flow correct ?
Re: Is the flow correct ?
The same applies wherever you refer to that file. Example is below.
Code: Select all
file := pathTo..\..\File.txt
If FileExist(file)
MsgBox, File Exists.
Else
{
MsgBox, File does not exist.
FileAppend, AUTOHOTKEY`n, %file%
Return
}
-
- Posts: 136
- Joined: 06 May 2020, 17:16
Re: Is the flow correct ?
The same problem occurs, whenever I run the program in a task in task scheduler, the file is now created not in the working directory which is C:\Users\Folder, but in C:\Windows\System32. I want the file to be created in the same folder as the program, so its in the same place.mikeyww wrote: ↑22 Feb 2021, 07:12The same applies wherever you refer to that file. Example is below.
Code: Select all
file := pathTo..\..\File.txt If FileExist(file) MsgBox, File Exists.
Re: Is the flow correct ?
You can use the following to refer to the script's directory.
Code: Select all
file = %A_ScriptDir%\File.txt