Hi,
I have a directory that get files dumped in it at avrious times throughout the day. I'm trying to get a macro that will trigger when any files are put in the directory and then I will do other stuff on them.
Change Directory>C:\Temp\File Attachments\
GetFileList>C:\Temp\File Attachments\*.*,files
Separate>files,;,Fax
IfFileExists>Fax,,
CopyFile>Fax,c:\temptransfer\Fax
Endif
I'm totally new and any help would be appreciated.
Thx,
John
Filelists
Moderators: Dorian (MJT support), JRL
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
Are the files in the directory moved/deleted so all you want is to detect ANY files in there? If so your code is almost there, this (stolen from the separate> example in help) will do it:
GetFileList>C:\test\*.*,files
Separate>files,;,file_names
MessageModal>Num Files: %file_names_count%
If>file_names_count>0,gotfiles,nofiles
Label>gotfiles
//do stuff here
Label>nofiles
//no files so forget it
GetFileList>C:\test\*.*,files
Separate>files,;,file_names
MessageModal>Num Files: %file_names_count%
If>file_names_count>0,gotfiles,nofiles
Label>gotfiles
//do stuff here
Label>nofiles
//no files so forget it
-
- Pro Scripter
- Posts: 50
- Joined: Fri Mar 23, 2007 10:14 am
Thanks.....The use of labels is something I'll look at!!. I've managed to get the script below working and was wondering if it's possible for it to be running all the time and only trigger when files appear in the directory.
Thx,
John
Change Directory>C:\Temp\File Attachments\
GetFileList>C:\Temp\File Attachments\*.*,files
Separate>files,;,Fax
Let>k=0
Repeat>k
Let>k=k+1
CopyFile>Fax_%k%,Fax_%k%.tif
DeleteFile>Fax_%k%
ExecuteFile>Fax_%k%.tif,
Wait>3
Press CTRL
send>p
Wait>3
Press Enter
Wait>5
Release CTRL
Release Enter
Press ALT
Press F4
Release ALT
Release F4
Wait>5
DeleteFile>Fax_%k%.tif
Until>k,Fax_count
Thx,
John
Change Directory>C:\Temp\File Attachments\
GetFileList>C:\Temp\File Attachments\*.*,files
Separate>files,;,Fax
Let>k=0
Repeat>k
Let>k=k+1
CopyFile>Fax_%k%,Fax_%k%.tif
DeleteFile>Fax_%k%
ExecuteFile>Fax_%k%.tif,
Wait>3
Press CTRL
send>p
Wait>3
Press Enter
Wait>5
Release CTRL
Release Enter
Press ALT
Press F4
Release ALT
Release F4
Wait>5
DeleteFile>Fax_%k%.tif
Until>k,Fax_count