Trigger and Files

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
winstein
Pro Scripter
Posts: 84
Joined: Mon Nov 26, 2012 3:44 pm

Trigger and Files

Post by winstein » Mon Mar 24, 2014 4:36 am

There is a task that I needed to accomplish, which is to change some things in a CSV file like removing double quotations in strings, and then save it in TXT:

1) Detect for new files in a certain folder
2) Use that file (.csv) and edit the files slightly
3) Save that file under a new format (.txt)

Now, there are some questions in which I need to accomplish the task:

1) How do I get the name of the new file I receive to use for the script?
2) How do I get the directory I used if I used Trigger?
3) Is there a way to use an INI file for the Trigger's directory choice for the Folder Event?
4) Is there any way to trigger the macro to react to new files without using the Macro Scheduler program?
5) In case of "Line: x (letter) not appropriate", what should be done to prevent that? (More details in this thread)

Thanks for reading.
PPQ

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Mar 24, 2014 12:55 pm

Hi,

1) Use the GetNewestFile command

2) If you set the directory in your trigger then you know it, so just hard code it.

3) No but you could make a custom trigger which read the INI file and reproduces what the file trigger does.

4) If you mean can you create a macro which monitors a folder and reacts to new files without using the built-in trigger, then yes, of course. You could write a macro which loops continuously and constantly does GetNewestFile, remembers what it was and when it changes, triggers the rest of the code. The macro would of course have to loop continuously.

5) Line: x (letter) not appropriate sounds like a string parsing error in a complex expression. Make sure strings in complex expressions are correctly quoted. Have looked at that other thread but can't see your code properly. Have suggested a way to do what you want anyway.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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