OnEvent>FILE_EXISTS,*.* fires perpetually

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3531
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

OnEvent>FILE_EXISTS,*.* fires perpetually

Post by JRL » Wed Feb 24, 2016 5:25 pm

What am I doing wrong? The OnEvent line:

OnEvent>FILE_EXISTS,%temp_Dir%FolderForDetectingFiles\*.*,0,srtAutoDetect

Will never stop firing even though there are no files in the specified folder. If I change the file specification to *.TXT for example, the OnEvent> correctly triggers only when it contains a file with the .txt extension. I have used this before using a more specific file type but this is the first time I've tried finding all files. I can get around this by writing a custom OnEvent but why does this script not work as I expect it to work?


Code: Select all

CreateDir>%temp_dir%FolderForDetectingFiles

Let>AA=0
Let>BB=0
message>
OnEvent>FILE_EXISTS,%temp_Dir%FolderForDetectingFiles\*.*,0,srtAutoDetect

SRT>srtAutoDetect
Add>BB,1
SetControlText>Macro Scheduler Message,TMemo,1,AA=%AA%  BB=%BB%
END>srtAutoDetect

Label>Loop
  Wait>1
  Add>AA,1
  If>AA=5
    Goto>End
  EndIf
Goto>Loop

Label>End
//If you don't turn off the File_Exist OnEvent, the folder can't be deleted.
OnEvent>FILE_EXISTS,%temp_Dir%FolderForDetectingFiles\*.*,0,
Wait>1
DeleteFolder>%temp_Dir%FolderForDetectingFiles

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Re: OnEvent>FILE_EXISTS,*.* fires perpetually

Post by Jerry Thomas » Thu Feb 25, 2016 3:11 pm

Try this to see what files are being detected.
(There may be no VISIBLE files. No telling what Windows is sticking in there.)

GetFileList>%temp_Dir%FolderForDetectingFiles\*.*,FileList
MDL>FileList
Thanks,
Jerry

[email protected]

User avatar
JRL
Automation Wizard
Posts: 3531
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: OnEvent>FILE_EXISTS,*.* fires perpetually

Post by JRL » Thu Feb 25, 2016 3:22 pm

Thanks Jerry.

Tried that. There is nothing. This is a fresh new folder that has only existed a fraction of a second and does not have any files of any kind, except . and .. which are specialized directories created by the OS in all folders but are typically not detected or seen except in a DOS window when you type "dir" and press Enter.

Did you try running the script? What do you see?

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Re: OnEvent>FILE_EXISTS,*.* fires perpetually

Post by Jerry Thomas » Thu Feb 25, 2016 3:34 pm

I stand corrected.
You are right - it does detect a file???
Thanks,
Jerry

[email protected]

User avatar
JRL
Automation Wizard
Posts: 3531
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: OnEvent>FILE_EXISTS,*.* fires perpetually

Post by JRL » Thu Feb 25, 2016 3:38 pm

Thanks for testing. For the record what is your OS? I'm on Win 7 with the latest updates and using Macro Scheduler version 14.2.07

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Re: OnEvent>FILE_EXISTS,*.* fires perpetually

Post by Jerry Thomas » Thu Feb 25, 2016 3:57 pm

Win7 w/ updates & MS 14.2.03
Thanks,
Jerry

[email protected]

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts