![]() |
Software Information |
|
|
Corel WordPerfect 7 Macro Programming Example
Case study: She does this by entering calculations into either a real calculator and transcribing the answer, or the Microsoft calculator and copying then pasting the result into the document. Doing this affects her productivity as this process increases the time taken to complete work and wastes time in correcting inevitable errors that occur. Proposal: Feasibility study: User Requirements: The user requires the ability to select the following options for formatting the output:
1) Displaying a sum in standard numbers or currency. Specification: Purposes of using macro: Calculate the sum of any numerical data specified by the user. Data to be embedded in macro: Any numerical data entered by the user. Use of macro: Accelerate processing of data therefore increasing productivity, by cutting out the additional keystrokes needed to run the calculation manually. Solution: Design of the system Typical configurations required: Method of input: Method of output: To VDU at the point of input data. Using this specification I have written an algorithm that makes effective use of the resources available in Corel WordPerfect 7. Algorithm for applications software macro: The solution to the algorithm stated above in the form of a macro that meets all the requirements identified in the analysis is as follows: Macro script: If (?DocBlank) Condition executed if document blank // Go to subroutine oninput go(oninput) endif // Select data block left of insertion point Selectwordprevious () // Condition executed if no data found If (?SelectedText="") // Go to subroutine error go(error) endif // Convert selected data block to a table Tableconvertfrom (type: tabularcolumns!) // Set default table style TableCellNumberFormat (FormatType: General!) // Turn off Update associated charts option Tableupdateassociatedcharts (state: off!) // Insert an equal sign left of data block Type (text: "=") Tablecalculate () // Calculate formula values in the table // If formula syntax is invalid go to else If(?CellFormula) // Display menu dialog box DialogShow(5001;"WordPerfect") // Condition executed if user presses cancel If(MacroDialogResult = 2) // Revert the last operations Undo(1) // Move insertion point to end of data bock PosWordNext () // Go to subroutine end Go(end) Endif // Condition executed if currency is defined If(currency) // Specify format data as currency [£00.00] TableCellNumberFormat (FormatType: Currency!) TableCellNumberNegativeNumber (NegDisplayType: Minus!) Endif // Condition executed if negatives defined If(negatives) // Specify negative format [(9)] Tablecellnumbernegativenumber (negdisplaytype: parentheses!) Endif // Specify commas are not used TableCellNumberUseCommas (State: No!) // Condition executed if commas defined If(commas) // Specify format data using commas [2,000] TableCellNumberUseCommas (State: Yes!) Endif // Select the table. Tableselecton (selectionmode: table!) // Select all cells in the current table Selecttable () // Delete table convert contents to document Tabledeletetable (delwhat: converttotabs!) // Move insertion point to end of data bock PosWordNext () // Go to subroutine end Go(end) // If formula syntax is invalid then Else endif // Identify the subroutine error Label(error) // Display error message box in event of invalid formula MessageBox (; "AUTOMATH UNABLE TO COMPLY"; "Invalid data exists in formula. Sequence terminated."; IconStop!) // Delete table convert contents to document Tabledeletetable (delwhat: converttotabs!) // Delete character right of the insertion point DeleteCharNext () // Go to subroutine end Go(end) // Identify subroutine oninput. Label(oninput) // Display error message box in event of blank document MessageBox (; "AUTOMATH UNABLE TO COMPLY"; "No input provided! Sequence terminated."; IconStop!) // Identify the subroutine end Label (end) // End macro Quit //==================================================== Implementation: The following tests were performed to confirm that the macro meets all of the requirements under real conditions. Tests to be applied: Test # one of basic macro: 1) Find an individual that knows nothing about this macro. 2) Observation of this individual doing the following: [a] Easily using the instructions. [b] Load Corel WordPerfect 7. [c] Enter valid numerical data. [d] Access the macro file. [e] Run the macro. [f] Repeat steps [c] to [e] using all possible combinations of the options. Ideally, the individual should be able to do the above with no assistance. 3) Observation of the macro running as intended in all conditions. Basic test conditions: Valid Input: Output: Invalid Input: output: [a] 5-5 0 [a][nothing] Error [b] 2+2 4 [b] qwerty Error [c] 2-4 -2 [c] 2gh+32 Error [d] 100*200 20000 [d] !"£$% Error [e] 50/1 50 [e] 1+4-1$ Error [f] 1+2-3*4/5 0.6 [f] one*two Error [g] 12345 £12,345.00 [g] a1-d3 Error (??) Test # two of debugged version: 1) Release the software on the LINK bulletin board system (run by Legalease) for evaluation by it's users. (the LINK is a special network for lawyers who often need maths functions in written work). 2) Collect commentary from the people willing to help. 3) Investigate and implement any changes or revisions necessary. Maintenance: I am the website administrator of the Wandle industrial museum (http://www.wandle.org). Established in 1983 by local people to ensure that the history of the valley was no longer neglected but enhanced awareness its heritage for the use and benefits of the community.
MORE RESOURCES: Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in /homepages/30/d188018125/htdocs/MarconiProject.com/software/inc/rss.inc on line 81 Warning: fopen(http://news.google.com/news?sourceid=navclient&ie=UTF-8&rls=GGLG,GGLG:2005-22,GGLG:en&q=Software&output=rss) [function.fopen]: failed to open stream: no suitable wrapper could be found in /homepages/30/d188018125/htdocs/MarconiProject.com/software/inc/rss.inc on line 81 could not open XML input |