0

I am using a macro to obtain data from a website and save to a print file using the print function on the specific website page. In the print window i can select "print to pdf" but do not know how to format the output filename to reflect the current date. The macro will be run every month to save a snapshot of the website's data. I have tried several suggestions from the forums but haven't found a solution that works. Filename required is of the form "yyyymmdd_account_summary.pdf" Using Kantu as the macro recorder in firefox 68 on fedora 29.

i tried setting the print file name to $(date +"%y%m%d")_account_summary.pdf but this only created a file named $(date +"%y%m%d")_account_summary.pdf no variables were substituted. obviously i am doing something simple wrong but cannot see it.

Expected resulting filename 20190731_account_summary.pdf actual name that is created $(date +"%y%m%d")_account_summary.pdf which is clearly wrong

MofX
  • 1,569
  • 12
  • 22
sederb
  • 1
  • Please add a tag to your post, that tells us what language you are using. Is this bash scripting? – MofX Aug 01 '19 at 05:02
  • not bash scripting. just trying to have the printfile name include the current date when printing to .pdf from the standard print menu as invoked from the firefox File|print menu. – sederb Aug 01 '19 at 05:23
  • Ahh sorry, I did not see kantu, or did not notice it as the macro recorder. You should always add major used tools into the tags – MofX Aug 01 '19 at 05:28

1 Answers1

0

We are not very familiar with Kantu but I suggest we do it in three steps.

Step 1. Let your macro runs periodically to a fixed file name (/tmp/my_temp_file.pdf).

Step 2. Write a script (bash or python) to monitor the file modify/overwrite timestamp and whenever it detects changes, copy the file (/tmp/my_temp_file.pdf) into "yyyymmdd_account_summary.pdf"

Step 3. Make a cronjob that invoke the script periodically.

Edward Aung
  • 3,014
  • 1
  • 12
  • 15
  • can you give details of exactly how to include the datestamp in the filename? Form required is yyyymmddfilename.pdf – sederb Aug 01 '19 at 05:24
  • Kantu is just a macro recorder. it is just used to record mouseclicks as i navigate through the website so i can setup to play them back each month to save data from the website. – sederb Aug 01 '19 at 05:26