I have a macro that does the following:
- On a web page in Firefox, opens the download section for a file, identifies a form of download (zip file) and downloads it.
- Unpacks the zip file.
- Opens the unzipped folder, looks for a text file that always starts with the same unique letter and contains metadata.
- Reads out the metadata, stores it in different variables.
- Generates a text template from the variables.
- Opens another website to process the image files from the folder
- …
Until now, this was a long macro, which occasionally worked, but due to many fixed pause periods, had problems when downloading or unpacking could not be processed in time.
Accordingly, I am currently splitting it into partial macros that can be used independently of each other (e.g. if an unpacked folder is already available) and that are executed step by step after a user query.
Here are my (first) three questions:
-
How can I make the macro wait while unzipping a folder (duration: between a second and half a minute) before proceeding automatically? I start with a file e.g. named SPS18236644.zip (same SPS prefix everytime) and end up with a folder named SPS18236644.
-
Currently I open the downloaded file and identify the file containing the metadata (only file that starts with S) in the following way:
Actions (v10.2)
Keyboard Maestro Actions.kmactions (2.7 KB)
-
How can I make this more robust and independent from moving around in Finder using keystrokes (open the file S-Metadata-File.txt in last added folder in Downloads)?
-
How to best save the path of the unzipped folder for later use?
Thanks for giving me some suggestions on how to proceed.