How do I monitor a specific file in a directory? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
J0RDAN
Posts: 17
Joined: 02 Nov 2022, 17:29

How do I monitor a specific file in a directory?

Post by J0RDAN » 28 Mar 2023, 18:42

viewtopic.php?t=76244
teadrinker's code does what I'm trying to go for, however, it monitors the entire directory. I want to store a frequently updated list in a directory with other files that also frequently change, but I only want it to monitor the list.

So say I have G:\. Inside of G:\ I have List1.txt and List2. I only want the script to trigger when List1.txt gets changed and not when List2.txt changes. How would I go about that?


J0RDAN
Posts: 17
Joined: 02 Nov 2022, 17:29

Re: How do I monitor a specific file in a directory?

Post by J0RDAN » 28 Mar 2023, 20:44

boiler wrote:
28 Mar 2023, 20:32
Check out WatchFolder().
How would I go about implementing this in my own script? I want my script to reload every time it detects a change in List1.txt and ignore all other files in said directory.

User avatar
flyingDman
Posts: 2776
Joined: 29 Sep 2013, 19:01

Re: How do I monitor a specific file in a directory?

Post by flyingDman » 28 Mar 2023, 21:21

If Watchfolder is overkill for 1 file, you can use this:

Code: Select all

settimer, lbl, 5000							; checks every 5 seconds

lbl:
FileGetTime, tmstmp, %A_ScriptDir%\List1.txt
if (oldtmstmp != tmstmp AND flag)
	Msgbox The file has changed!
oldtmstmp := tmstmp, flag := 1
return
14.3 & 1.3.7

User avatar
boiler
Posts: 16706
Joined: 21 Dec 2014, 02:44

Re: How do I monitor a specific file in a directory?

Post by boiler » 28 Mar 2023, 21:35

Using WatchFolder:

Code: Select all

