Need to run a script x number of times

Discussion in 'AutoCAD' started by SKUMAR, Aug 5, 2003.

  1. SKUMAR

    SKUMAR Guest

    Hello,
    I have a script that will print the current page then open the next and print and the next, etc.
    I would like to know if I want to print 10 pages that I can somehow have the script run only 10 times.

    Thanks
    Sanjiv
     
    SKUMAR, Aug 5, 2003
    #1
  2. SKUMAR

    Clive Guest

    Have each page in paperspace and use the tabs. print the selection of 10 as many time as u like.



    "SKUMAR" <> wrote in message news:...

    Hello,
    I have a script that will print the current page then open the next and print and the next, etc.
    I would like to know if I want to print 10 pages that I can somehow have the script run only 10 times.

    Thanks
    Sanjiv
     
    Clive, Aug 6, 2003
    #2
  3. SKUMAR

    SKUMAR Guest

    Clive, thank you for the response but this script does a little more to the page it opens before printing it.
    What I want is to "tell" the script to run ONLY x times.

    thanks
    Sanjiv
     
    SKUMAR, Aug 6, 2003
    #3
  4. SKUMAR

    BillZ Guest

    SKUMAR,
    You could write a sub routine that fires at the end of the script and checks a counter.
    First set up a text file with the character "0".
    (setq fl (open "c:/txt_cntr.txt" "w"))
    (write-line "0" fl) (close fl).
    Then when you write your script add this to the end of the script.
    (write-line "(load \"c:/counter\")" fl2)
          (write-line "(counter)" fl2)
    Now the defun:
    (defun counter ()
      (setq fl (open "c:/txt_cntr.txt" "r"))
       (setq cntr (read-line fl))
        (close fl)
         (setq cntr (itoa (1+ (atoi cntr))))
          (setq fl (open "c:/txt_cntr.txt" "w"))
           (write-line cntr fl)
            (close fl)
             (if (<= (atoi cntr) 10)(command "rscript"))
     ) ;end defun

    Make the call to the subr the last line of the script.
    Kind of klunky but should work.
    Bill
     
    BillZ, Aug 6, 2003
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.