firefox commandline code for auto-saving webpages

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
bars143
Posts: 87
Joined: 01 Sep 2013 20:47

firefox commandline code for auto-saving webpages

#1 Post by bars143 » 06 Jan 2014 20:28

hi to all experts,

can you give me a firefox addson to autosave webpage everytime i visit their site and everytime i visit their other pages using desktop firefox v26? i only found saving site-link but not webpage?


but i google firefox has it own commandline to use commandprompt.
and i cant understand their syntax really has it own code to autosave webpage everytime i visit website?

are firefox has command to save webpage like wget?

neither wget nor a site-grabber apps allowed to my affordable data-plan (if allowed then data plan will be auto-blocked by network operator) and rendered simcard useless for internet.

i had batch script to open site:

Code: Select all

firefox.exe www.dostips.com


but saving site (including saving destination directory) i dont know, maybe like this:

Code: Select all

firefox.exe <code_for_saving_site?> www.dostips.com <saved_webpage_destination>


if you give me firefox code to save webpages (and saved destination) then this code will be created:

Code: Select all


@echo off &setlocal enabledelayedexpansion

for /f "delims" %%a in (list_of_URL_address.txt) do (
     set "URL=%%a"
     firefox.exe <code_for_saving_site?> "!URL!" "c:\users\bars\saved_webpage"
)



im lazy to google all firefox commandline syntax due to limited data-surf.

thanks,

bars

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: firefox commandline code for auto-saving webpages

#2 Post by foxidrive » 06 Jan 2014 20:59

iMacros is a Firefox addon that allows scripting.

I haven't used it myself.

berserker
Posts: 95
Joined: 18 Dec 2013 00:51

Re: firefox commandline code for auto-saving webpages

#3 Post by berserker » 06 Jan 2014 21:11

If all you want is just download web page then use wget

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: firefox commandline code for auto-saving webpages

#4 Post by foxidrive » 06 Jan 2014 21:46

wget is a good idea - bars said it's not useful for him, but it can download just the single web page - without recursive downloading, and doesn't need to download images or any other files.

berserker
Posts: 95
Joined: 18 Dec 2013 00:51

Re: firefox commandline code for auto-saving webpages

#5 Post by berserker » 06 Jan 2014 22:03

Maybe put it this way to bars. Since he wants to save the pages as he visits the site then wget had the recursive option to do that. By downloading through wget its the same as he already visited the sites. Although its not clear what he wants to do with the saved pages.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: firefox commandline code for auto-saving webpages

#6 Post by foxidrive » 06 Jan 2014 22:14

bars, you can change the Agent signature in Wget so the provider can't tell that wget is being used.

bars143
Posts: 87
Joined: 01 Sep 2013 20:47

Re: firefox commandline code for auto-saving webpages

#7 Post by bars143 » 06 Jan 2014 23:01

foxidrive wrote:bars, you can change the Agent signature in Wget so the provider can't tell that wget is being used.


i will try useragent at wget and Addons -iMacro.

i already had web developers addon that set-off image to save data -which also optimize load-speed and it can give a list of links per webpages and yet cant found auto-saving pages per visit -so that i can read it offline later(which also saving data-charges too).

anyway thanks to all repliers.

bars143
Posts: 87
Joined: 01 Sep 2013 20:47

Re: firefox commandline code for auto-saving webpages

#8 Post by bars143 » 15 Jan 2014 03:22

im more interested in firefox addson named UnMHT that can saved in multitab in one click for my requirement. iMicros is more like a video saving the webpages but i didt choose it. i choose UnMHT and it saved in .MHT format only.

if i have more money to buy expensive data then i have no problem using wget or site-grabber apps.

here is my procedure:

first creating the code named "divide_list_to_five_file.bat" below to separate list of URL address into 5 files with 10 links per files :

Code: Select all

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

set "URL=0"

for /f "delims=" %%a in (selected.txt) do (

set "m=%%a"
set /a "URL+=1"

if !URL! LEQ 10 echo !m! >>firefox_URL_list1.txt
if !URL! GEQ 11 if !URL! LSS 21 echo !m! >>firefox_URL_list2.txt
if !URL! GEQ 21 if !URL! LSS 31 echo !m! >>firefox_URL_list3.txt
if !URL! GEQ 31 if !URL! LSS 41 echo !m! >>firefox_URL_list4.txt
if !URL! GEQ 41 echo !m! >>firefox_URL_list5.txt

)
pause



