Closing File Objects on the Object Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User avatar
hasantr
Posts: 770
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Closing File Objects on the Object

Post by hasantr » 30 Nov 2020, 19:58

I'm very new to the file object. I have to ask a few funny questions.

With a Loop, I add file objects to the object in this way. Finally I close all of them using a loop again.

Code: Select all

FO[A_LoopField] := FileOpen(A_Temp . "\" . A_LoopField . ".Txt" ,"W","UTF-8")

Code: Select all

FO :=
Does the line close all open files? Or do I have to turn it off one by one?

Is this function required?

Code: Select all

FileClose()
FileClose(){
	Global FO
	For K,V in FO
		FO[K].Close()
	FO :=
}
If I quit the script instead of closing files. Will the files stay open in memory?

Thanks.

swagfag
Posts: 4126
Joined: 11 Jan 2017, 17:59

Re: Closing File Objects on the Object  Topic is solved

Post by swagfag » 01 Dec 2020, 05:49

its not needed, releasing the last reference to a FileObject closes it automatically

FO := is a syntax error though

Post Reply

Return to “Ask For Help”