home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR16 / PRWRI12.ZIP / PRWRI12.WCM < prev    next >
Text File  |  1993-07-18  |  3KB  |  144 lines

  1. //////////////////
  2. // PRWRI12.WCM
  3. // PrintWrite 1.2
  4. //////////////////
  5.  
  6. // ASSIGN ICON
  7. hicon=loadiconfile("prwri.ico")
  8. if(hicon<>0)holdicon=seticon(hmain,hicon)
  9. // ASK FOR FILENAME
  10. ans=askbox("Enter name of file (no extension)"," ")
  11. if ans+a==a
  12. exit
  13. var1="Write - "
  14. var2=ans 
  15. var3=".wri"
  16. file=var1+var2+var3
  17. appactivate(file)
  18. // MAKE SURE ANSWER IS VALID
  19. test=getwindowhandle(file)
  20. if test=0
  21.  do
  22.   do
  23.   ans=askbox("Sorry, that file is not active.       Enter name of active Write file     (without .wri extension)"," ")
  24.    if ans+a==a
  25.    exit
  26.    var1="Write - "
  27.    var2=ans 
  28.    var3=".wri"
  29.    file=var1+var2+var3
  30.    appactivate(file)
  31.   end
  32.  test=getwindowhandle(file)
  33.  if test=0
  34.   do
  35.    msgbox("Sorry, that is an invalid answer. Make sure that Write is running, check filename and try again.","PrintWrite",0)
  36.    exit
  37.   end
  38.  end
  39. // JUMP TO END OF DOCUMENT
  40. delay(100)
  41. sendkeys("^{end}")
  42. delay(500)
  43. // ASK FOR DOCUMENT LENGTH
  44. pages=askbox("How many pages?"," ")
  45. // MAKE SURE A NUMBER HAS BEEN ENTERED
  46. if pages+a==a
  47. exit
  48. if pages=0
  49. exit
  50. if pages=(" ")
  51.  do
  52.   pages=askbox("Please enter the number of pages you wish to print."," ")
  53.   if pages+a==a
  54.   exit
  55.   if pages=0
  56.   exit
  57.   if pages=(" ")
  58.    do
  59.     msgbox("Sorry, that is an invalid answer. Decide how many pages you want to print and try again.","PrintWrite",0)
  60.     exit
  61.    end
  62.  end
  63. pages=pages-1
  64. // ASK PAGE TO START ON
  65. first=askbox("Start on page","1")
  66. // MAKE SURE A NUMBER HAS BEEN ENTERED
  67. if first+a==a
  68. exit
  69. if first=0
  70. exit
  71. if first=" "
  72. exit
  73. count=first
  74. // PRINT FIRST (SELECTED) PAGE
  75. appactivate(file)
  76. delay(100)
  77. sendkeys("%f")
  78. sendkeys("p")
  79. sendkeys("p")
  80. sendkeys(count)
  81. sendkeys("{tab}")
  82. sendkeys(count)
  83. sendkeys("{enter}")
  84. winact=getappactive()
  85. while(winact="Write")
  86.  do
  87.   winact = getappactive()
  88.   delay (1000)
  89.  end
  90. // CHECK NUMBER OF PAGES PRINTED SO FAR
  91. count=first-0
  92. while count<pages
  93.  do
  94.   count=count+2
  95. // PRINT SECOND (SELECTED) AND SUBSEQUENT PAGES
  96.   appactivate(file)
  97.   delay(100)
  98.   sendkeys("%f")
  99.   sendkeys("p")
  100.   sendkeys("{tab}")
  101.   sendkeys(count)
  102.   sendkeys("{tab}")
  103.   sendkeys(count)
  104.   sendkeys("{enter}")
  105.   winact=getappactive()
  106.    while(winact="Write")
  107.     do
  108.      winact=getappactive()
  109.      delay(1000)
  110.     end
  111.   end
  112. // PROMPT FOR READINESS TO PRINT ALTERNATE PAGES
  113. reply=msgbox("Ready to continue print job?","Pause",1)
  114. if reply=2
  115. exit
  116. if reply=1
  117. // CHECK NUMBER OF PAGES PRINTED SO FAR
  118. count=first-1
  119. while count<pages
  120.  do
  121.   count=count+2
  122. // PRINT ALTERNATE PAGES
  123.   appactivate(file)
  124.   delay(100)
  125.   sendkeys("%f")
  126.   sendkeys("p")
  127.   sendkeys("{tab}")
  128.   sendkeys(count)
  129.   sendkeys("{tab}")
  130.   sendkeys(count)
  131.   sendkeys("{enter}")
  132.   winact=getappactive()
  133.    while(winact = "Write")
  134.     do
  135.      winact=getappactive()
  136.      delay(1000)
  137.     end
  138.  end
  139. // GOODBYE
  140. msgbox("Thank you for using WinCmd and PrintWrite!","PrintWrite",0)
  141. appactivate(file)
  142. sendkeys("^{home}")
  143. exit
  144.