Jump to content

Print default printer then add 10 to the url


Recommended Posts

Hello fellow reader,

I am fresh to autoit and have minor programming experience so I would highly appreciate the community's help. There is this website where we are allowed to print the pages but only 10 at a time, which I need over 1,500 pages in total so manual editing the page's url 150 times would be very tedious and not fun. Here is what I have so far which does not work:

$i = 1
$z = 10
Local   $printdefault = InetGet("http:/examplesite.com&id=230/" & $i & "&__pagestoprint=" & $z
    DO
        Sleep(250)
    $i = $i + 10
    $z = $z + 10
    Until $i > 30
Func _Exit()
    Exit
EndFunc   ;==>_Exit

This probably looks like a work of a child so please bare with me lol, let give you guys some more insight, the full page url is:

" http:/examplesite.com&id=230/1&__pagestoprint=10 ", from 1 and 10 I can change the numbers from the url to print what ever pages I want as long as if the pages does not exceed over 10.

I also want it to stop at the number it is designated to it, example stop at page 456. I would really appreciate your guys time and effort on this! Thank you in advance.

If I missed out any detail or anything please let me know, I will respond ASAP ;)!

Edited by k12k08
Link to comment
Share on other sites

So this URL - http:/examplesite.com&id=230/1&__pagestoprint=10 would print pages 1 thru 10. Would http:/examplesite.com&id=230/11&__pagestoprint=10 print pages 11 thru 21? Then http:/examplesite.com&id=230/22&__pagestoprint=10 for the next batch of 10 pages?

There is also some errors in your code I believe. The first ampersand in the URL should probably be a question mark. ShellExecute should probably be used instead of InetGet, and that line should be in the Do..Until loop. You're missing the closing parenthesis on that line too. After the http protocol should be ://.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

So this URL - http:/examplesite.com&id=230/1&__pagestoprint=10 would print pages 1 thru 10. Would http:/examplesite.com&id=230/11&__pagestoprint=10 print pages 11 thru 21? Then http:/examplesite.com&id=230/22&__pagestoprint=10 for the next batch of 10 pages?

There is also some errors in your code I believe. The first ampersand in the URL should probably be a question mark. ShellExecute should probably be used instead of InetGet, and that line should be in the Do..Until loop. You're missing the closing parenthesis on that line too. After the http protocol should be ://.

Thank you soo much!!

And yes it is

http:/examplesite.com&id=230/1&__pagestoprint=10 would print pages 1 thru 10.

and

http:/examplesite.com&id=230/11&__pagestoprint=10 print pages 11 thru 21

and Then

http:/examplesite.com&id=230/21&__pagestoprint=10 for pages 21 thru 30.

and

http:/examplesite.com&id=230/31&__pagestoprint=10 for pages 31 thru 40.

And soo on.

Would you be soo kind and fix my code for me, I keep on getting the same error after you corrections

Edited by k12k08
Link to comment
Share on other sites

I'm still kinda confused about this, but does this work the way you need? You should comment out the ShellExecute line, and uncomment the ConsoleWrite line, to see if displays the right line first.

$i = 1
$z = 10

Do
    ;ConsoleWrite("http://examplesite.com?id=230/" & $i & "&__pagestoprint=" & $z & @LF)
    ShellExecute("http://examplesite.com?id=230/" & $i & "&__pagestoprint=" & $z)
    Sleep(250)
    $i += 10
    $z += 10
Until $i > 30

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

You bet. I'm glad it works for you. Do yourself a solid; read thru the Help file (especially the Language Reference section), and learn and understand why the code works the way it does (specifically I mean the Do..Until loop). Compare my code with your code, you'll see there are some differences, but they're real similar to each other. Good Luck! ;)

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...