Finding the most updated excel file AHK

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
adir1591
Posts: 2
Joined: 18 May 2022, 01:07

Finding the most updated excel file AHK

Post by adir1591 » 18 May 2022, 01:23

Hey guys,
The idea i tried to do is to find the most updated excel file in a folder and to copy its route so i can use it later, but when i try to execute it, i get the following file name shows with ~$ signs added to it
this issue doesnt appear when i search other files like .pdf or anything else, if anyone can assist it would be greatly appreciated

the code is written in AHK :

Code: Select all

^1::
TP_Daily := "folder path"
run, %Daily%
Loop, %Daily%\*.*
{
	FileGetTime, Time, %A_LoopFileFullPath%, C
    		If (Time > Time_Orig)
    		{
        		Time_Orig := Time
			File := A_LoopFileName
		}
}
MsgBox, Newest file in %Daily% is %File%

Thanks for any idea that comes to mind
Attachments
~$.PNG
~$.PNG (5.24 KiB) Viewed 280 times

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Finding the most updated excel file AHK

Post by BoBo » 18 May 2022, 01:25

What AHK version are you using?

adir1591
Posts: 2
Joined: 18 May 2022, 01:07

Re: Finding the most updated excel file AHK

Post by adir1591 » 18 May 2022, 01:38

BoBo wrote:
18 May 2022, 01:25
What AHK version are you using?
Version 1.1.34.02

User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: Finding the most updated excel file AHK

Post by mikeyww » 18 May 2022, 05:41

I did not run the script, but Microsoft Office uses some files like that. You might need to exclude them.

Just a demonstration, different from your script:

Code: Select all

dir = %A_ScriptDir%\t
Loop, %dir%\*.*
{
 If (A_LoopFileName ~= "^~")            ; <=========
  Continue
 FileGetTime, time, %A_LoopFilePath%
 If (time > Time_Orig)
  Time_Orig := Time, File := A_LoopFileName
}
MsgBox, Newest file is %File%.

Post Reply

Return to “Ask for Help (v1)”