Home > other >  How can I automatically download web pages for offline viewing?
How can I automatically download web pages for offline viewing?

Time:10-25

I am writing a macro; but at some point i need help.

What I want is to download pages in bulk for offline viewing. I used IDM; but the pages seem to be missing when viewing the files after downloading.

I also need to be able to set their names automatically so that I can automatically replace them with another macro; so I'm writing a macro outside of IDM or similar program.

So I wanted to download with CTRL S Save type: Webpage, Single File method. I did everything; I just want it to automatically increment the record name by 1 by 1.


Sample;

document.selection.StartOfDocument();
nLines = document.GetLines();
for( y = 1; y < nLines;   y ) {
    str = document.GetLine( y );
    if( str.length != 0 ) {
        document.selection.OpenLink();
        Sleep( 5000 );

        shell.SendKeys( "^s" );
        Sleep( 500 );
        
//////////////////////////////////////////////////////////////////
How can I add the command I want at this point?

I can get it to write the number '1'; but it has to increment by 1 each time.
How can I do this code?
//////////////////////////////////////////////////////////////////
    
    shell.SendKeys( "~" );
        Sleep( 500 );
    
        shell.SendKeys( "%{F4}" );
        Sleep( 500 );
    }
    document.selection.LineDown(false,1);
}
alert( "Finished Saving" );

After this command, it will write 1 for the record name. And it will increment it by 1 each time.

    1. URL - (The filename will be saved as 1.)
    1. URL - (The filename will be saved as 2.)
    1. URL - (The filename will be saved as 3.)
  • ...
    1. URL - (The filename will be saved as 365.)

P.S: To put it another way; When saving the connections, the registration name should be saved as the "Line Number" where that connection is located. That way, after all the files have been downloaded, I'll be able to use my other macro to rename them with the URL they belong to.

Finally; If you know of another way to do what I want, I'd love to hear it.

Thank you in advance and have a nice day.

CodePudding user response:

y is the line number. So, replace the comment lines in your sample with:

shell.SendKeys( y );
  • Related