notify when file is added to folder

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
sbrady19
Posts: 338
Joined: 12 Apr 2018, 05:22
Location: Central Florida
Contact:

notify when file is added to folder

24 Sep 2021, 05:53

here is my code. Nothing in the folder, after 1 run, it quits. Why.
If there is NO file added, it should keep running or looping the folder until at least 1 file is added, but it quits even if NO file is added. Lil help.

Code: Select all

Loop,
{
	Loop, %clipboard%\*.*
	{
	old_Number := A_Index
	;MsgBox,,, %old_Number% old, 1
	}

	sleep 10000  ;wait 10 sec

	Loop, %clipboard%\*.*
	{
	new_Number := A_Index
	MsgBox,,, %old_Number% old %new_Number% new, 1
	
		if (old_Number < new_Number)
		{
		break
		}
	}
break
}

I have code here to make an email and tell me a file has been added.

sbrady19
Posts: 338
Joined: 12 Apr 2018, 05:22
Location: Central Florida
Contact:

Re: notify when file is added to folder

24 Sep 2021, 05:59

still does not work

Code: Select all

IfGreater, new_Number, old_Number
		{
		break
		}
sbrady19
Posts: 338
Joined: 12 Apr 2018, 05:22
Location: Central Florida
Contact:

Re: notify when file is added to folder

24 Sep 2021, 06:24

this seems to work:

Code: Select all

Loop,
{
	old_Number := 0   ;A_Index
	sleep 4000   ;wait 4sec


	Loop, %clipboard%\*.*
	{
	new_Number := A_Index
	}
	
	IfGreater,new_Number, %old_Number%,
	{
	;MsgBox,,, old=%old_Number%   new=%new_Number%, 2
	break
	}
}



run, Outlook,,max
sleep 3000
features_email :=  "[email protected]"
m := ComObjCreate("Outlook.Application").CreateItem(0)
m.To := features_email
m.cc := 
m.bcc:= 
m.Subject := "CEL47 File is there"
m.Body := ""
m.Display
sleep 2000

click at 50,200
WinMinimize, ahk_exe Outlook.exe

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: jaka1 and 178 guests