The renewal maintenance has officially ended for Progress iMacros effective November 30, 2023.
This Wiki site will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely, The Progress Team
Difference between revisions of "SAVEAS"
(17 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
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. | 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 [[Image:IMacros-icon.png|iMacros Browser]] [[Image:Ie-icon.png|IE Plug-in]] [[Image:Ff-icon.png|Firefox]]=== | + | === Syntax [[Image:IMacros-icon.png|iMacros Browser]] [[Image:Ie-icon.png|IE Plug-in]] [[Image:Ff-icon.png|Firefox]] [[Image:Cr-icon.png|Chrome]]=== |
− | SAVEAS TYPE=(CPL|MHT|HTM|TXT|EXTRACT|BMP|PNG) FOLDER=folder_name FILE=file_name | + | SAVEAS TYPE=(CPL|MHT|HTM|TXT|EXTRACT|BMP|PNG|JPEG) FOLDER=folder_name FILE=file_name |
Note: | Note: | ||
− | * The MHT | + | * The CPL and MHT formats are not supported in Firefox [[Image:Ff-icon.png|Firefox]] |
− | * | + | * The CPL and BMP formats are not supported in Chrome [[Image:Cr-icon.png|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 === | === Parameters === | ||
Line 24: | Line 25: | ||
**: The value of the variable !EXTRACT is saved in CSV format. | **: 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". | **: Note: the value of the !EXTRACT variable is reset after calling "SAVEAS TYPE=EXTRACT". | ||
− | ** BMP | + | ** BMP [[Image:IMacros-icon.png|iMacros Browser]] [[Image:Ie-icon.png|IE Plug-in]] (supports Flash, Java and Silverlight) |
− | **: A '''screenshot''' of the web page is saved. | + | **: A '''screenshot''' of the web page is saved. |
− | ** | + | ** PNG [[Image:IMacros-icon.png|iMacros Browser]] [[Image:Ie-icon.png|IE Plug-in]] [[Image:Ff-icon.png|Firefox]] |
+ | **: as above: a '''screenshot''' of the web page is saved | ||
+ | ** JPEG [[Image:Ff-icon.png|Firefox]] | ||
**: as above: a '''screenshot''' of the web page is saved | **: as above: a '''screenshot''' of the web page is saved | ||
− | |||
*FOLDER | *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:\ | + | *: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:\Users\admin\Documents\iMacros\Downloads. Paths containing spaces require special handling, see the examples below. |
− | *: | + | *:[[Image:Ff-icon.png|Firefox]] [[Image:Cr-icon.png|Chrome]] The specified folder must already exist on disk, it will not be created automatically. |
*FILE | *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. | + | *: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 === | === Examples === | ||
Line 48: | Line 52: | ||
SAVEAS TYPE=EXTRACT FOLDER=* FILE=* | SAVEAS TYPE=EXTRACT FOLDER=* FILE=* | ||
+ | |||
+ | If you specify a folder name that contains spaces, you can surround the entire value with double-quotes, but you must also escape the backslash characters with another backslash: | ||
+ | |||
+ | SAVEAS TYPE=EXTRACT FOLDER="C:\\My Macros\\Downloads FILE=*" | ||
+ | |||
+ | Alternatively, you can replace the spaces with a <SP> tag and omit the enclosing double-quotes and escaped backslashes: | ||
+ | |||
+ | SAVEAS TYPE=EXTRACT FOLDER=C:\My<SP>Macros\Downloads FILE=* | ||
'''Extract some text''' (e. g. the title) of a report '''and use it as file name''' for saving the html page: | '''Extract some text''' (e. g. the title) of a report '''and use it as file name''' for saving the html page: | ||
Line 57: | Line 69: | ||
=== Related forum posts: === | === Related forum posts: === | ||
− | * [ | + | * [https://forum.imacros.net/viewtopic.php?f=7&t=5330 How Save only the URL of a visited page] |
+ | * [https://forum.imacros.net/viewtopic.php?f=6&t=12790 How to determine iMacros folder locations from VBScript] | ||
=== See Also === | === See Also === | ||
− | [[ONDOWNLOAD]], [[EXTRACT]] | + | [[ONDOWNLOAD]], [[TAG#The_EXTRACT_Parameter|EXTRACT parameter]], [[!EXTRACT]] |
Revision as of 19:06, 8 January 2019
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
SAVEAS TYPE=(CPL|MHT|HTM|TXT|EXTRACT|BMP|PNG|JPEG) FOLDER=folder_name FILE=file_name
Note:
- The CPL and MHT formats are not supported in Firefox
- The CPL and BMP formats are not supported in 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 (supports Flash, Java and Silverlight)
- A screenshot of the web page is saved.
- PNG
- as above: a screenshot of the web page is saved
- JPEG
- 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:\Users\admin\Documents\iMacros\Downloads. Paths containing spaces require special handling, see the examples below.
- The specified folder must already exist on disk, it will not be created automatically.
- 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=*
If you specify a folder name that contains spaces, you can surround the entire value with double-quotes, but you must also escape the backslash characters with another backslash:
SAVEAS TYPE=EXTRACT FOLDER="C:\\My Macros\\Downloads FILE=*"
Alternatively, you can replace the spaces with a <SP> tag and omit the enclosing double-quotes and escaped backslashes:
SAVEAS TYPE=EXTRACT FOLDER=C:\My<SP>Macros\Downloads 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.