second creating the code named "open_multi_tabs.bat" to open 10 multitab per window per one file :

Code: Select all

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

echo list1.txt:
echo.
ping -n 5 localhost >nul
for /f %%a in (firefox_URL_list1.txt) do (
set "m=%%a"
set "n=ping -n 10 localhost"
start "" firefox.exe -new-tab "!m!"
echo !m!
!n! >nul
)
timeout 300
cls

echo list2.txt:
echo.
for /f %%a in (firefox_URL_list2.txt) do (
set "m=%%a"
set "n=ping -n 5 localhost"
start "" firefox.exe -new-tab "!m!"
echo !m!
!n! >nul
)
timeout 300
cls

echo list3.txt:
echo.
for /f %%a in (firefox_URL_list3.txt) do (
set "m=%%a"
set "n=ping -n 5 localhost"
start "" firefox.exe -new-tab "!m!"
echo !m!
!n! >nul
)
timeout 300
cls

echo list4.txt:
echo.
for /f %%a in (firefox_URL_list4.txt) do (
set "m=%%a"
set "n=ping -n 5 localhost"
start "" firefox.exe -new-tab "!m!"
echo !m!
!n! >nul
)
timeout 300
cls

echo list5.txt:
echo.
for /f %%a in (firefox_URL_list5.txt) do (
set "m=%%a"
set "n=ping -n 5 localhost"
start "" firefox.exe -new-tab "!m!"
echo !m!
!n! >nul
)

pause


third, i use addson named Web Developer 1.2.5 to grabbed all links of webpage and manually trimmed all unused blanklines/spaces using notepad2.exe and output result to "input.txt" and then use Aacini's fastest sort script and output to "sorted_input.txt" then manually and easily copy selected links in one highlight and paste to a file named "selected.txt"


here is the code of Aacini sort script


Code: Select all

@if (@CodeSection == @Batch) @then

@echo off
CScript //nologo //E:JScript "%~F0" < input.txt  > sorted_input.txt

goto :EOF

@end

// JScript section

var name = new Array(), file, len, a;

while ( ! WScript.Stdin.AtEndOfStream ) {             // for /F "delims=" %%a in (input.txt) do (
   file = WScript.Stdin.ReadLine();                   //    set "file=%%a"
                                                      //    call :StrLenVar file len=
   len = "000"+file.length;                           //    set len=000!len!
   name.push(len.slice(-4)+file);                     //    set name[!len:~-4!;!file!]=1
}                                                     // )
name.sort();                                          // rem In Batch the arrays are kept always sorted by index

for ( a in name ) WScript.Echo(name[a].substr(4));    //  for /F "tokens=2 delims=;]" %%a in ('set name[') do echo %%a




finally with all the ff. file/.bat ready:

selected.txt
divide_list_to_five_file.bat
open_multi_tabs.bat

then i run the code named "start_processing_10_tab.bat" below:

Code: Select all

@echo off

ping -n 5 localhost >nul
echo start processing ^( divide_list_to_five_file.bat ^)
echo processing ^( open_multi_tabs.bat ^)
ping -n 5 localhost >nul
start "" divide_list_to_five_file.bat
start "" open_multi_tabs.bat

and observed and found out if 10 multitab completed their loading:

1. press multitab UnMHT saving button
2. selecting all 10 links
3. press ok to save to destination folder.

since 300 seconds is the timeout for processing another 10 multitab,
i already have allowances of 100 seconds so that 10 webpages should be completely saved.

of course if it already finished earlier then i cant wait timeout to finish but had a press enter to continue next 10 load of links.

thats all i do.
--------------------------------

actually my affordable network-data has the following status:

can't use wget and downloader
has a speed download of 10 KB/sec or 100kbps.
upload speed is 2KB/sec or below

----------------

bars
===============
i edit above to remove my claims on Aacini sort script and replace with new code named "start_processing_10_tab.bat"

Post Reply