#Persistent
#Include WatchFolder.ahk
WatchFolder("G:\", "FileChanged",, 16) ; FILE_NOTIFY_CHANGE_LAST_WRITE = 16
return

FileChanged(folder, changes) {
	for each, change in changes
		if InStr(change.Name, "\List1.txt")
			Reload
}

J0RDAN
Posts: 17
Joined: 02 Nov 2022, 17:29

Re: How do I monitor a specific file in a directory?

Post by J0RDAN » 29 Mar 2023, 14:16

flyingDman wrote:
28 Mar 2023, 21:21
If Watchfolder is overkill for 1 file, you can use this:

Code: Select all

settimer, lbl, 5000							; checks every 5 seconds

lbl:
FileGetTime, tmstmp, %A_ScriptDir%\List1.txt
if (oldtmstmp != tmstmp AND flag)
	Msgbox The file has changed!
oldtmstmp := tmstmp, flag := 1
return
This is the approach I'd like to go with. However, I'm getting 2 errors:

Warning: This variable has not been assigned a value.

Specifically: flag (a global variable)

Warning: This variable has not been assigned a value.

Specifically: oldtmstmp (a global variable)

Those are the errors I get when I put your code near the top of the script, and when I put it near the bottom it just doesn't do anything.

Here's the entire script without your code, where should I be placing it/what am I doing wrong? Sorry if I'm being/sounding dumb, I'm not skilled at this.

Code: Select all

settimer,updatedscript,500

#maxthreadsperhotkey 999999999
#noenv
#persistent
#singleinstance force
#warn
sendmode input
setworkingdir %a_scriptdir%

fileread, contents, g:\List1.txt
if not errorlevel
{
sort, contents
filedelete, g:\List1.txt
fileappend, %contents%, g:\List1.txt
contents := ""
}

sleep 300

fileread, outputvar, g:\List1.txt
sort, outputvar, u
filedelete, g:\List1.txt
sleep 300
fileappend, %outputvar%,g:\List1.txt

menu, tray, add , Pause, pause
menu, tray, add , Exit, exit
menu, tray, icon , AutoCorrect.ico,, 1
menu, tray, nostandard
menu, tray, tip, AutoCorrect
return

pause:
suspend, toggle
if (a_issuspended)
menu, tray, icon , AutoCorrect pause.ico
else
menu, tray, icon , AutoCorrect.ico
return
exit:
exitapp

#p::
suspend, toggle
if (a_issuspended)
menu, tray, icon , AutoCorrect pause.ico
else
menu, tray, icon , AutoCorrect.ico
return

#a::
autotrim on
clipboardold = %clipboardall%
clipboard =
send ^c
clipwait 1
if errorlevel
return
stringreplace, hotstring, clipboard, ``, ````, all
stringreplace, hotstring, hotstring, `r`n, ``r, all
stringreplace, hotstring, hotstring, `n, ``r, all
stringreplace, hotstring, hotstring, %a_tab%, ``t, all
stringreplace, hotstring, hotstring, `;, ```;, all
clipboard = %clipboardold%
inputbox, hotstring, AutoCorrect, Automatic entry,,,,,,,, :*:%hotstring%::
if errorlevel <> 0
return
fileappend, `n%hotstring%, g:\List1.txt
reload

#m::
autotrim on
clipboardold = %clipboardall%
clipboard =
send ^c
clipwait 1
if errorlevel
return
stringreplace, hotstring, clipboard, ``, ````, all
stringreplace, hotstring, hotstring, `r`n, ``r, all
stringreplace, hotstring, hotstring, `n, ``r, all
stringreplace, hotstring, hotstring, %a_tab%, ``t, all
stringreplace, hotstring, hotstring, `;, ```;, all
clipboard = %clipboardold%
inputbox, hotstring, AutoCorrect, Manual entry,,,,,,,, ::%hotstring%::
if errorlevel <> 0
return
fileappend, `n%hotstring%, g:\List1.txt
reload

#/::
autotrim on
clipboardold = %clipboardall%
clipboard =
send ^c
clipwait 1
if errorlevel
return
stringreplace, hotstring, clipboard, ``, ````, all
stringreplace, hotstring, hotstring, `r`n, ``r, all
stringreplace, hotstring, hotstring, `n, ``r, all
stringreplace, hotstring, hotstring, %a_tab%, ``t, all
stringreplace, hotstring, hotstring, `;, ```;, all
clipboard = %clipboardold%
inputbox, hotstring, AutoCorrect, Mid text manual entry,,,,,,,, :?:%hotstring%::
if errorlevel <> 0
return
fileappend, `n%hotstring%, g:\List1.txt
reload

#include g:\List1.txt

updatedscript:
filegetattrib,attribs,%a_scriptfullpath%
ifinstring,attribs,a
{
filesetattrib,-a,%a_scriptfullpath%
sleep,500
reload
}
return
boiler wrote: Using WatchFolder:

Code: Select all

#Persistent
#Include WatchFolder.ahk
WatchFolder("G:\", "FileChanged",, 16) ; FILE_NOTIFY_CHANGE_LAST_WRITE = 16
return

FileChanged(folder, changes) {
	for each, change in changes
		if InStr(change.Name, "\List1.txt")
			Reload
}
This is the method I'll fall back on if I can't get the other one to work, cheers mate and stay tuned.

User avatar
boiler
Posts: 16706
Joined: 21 Dec 2014, 02:44

Re: How do I monitor a specific file in a directory?

Post by boiler » 29 Mar 2023, 14:31

J0RDAN wrote: This is the approach I'd like to go with. However, I'm getting 2 errors:

Warning: This variable has not been assigned a value.

Specifically: flag (a global variable)

Warning: This variable has not been assigned a value.

Specifically: oldtmstmp (a global variable)
Those are not errors, they are just warnings because you have #warn at the top of your script, and flyingDman is aware that they are not previously assigned a value and it is not a problem with his code. You can either leave the #warn directive in your script in case you want it to warn you for other parts of your script and ignore these two particular warnings, or you can remove #warn from the script. Or you could leave the #warn line in place and put these lines at the top of your script:

Code: Select all

flag := ""
oldtmstmp := ""

J0RDAN
Posts: 17
Joined: 02 Nov 2022, 17:29

Re: How do I monitor a specific file in a directory?

Post by J0RDAN » 29 Mar 2023, 14:52

boiler wrote:
29 Mar 2023, 14:31
J0RDAN wrote: This is the approach I'd like to go with. However, I'm getting 2 errors:

Warning: This variable has not been assigned a value.

Specifically: flag (a global variable)

Warning: This variable has not been assigned a value.

Specifically: oldtmstmp (a global variable)
Those are not errors, they are just warnings because you have #warn at the top of your script, and flyingDman is aware that they are not previously assigned a value and it is not a problem with his code. You can either leave the #warn directive in your script in case you want it to warn you for other parts of your script and ignore these two particular warnings, or you can remove #warn from the script. Or you could leave the #warn line in place and put these lines at the top of your script:

Code: Select all

flag := ""
oldtmstmp := ""
I see. If they're not assigned a value, what is the purpose? Also I just realized I phrased my last reply bad and should've just said it doesn't work. Putting his code at the top of the script only gets it to generate those messages from #Warn, the functionality is still missing. I just was eager to include what I thought were "error" messages because it would get me closer to solving why it didn't work.

User avatar
boiler
Posts: 16706
Joined: 21 Dec 2014, 02:44

Re: How do I monitor a specific file in a directory?  Topic is solved

Post by boiler » 29 Mar 2023, 15:16

J0RDAN wrote: I see. If they're not assigned a value, what is the purpose?
It's not that they're never assigned a value. You can see in the code that they are eventually assigned a value. It's just that they haven't already been assigned a value before the first time their contents are used. It's not a problem in this case because their un-initialized value, which is null, is fine.

J0RDAN wrote: Also I just realized I phrased my last reply bad and should've just said it doesn't work. Putting his code at the top of the script only gets it to generate those messages from #Warn, the functionality is still missing. I just was eager to include what I thought were "error" messages because it would get me closer to solving why it didn't work.
You can't just put it all at the top or all at the bottom. You need the part that needs to be executed at the start of the script in the top section (auto-execute section) and the labled subroutine lbl: below the auto-execute section, like this:

Code: Select all

settimer,updatedscript,500

#maxthreadsperhotkey 999999999
#noenv
#persistent
#singleinstance force
#warn
sendmode input
setworkingdir %a_scriptdir%

fileread, contents, g:\List1.txt
if not errorlevel
{
sort, contents
filedelete, g:\List1.txt
fileappend, %contents%, g:\List1.txt
contents := ""
}

sleep 300

fileread, outputvar, g:\List1.txt
sort, outputvar, u
filedelete, g:\List1.txt
sleep 300
fileappend, %outputvar%,g:\List1.txt

menu, tray, add , Pause, pause
menu, tray, add , Exit, exit
menu, tray, icon , AutoCorrect.ico,, 1
menu, tray, nostandard
menu, tray, tip, AutoCorrect

settimer, lbl, 5000	
return

lbl:
FileGetTime, tmstmp, %A_ScriptDir%\List1.txt
if (oldtmstmp != tmstmp AND flag)
	Msgbox The file has changed!
oldtmstmp := tmstmp, flag := 1
return

pause:
suspend, toggle
if (a_issuspended)
menu, tray, icon , AutoCorrect pause.ico
else
menu, tray, icon , AutoCorrect.ico
return
exit:
exitapp

#p::
suspend, toggle
if (a_issuspended)
menu, tray, icon , AutoCorrect pause.ico
else
menu, tray, icon , AutoCorrect.ico
return

#a::
autotrim on
clipboardold = %clipboardall%
clipboard =
send ^c
clipwait 1
if errorlevel
return
stringreplace, hotstring, clipboard, ``, ````, all
stringreplace, hotstring, hotstring, `r`n, ``r, all
stringreplace, hotstring, hotstring, `n, ``r, all
stringreplace, hotstring, hotstring, %a_tab%, ``t, all
stringreplace, hotstring, hotstring, `;, ```;, all
clipboard = %clipboardold%
inputbox, hotstring, AutoCorrect, Automatic entry,,,,,,,, :*:%hotstring%::
if errorlevel <> 0
return
fileappend, `n%hotstring%, g:\List1.txt
reload

#m::
autotrim on
clipboardold = %clipboardall%
clipboard =
send ^c
clipwait 1
if errorlevel
return
stringreplace, hotstring, clipboard, ``, ````, all
stringreplace, hotstring, hotstring, `r`n, ``r, all
stringreplace, hotstring, hotstring, `n, ``r, all
stringreplace, hotstring, hotstring, %a_tab%, ``t, all
stringreplace, hotstring, hotstring, `;, ```;, all
clipboard = %clipboardold%
inputbox, hotstring, AutoCorrect, Manual entry,,,,,,,, ::%hotstring%::
if errorlevel <> 0
return
fileappend, `n%hotstring%, g:\List1.txt
reload

#/::
autotrim on
clipboardold = %clipboardall%
clipboard =
send ^c
clipwait 1
if errorlevel
return
stringreplace, hotstring, clipboard, ``, ````, all
stringreplace, hotstring, hotstring, `r`n, ``r, all
stringreplace, hotstring, hotstring, `n, ``r, all
stringreplace, hotstring, hotstring, %a_tab%, ``t, all
stringreplace, hotstring, hotstring, `;, ```;, all
clipboard = %clipboardold%
inputbox, hotstring, AutoCorrect, Mid text manual entry,,,,,,,, :?:%hotstring%::
if errorlevel <> 0
return
fileappend, `n%hotstring%, g:\List1.txt
reload

#include g:\List1.txt

updatedscript:
filegetattrib,attribs,%a_scriptfullpath%
ifinstring,attribs,a
{
filesetattrib,-a,%a_scriptfullpath%
sleep,500
reload
}
return

User avatar
flyingDman
Posts: 2776
Joined: 29 Sep 2013, 19:01

Re: How do I monitor a specific file in a directory?

Post by flyingDman » 29 Mar 2023, 15:19

Also add #Persisent at the top of your script (my bad)

Code: Select all

#Requires AutoHotkey v1.1.33
#Persistent
#Warn

flag := ""
oldtmstmp := ""
settimer, lbl, 5000

lbl:
FileGetTime, tmstmp, %A_ScriptDir%\List1.txt
if (oldtmstmp != tmstmp AND flag)
	Msgbox The file has changed!
oldtmstmp := tmstmp, flag := 1
return
edit: did not see @boiler 's response
14.3 & 1.3.7

J0RDAN
Posts: 17
Joined: 02 Nov 2022, 17:29

Re: How do I monitor a specific file in a directory?

Post by J0RDAN » 29 Mar 2023, 17:05

Code: Select all

settimer,updatedscript,500

#maxthreadsperhotkey 999999999
#noenv
#persistent
#singleinstance force
#warn
sendmode input
setworkingdir %a_scriptdir%

fileread, contents, g:\List1.txt
if not errorlevel
{
sort, contents
filedelete, g:\List1.txt
fileappend, %contents%, g:\List1.txt
contents := ""
}

sleep 300

fileread, outputvar, g:\List1.txt
sort, outputvar, u
filedelete, g:\List1.txt
sleep 300
fileappend, %outputvar%,g:\List1.txt

menu, tray, add , Pause, pause
menu, tray, add , Exit, exit
menu, tray, icon , AutoCorrect.ico,, 1
menu, tray, nostandard
menu, tray, tip, AutoCorrect

settimer, lbl, 5000	
return

lbl:
FileGetTime, tmstmp, %A_ScriptDir%\List1.txt
if (oldtmstmp != tmstmp AND flag)
	Msgbox The file has changed!
oldtmstmp := tmstmp, flag := 1
return

pause:
suspend, toggle
if (a_issuspended)
menu, tray, icon , AutoCorrect pause.ico
else
menu, tray, icon , AutoCorrect.ico
return
exit:
exitapp

#p::
suspend, toggle
if (a_issuspended)
menu, tray, icon , AutoCorrect pause.ico
else
menu, tray, icon , AutoCorrect.ico
return

#a::
autotrim on
clipboardold = %clipboardall%
clipboard =
send ^c
clipwait 1
if errorlevel
return
stringreplace, hotstring, clipboard, ``, ````, all
stringreplace, hotstring, hotstring, `r`n, ``r, all
stringreplace, hotstring, hotstring, `n, ``r, all
stringreplace, hotstring, hotstring, %a_tab%, ``t, all
stringreplace, hotstring, hotstring, `;, ```;, all
clipboard = %clipboardold%
inputbox, hotstring, AutoCorrect, Automatic entry,,,,,,,, :*:%hotstring%::
if errorlevel <> 0
return
fileappend, `n%hotstring%, g:\List1.txt
reload

#m::
autotrim on
clipboardold = %clipboardall%
clipboard =
send ^c
clipwait 1
if errorlevel
return
stringreplace, hotstring, clipboard, ``, ````, all
stringreplace, hotstring, hotstring, `r`n, ``r, all
stringreplace, hotstring, hotstring, `n, ``r, all
stringreplace, hotstring, hotstring, %a_tab%, ``t, all
stringreplace, hotstring, hotstring, `;, ```;, all
clipboard = %clipboardold%
inputbox, hotstring, AutoCorrect, Manual entry,,,,,,,, ::%hotstring%::
if errorlevel <> 0
return
fileappend, `n%hotstring%, g:\List1.txt
reload

#/::
autotrim on
clipboardold = %clipboardall%
clipboard =
send ^c
clipwait 1
if errorlevel
return
stringreplace, hotstring, clipboard, ``, ````, all
stringreplace, hotstring, hotstring, `r`n, ``r, all
stringreplace, hotstring, hotstring, `n, ``r, all
stringreplace, hotstring, hotstring, %a_tab%, ``t, all
stringreplace, hotstring, hotstring, `;, ```;, all
clipboard = %clipboardold%
inputbox, hotstring, AutoCorrect, Mid text manual entry,,,,,,,, :?:%hotstring%::
if errorlevel <> 0
return
fileappend, `n%hotstring%, g:\List1.txt
reload

#include g:\List1.txt

updatedscript:
filegetattrib,attribs,%a_scriptfullpath%
ifinstring,attribs,a
{
filesetattrib,-a,%a_scriptfullpath%
sleep,500
reload
}
return
Downloaded this and the message box still isn't popping up.

@flyingDman I am using AHK v1.1.36.02, does that mean it won't work?

User avatar
boiler
Posts: 16706
Joined: 21 Dec 2014, 02:44

Re: How do I monitor a specific file in a directory?

Post by boiler » 29 Mar 2023, 17:08

J0RDAN wrote: I am using AHK v1.1.36.02, does that mean it won't work?
That allows any version shown or later to be used, up to the next major version. So you can use anything from that version up to but not including 2.0.

J0RDAN
Posts: 17
Joined: 02 Nov 2022, 17:29

Re: How do I monitor a specific file in a directory?

Post by J0RDAN » 29 Mar 2023, 17:39

Hm, I see. Well, do you have any ideas as to why it's not working then? Like I said I downloaded the version from your post and I haven't seen it trigger any message boxes.

User avatar
boiler
Posts: 16706
Joined: 21 Dec 2014, 02:44

Re: How do I monitor a specific file in a directory?

Post by boiler » 29 Mar 2023, 17:59

You ran the exact the script I posted and nothing else in that script (with WatchFolder.ahk as a separate file in the same folder as your script)? And then you manually changed the List1.txt file and saved it and it didn't show a MsgBox?

J0RDAN
Posts: 17
Joined: 02 Nov 2022, 17:29

Re: How do I monitor a specific file in a directory?

Post by J0RDAN » 29 Mar 2023, 19:30

boiler wrote:
29 Mar 2023, 17:59
You ran the exact the script I posted and nothing else in that script (with WatchFolder.ahk as a separate file in the same folder as your script)? And then you manually changed the List1.txt file and saved it and it didn't show a MsgBox?
Pretty much. I didn't get the original WatchFolder.ahk if that's what you're talking about, I simply have the exact script you posted, this one;

Code: Select all

settimer,updatedscript,500

#maxthreadsperhotkey 999999999
#noenv
#persistent
#singleinstance force
#warn
sendmode input
setworkingdir %a_scriptdir%

fileread, contents, g:\List1.txt
if not errorlevel
{
sort, contents
filedelete, g:\List1.txt
fileappend, %contents%, g:\List1.txt
contents := ""
}

sleep 300

fileread, outputvar, g:\List1.txt
sort, outputvar, u
filedelete, g:\List1.txt
sleep 300
fileappend, %outputvar%,g:\List1.txt

menu, tray, add , Pause, pause
menu, tray, add , Exit, exit
menu, tray, icon , AutoCorrect.ico,, 1
menu, tray, nostandard
menu, tray, tip, AutoCorrect

settimer, lbl, 5000	
return

lbl:
FileGetTime, tmstmp, %A_ScriptDir%\List1.txt
if (oldtmstmp != tmstmp AND flag)
	Msgbox The file has changed!
oldtmstmp := tmstmp, flag := 1
return

pause:
suspend, toggle
if (a_issuspended)
menu, tray, icon , AutoCorrect pause.ico
else
menu, tray, icon , AutoCorrect.ico
return
exit:
exitapp

#p::
suspend, toggle
if (a_issuspended)
menu, tray, icon , AutoCorrect pause.ico
else
menu, tray, icon , AutoCorrect.ico
return

#a::
autotrim on
clipboardold = %clipboardall%
clipboard =
send ^c
clipwait 1
if errorlevel
return
stringreplace, hotstring, clipboard, ``, ````, all
stringreplace, hotstring, hotstring, `r`n, ``r, all
stringreplace, hotstring, hotstring, `n, ``r, all
stringreplace, hotstring, hotstring, %a_tab%, ``t, all
stringreplace, hotstring, hotstring, `;, ```;, all
clipboard = %clipboardold%
inputbox, hotstring, AutoCorrect, Automatic entry,,,,,,,, :*:%hotstring%::
if errorlevel <> 0
return
fileappend, `n%hotstring%, g:\List1.txt
reload

#m::
autotrim on
clipboardold = %clipboardall%
clipboard =
send ^c
clipwait 1
if errorlevel
return
stringreplace, hotstring, clipboard, ``, ````, all
stringreplace, hotstring, hotstring, `r`n, ``r, all
stringreplace, hotstring, hotstring, `n, ``r, all
stringreplace, hotstring, hotstring, %a_tab%, ``t, all
stringreplace, hotstring, hotstring, `;, ```;, all
clipboard = %clipboardold%
inputbox, hotstring, AutoCorrect, Manual entry,,,,,,,, ::%hotstring%::
if errorlevel <> 0
return
fileappend, `n%hotstring%, g:\List1.txt
reload

#/::
autotrim on
clipboardold = %clipboardall%
clipboard =
send ^c
clipwait 1
if errorlevel
return
stringreplace, hotstring, clipboard, ``, ````, all
stringreplace, hotstring, hotstring, `r`n, ``r, all
stringreplace, hotstring, hotstring, `n, ``r, all
stringreplace, hotstring, hotstring, %a_tab%, ``t, all
stringreplace, hotstring, hotstring, `;, ```;, all
clipboard = %clipboardold%
inputbox, hotstring, AutoCorrect, Mid text manual entry,,,,,,,, :?:%hotstring%::
if errorlevel <> 0
return
fileappend, `n%hotstring%, g:\List1.txt
reload

#include g:\List1.txt

updatedscript:
filegetattrib,attribs,%a_scriptfullpath%
ifinstring,attribs,a
{
filesetattrib,-a,%a_scriptfullpath%
sleep,500
reload
}
return
(Named Untitled.ahk in the screenshot) and nothing else but the scripts icons in the same folder. I manually edited List1.txt, which is in the G:\ directory with other random files, with Notepad++ and saved, yet no MsgBox appeared.
Image
Untitled.ahk and it's other files pictured in the screenshot are in a folder on the Desktop.

User avatar
boiler
Posts: 16706
Joined: 21 Dec 2014, 02:44

Re: How do I monitor a specific file in a directory?

Post by boiler » 29 Mar 2023, 19:43

That’s not what I meant. I meant the WatchFolder-based script. I only showed you how to add flyingDman’s script to what you had. Make sure you know how to get either flyingDman’s original script or the one I posted to work before trying to incorporate it into your larger script.

J0RDAN
Posts: 17
Joined: 02 Nov 2022, 17:29

Re: How do I monitor a specific file in a directory?

Post by J0RDAN » 30 Mar 2023, 14:30

boiler wrote:
29 Mar 2023, 19:43
That’s not what I meant. I meant the WatchFolder-based script. I only showed you how to add flyingDman’s script to what you had. Make sure you know how to get either flyingDman’s original script or the one I posted to work before trying to incorporate it into your larger script.
Oh, my mistake. I've only been working with flyingDman's script this entire time which I can't seem to make work. Even the version you posted where you took the code I posted and flyingDman's code and combined them doesn't show a MsgBox. Does it work on your system? I'm running Windows 10.

User avatar
boiler
Posts: 16706
Joined: 21 Dec 2014, 02:44

Re: How do I monitor a specific file in a directory?

Post by boiler » 30 Mar 2023, 15:25

J0RDAN wrote: Does it work on your system? I'm running Windows 10.
I'm not trying to get your full code working. That's not the way to troubleshoot. As I said before:
boiler wrote:
29 Mar 2023, 19:43
Make sure you know how to get either flyingDman’s original script or the one I posted to work before trying to incorporate it into your larger script.

When you can't figure out why something's not working, the first step isn't to try to get the full-length, more complex code to work. It's to isolate the part you're adding and make sure you get that to work on its own. I still haven't heard you say that you ran either my code or flyingDman's code and produced the expected results.

J0RDAN
Posts: 17
Joined: 02 Nov 2022, 17:29

Re: How do I monitor a specific file in a directory?

Post by J0RDAN » 30 Mar 2023, 15:51

boiler wrote:
30 Mar 2023, 15:25
J0RDAN wrote: Does it work on your system? I'm running Windows 10.
I'm not trying to get your full code working. That's not the way to troubleshoot. As I said before:
boiler wrote:
29 Mar 2023, 19:43
Make sure you know how to get either flyingDman’s original script or the one I posted to work before trying to incorporate it into your larger script.

When you can't figure out why something's not working, the first step isn't to try to get the full-length, more complex code to work. It's to isolate the part you're adding and make sure you get that to work on its own. I still haven't heard you say that you ran either my code or flyingDman's code and produced the expected results.
Good advice. I tried running flyingDman's code in a blank .ahk all by itself and the H icon that pops up in the tray on the bottom right came up and went away in a flash, instantly closing again.
Image

User avatar
flyingDman
Posts: 2776
Joined: 29 Sep 2013, 19:01

Re: How do I monitor a specific file in a directory?

Post by flyingDman » 30 Mar 2023, 17:48

Did you insert the #persistent at the top of your script?
14.3 & 1.3.7

Post Reply

Return to “Ask for Help (v1)”