After click download button, normally the file downloaded by browser will have its own name. But I need to save the file to specific folder. How can I save it with this original name?
This is useless:
{
“Command”: “onDownload”,
“Target”: “FolderA/FolderB/”,
“Value”: “”,
“Description”: “”
}
If you do not use the OnDownload command, then the original file name is preserved.
If you need to copy the file from the download folder to another folder, you can trigger a basic batch file (or Python) script with the XRUN command after the download is complete.
Or you use the hard-drive mode, then the download folder is the UI Vision root folder + “/download”.
Thanks. So there’s no other method to get the original name then. Unfortunately, the XRun need XModule, which is blocked by our IT policy. Thanks anyway.
Actually, you can get the original file name. It is in the ${!Last_Downloaded_File_Name} variable: (read only) Get the name of the downloaded file. This requires ONDOWNLOAD to be inside the macro.
You could store this value e. g. in a CSV file, and then use this info you to rename the downloaded file afterwards.
Sorry to bother again. I don’t know how to use the variable. I put it in the OnDownload Target, but it says Internal variable "!LAST_DOWNLOADED_FILE_NAME" not supported. Maybe I’m not using it correctly?
I thought before using it, I have to download first to get the name and then put it in the OnDownload and download again. But it’s not. Anyway, I’m not gonna use this method anymore. Thanks anyway~
Hi, the internal variable !LAST_DOWNLOADED_FILE_NAME works with V6.2.6, but is broken since version V6.2.8. At this point I am not sure if this a regression bug in our software and/or a change in the Chrome API. We will look into this.
You need to add onDownload | | true to your macro. This makes the macro wait for the download to complete. Only then ${!Last_Downloaded_File_Name} has a value.