Hi All,
Simple question I'm hoping someone can help me with. I'm monitoring a folder and if a file appears, I would like that to trigger something (for my example just a MessageModal). I'm using the following:
Label>Start
IfFileExists>C:\00 - TEST 2\*.*
Wait>3
//SEND TRUE MESSAGE
MessageModal>Hello! It Worked!
Wait>1
Endif
Wait>1
//SEND FALSE MESSAGE
MessageModal>This folder is empty.
Goto>Start
Label>End
The problem is even when there isn't a file in this folder I still get the first message "Hello! It Worked". Is this because of my usage of the wildcard ("*.*")? I was assuming the wildcard would bet "true" when there was a file present, and "false" when not.
Thanks in advance,
ADP
Simple Question About IfFileExists
Moderators: Dorian (MJT support), JRL
Re: Simple Question About IfFileExists
That is because you are searching for "*.*". IfFileExists> also detects folders. Even a file free folder contains two special folders named "." and "..". You will see them if you open a DOS prompt and type "Dir" then press enter.The problem is even when there isn't a file in this folder I still get the first message "Hello! It Worked".
Is there any commonality in the incoming file names? Even a single character that will be common in all file names? For example if all files contain a "T" you could do IfFileExists>C:\00 - TEST 2\*t*.*
Otherwise I would suggest using DOS and writing results to a file then looping to see when the result file has contents.
Something Like:
Code: Select all
Let>RP_Wait=1
Let RP_WindowMode=0
RunProgram>cmd /c Dir "C:\00 - TEST 2\*.*" /a-d /b > %temp_dir%FileExistsResult.txt
FileSize>%temp_dir%FileExistsResult.txt,vFSize
If>vFSize>0
Code: Select all
IfFileExists>C:\00 - TEST 2\*.*
Re: Simple Question About IfFileExists
Hi JRL,
I did manage to find some commonality and it worked. Thanks for the suggestion.
ADP
I did manage to find some commonality and it worked. Thanks for the suggestion.
ADP
- CyberCitizen
- Automation Wizard
- Posts: 721
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Re: Simple Question About IfFileExists
Also watch out for hidden system files etc something like desktop.ini
I don't know if MS detects these in the folders as well with those commands.
I don't know if MS detects these in the folders as well with those commands.
FIREFIGHTER