SAVEAS

From iMacros
Jump to: navigation, search

Saves information to a file. The SAVEAS command can save different information to a file. You can add parts to the original file name by using the + syntax (see Examples). The built-in variable !NOW is helpful in this context.

Syntax iMacros Browser IE Plug-in Firefox Chrome

SAVEAS TYPE=(CPL|MHT|HTM|TXT|EXTRACT|BMP|PNG|JPEG) FOLDER=folder_name FILE=file_name

Note:

  • The MHT format is not supported in Firefox Firefox
  • The CPL and BMP formats are not supported in Chrome Chrome
  • Taking Screenshots: When takinging screenshots with the iMacros Browser or Firefox, the complete web page (including the invisible part below the fold) is saved. When taking a screenshot with Internet Explorer, only the visible part of the web page is saved. Currently only the iMacros Browser and iMacros for IE can take screenshots of non-HTML content like Flash and Silverlight.

Parameters

  • TYPE
    Specifies the type of the save information. The following options are available:
    • CPL
      The complete web page is saved. The files and images are saved separately and stored in a folder.
    • MHT
      The web page plus images are saved in a single file (Web Archive).
    • HTM
      The web page source is saved with no images. If the page has frames, all framed HTML pages are saved automatically.
    • TXT
      Only the web page text is saved; all HTML tags are omitted.
    • EXTRACT
      The value of the variable !EXTRACT is saved in CSV format.
      Note: the value of the !EXTRACT variable is reset after calling "SAVEAS TYPE=EXTRACT".
    • BMP iMacros Browser IE Plug-in (supports Flash, Java and Silverlight)
      A screenshot of the web page is saved.
    • PNG iMacros Browser IE Plug-in Firefox
      as above: a screenshot of the web page is saved
    • JPEG Firefox
      as above: a screenshot of the web page is saved
  • FOLDER
    Specifies the folder in which the file is saved. Use * for the standard download folder specified in the Paths tab of the Options dialog, e.g. C:\Program Files\iMacros\downloads\. Note that blank spaces in the path need to be replaced by "<SP>" like in "c:\my<SP>folder" (instead of "c:\my folder")
  • FILE
    Specifies the file name under which the file is saved. If no file extension is given then the default file extension is used.
    If you use FILE=*, the default file name "extract.csv" is used.
    Use +something to add something to the original file name before the file extension.

Examples

Save the current webpage in a file called homepage_current.mht

SAVEAS TYPE=MHT FOLDER=* FILE=homepage_current 

Save a screenshot of the current page with the current date in the original filename

SAVEAS TYPE=BMP FOLDER=C:\Screenshots FILE=+{{!NOW:ddmmyyyy}}

Save extracted text to default file ("extract.csv" in iMacros "Downloads" folder).

SAVEAS TYPE=EXTRACT FOLDER=* FILE=*

Extract some text (e. g. the title) of a report and use it as file name for saving the html page:

 TAG POS=1 TYPE=H1 ATTR=TXT:* EXTRACT=TXT
 SAVEAS TYPE=CPL FOLDER=d:\reports FILE=report_{{!EXTRACT}}.htm

So if the extracted text is "Sales Report January 2011" the page will be saved as report_Sales Report January 2011.htm. That is very useful if you create a macro that saves many reports at once while running in a loop. This way you can give each saved page a meaningful file name.

Related forum posts:

See Also

ONDOWNLOAD, EXTRACT parameter, !EXTRACT