CR export to pdf script change

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
harix
Newbie
Posts: 4
Joined: Thu Jan 18, 2007 3:40 pm

CR export to pdf script change

Post by harix » Fri Oct 29, 2010 4:07 pm

I have a script that opens CR 9, exports each file as pdf and over writes the file. If the file is not there the script stops. I want to change the script to just save the file in the designated folder not prompt to replace it. I will delete any old files before I run the script. Any suggestions would be deeply appreciated.

Thanks!
[email protected]
Code;

Code: Select all

// create a text file with the following format 
// inputfile1.rpt;outputfile1.pdf
// inputfile2.rpt;outputfile2.pdf
// inputfile3.rpt;outputfile3.pdf
// etc;etc

//Set path of input file here: this is the text file that one edits to delete or add a client's set off reports
Let>inputFile=G:\DR_HF_WebIR_RR.txt

//this part loops through the input file, extracts each input/output pair
//and calls the DoExport subroutine to process the export
Let>k=1
Label>ReadInputLoop
  ReadLn>inputFile,k,line
  If>line=##EOF##,finish
  Separate>line,;,parts
  Let>inReport=parts_1
  Let>outFile=parts_2
  GoSub>DoExport
  Let>k=k+1
Goto>ReadInputLoop
Label>finish

SRT>DoExport
  //Open the report in Crystal
  ExecuteFile>inReport
  WaitWindowOpen>Crystal Reports - [*
  WaitReady>0

  //Wait while Status bar says "Formatting"
  Label>IsReady
    GetControlText>Crystal Reports - [*,Afx:00400000:8:00010011:00000010:00000000,1,Status
    Pos>Formatting,status,1,p
    If>p>0,IsReady

  //Now ready to export - Send ALT-f-e-e to initiate File/Export/Export
  Wait>2
  Press ALT
  Send>fee
  Release ALT
  WaitWindowOpen>Export

  //In Crystal Reports
   PDF is first option, so no need to change the option, just press Enter
  SetFocus>Export
  Press Enter

  //Wait for next "Export Options" window to appear and press enter again
  WaitWindowOpen>Export Options
  SetFocus>Export Options
  Press Enter

  //Wait for "Choose export file" dialog and provide the output file
  WaitWindowOpen>Choose export file
  SetFocus>Choose export file
  Send>outFile
  Press Enter
  Press Enter
  //Now wait for the "Exporting Records" progress window
  WaitWindowOpen>Exporting Records

  //And then wait for the "Exporting Records" progress window to disappear
  WaitWindowClosed>Exporting Records

  //All done - quit Crystal?
  SetFocus>Crystal Reports - [*
  Press ALT
  Press F4
  Release ALT
End>DoExport

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts