The SaveTargetAs function simulates the browser "Save Target As" command. SaveTargetAs function is not supported with Firefox or Chrome.
Used to download and save directly a file instead of right-clicking an element and selecting Save Target As command.
ret=SaveTargetAs(<html_descriptor>, <folder> , <extension>)
<html_descriptor>, string, HTML descriptor of the element. Use Spy tool for generating the HTML descriptor.
<folder>, string, folder the file is saved in.
<extension>, string, extension for the saved file ("htm", "php" for example). It must be the correct extension as the one specified when you do the Save Target As manually.
Ret, optional numeric return code. If the function succeeds within the timeout (30 seconds by default or the #ActionTimeout value), the function returns 0. If the file cannot be created, the function returns 26. If the function fails for Internet reasons, the return value is a nonzero negative value (see Web Functions Error Codes).
Only the folder and the extension are specified, the file is saved using the name provided by the web page. If the specified folder does not exist, it is created. If the file already exists, it is automatically replaced. If for any reason, the existing file cannot be deleted before saving the new file with the same name, an error is reported.
Use SaveTargetAs function under IE9/IE10/IE11 for File Downloads. You avoid like that the new IE9/IE10/IE11 Download Manager. And uncheck in Internet options, Advanced Tab, the Notify when downloads complete checkbox. If you prefer to use the new IE File Download manager, the clicks in the small download window must be written manually using ClickUIA function.
You may have to allow TaskExec.exe file at your firewall level in order to use SaveTargetAs function.
'On WinTask Web site, we save the target which is under the link Hottest New Version:
UsePage("WinTask Demonstration Pages")
SaveTargetAs("A[INNERTEXT= 'File']", "c:\test","test")
'The file is saved under c:\test with the name test.test which is the original filename.