I am new to AutoHotKey usage. I am using Version 1 syntax.
I want to watch a text file for any changes/modifications and if the text file is modified then I want to copy the contents of the Text file to clipboard.
When I run the below script then I don't see any errors but the clipboard is not working. What am I doing wrong here?
#SingleInstance
#Persistent
global ClipboardFile := "C:\\Users\\Username\\OneDrive - Folder\\clipboard.txt"
global Timestamp
FileGetTime, Timestamp, ClipboardFile, M
SetTimer , isFileModified, 1000
return
isFileModified() {
FileGetTime, TimestampModified, ClipboardFile, M
if ( Timestamp < TimestampModified ) {
global Timestamp := TimestampModified
FileRead, ClipboardText, ClipboardFile
ClipboardText := StrReplace(ClipboardText, "`n", "`r`n")
clipboard := ClipboardText
TrayTip , "Clipboard is updated successfully"
}
}