Patent Description:
Generating code (e.g., macro code) from user operations in an electronic document application (e.g., a spreadsheet) may be beneficial as a user may then not need to perform the user operations again, but rather may execute the generated code. Additionally, it may be important for the user to be able to quickly understand and edit the generated code. Document <CIT>) discusses the possibility of recording an action that has been indicated by the user to be recorded, and reformatting that action into code for a macro, and further discusses that the actions interpreted from the user input may be converted into commands that the macro can later feed to applications when it is run. These commands are considered to be code-generated for the macro. This document does not discuss anything other than interpreting respective actions into commands for respective macros, and does not disclose or suggest combining multiple operations.

The present disclosure is illustrated by way of example and not limitation in the figures of the accompanying drawings, where the embodiments illustrated in <FIG> do not fall under the scope of protection of the present claims, in which like references indicate similar elements and in which:.

The following description and the drawings sufficiently illustrate specific embodiments to enable those skilled in the art to practice them. Other embodiments may incorporate structural, logical, electrical, process, and other changes. Portions and features of some embodiments may be included in, or substituted for, those of other embodiments. Disclosed in some examples are methods, systems, devices, and machine-readable mediums for aliasing entities in recorded code. A user may use an electronic document application (e.g., a spreadsheet) and a recorder application (e.g., a macro recorder). The user enters input into the electronic document application that causes the electronic document application to perform operations, e.g. cells of a spreadsheet to be edited, values of cells of a spreadsheet to be added, etc. The electronic document application may record indications of the operations that were caused by the input of the user.

The electronic document application may send indications of the operations to the recorder application, which may record the indications of the operations. The recorder application may generate code (e.g., macro code) that when executed by the recorder application causes the operations to be performed within the electronic document application. The code generated by the recorder application may use an application program interface (API) of the electronic document application to cause the operations to be performed within the electronic document application. A user may be able to view and/or edit the code generated by the recorder application.

The operations may operate on objects or entities within the electronic document application. The recorder application combines two or more operations based on whether the two or more operations are combinable. For example, the operations may reference cells in a spreadsheet and the recorder application may determine that the operations are combinable using a range of cells expression. The recorder application may determine not to combine operations even if they can be combined in order to improve the readability of the generated code for a user. A technical problem is how to reduce the number of operations that are performed by the generated code.

Combining operations has the technical effect of reducing the number of operations that are performed by the generated code. Additionally, combining operations may make the generated code more readable as the combined code may be more concise.

<FIG> illustrates a system for combining recorded operations and aliasing entities in recorded code <NUM>, in accordance with some embodiments. Illustrated in <FIG> is electronic document application <NUM>, event <NUM>, command <NUM>, response <NUM>, and recorder application <NUM>. The electronic document application <NUM> may be a spreadsheet, word processor, presentation program, etc. An example of the electronic document application <NUM> is EXCEL®. The electronic document application <NUM> includes a user interface module <NUM>, document/spreadsheet <NUM>, API module <NUM>, and operation <NUM>.

The user interface module <NUM> presents a user interface for a user (not illustrated) to enter input to the electronic document application <NUM>. The input to the electronic document application <NUM> may cause an operation <NUM> to be performed by the electronic document application <NUM>. The document/spreadsheet <NUM> is a document or spreadsheet that the electronic document application <NUM> is editing or creating. The document/spreadsheet <NUM> may be another type of object, e.g., a slide. Entity <NUM> may be a portion of the document/spreadsheet <NUM>, e.g., a cell, a sheet, a table, a selection of cells, etc. An entity <NUM> may be an object separate from the document/spreadsheet <NUM>, e.g., metadata. An entity <NUM> may have an identification (id) associated with the entity <NUM> that identifies the entity <NUM> and may be used to access the entity <NUM>. Example entities <NUM> of a spreadsheet include charts, sheets, shapes, etc., in accordance with some embodiments. The electronic document application <NUM> may send a command <NUM> to the recorder application <NUM>. For example, the user interface module <NUM> may present a menu item for the user that when selected sends a command <NUM> to the recorder application <NUM> with an indication that the recorder application <NUM> should start <NUM>. The recorder application <NUM> may send a response <NUM> to the electronic document application <NUM> such as recording begun or initialization complete.

Operation <NUM> is an indication of an operation performed within the electronic document application <NUM>, e.g., set a cell of a spreadsheet to a value, format a cell, create a new spreadsheet sheet, get a value of a cell of a spreadsheet, etc. The operation <NUM> may include a range <NUM> that indicates the range that the operations should be operated on, e.g., range <NUM> may indicate one or more cells of a spreadsheet. The operation <NUM> may include a type <NUM> that indicates the type of operation <NUM>, e.g., bold, set color, cell value edits, and set background color, etc. Event <NUM> is broadcast to indicate an operation <NUM> has been performed within the electronic document application <NUM>. Events <NUM> may include operation <NUM>.

In some embodiments, events <NUM> includes information about the operation <NUM>, e.g., an identification of a sheet of a spreadsheet, an address of a cell of a sheet, a value that was used to set a cell, a format that was used to set a cell of a sheet, an indication that a new sheet was created, etc. See, for example, order list of operations <NUM>, operations <NUM>, <NUM>, <NUM>, etc..

The recorder application <NUM> includes macro recorder module <NUM>, event listener module <NUM>, code executer module <NUM>, and API module <NUM>. The recorder application <NUM> is a macro code recorder/player, in accordance with some embodiments. In some embodiments, the recorder application <NUM> uses an API module <NUM> to interact with the electronic document application <NUM> via events <NUM>, commands <NUM>, and responses <NUM>, in accordance with some embodiments. In some embodiments, the recorder application <NUM> uses a Task Pane, which enables the user to use view and modify code <NUM> as well as issue commands to the recorder application <NUM>. Event listener module <NUM> listens for or receives events <NUM>. Code executer module <NUM> may include API module <NUM>. The API module <NUM> may be a Microsoft Office Rich API. The API module <NUM> enables the code executor module <NUM> to execute operations <NUM> within the electronic document application <NUM> using the API module <NUM> of the electronic document application <NUM>. The code executer module <NUM> executes the code <NUM> generated by generate code module <NUM>. The code executer module <NUM> may send commands <NUM> to the electronic document application <NUM> such as operations <NUM> to be performed. The electronic document application <NUM> may send responses <NUM> to the commands <NUM> to the code executer module <NUM>, e.g., a pointer to a spreadsheet.

Macro recorder module <NUM> includes UI module <NUM>, metadata <NUM>, internal format <NUM>, ordered list of operations <NUM>, and generate code module <NUM>. The UI module <NUM> presents options for a user (or another program), e.g., start <NUM>, stop <NUM>, generate code, etc. In an example, where the electronic document application <NUM> is a spreadsheet, if a user selects start <NUM>, then the UI module <NUM> may cause a command <NUM> to be sent to the electronic document application <NUM> where the command <NUM> includes an indication of a start command. In response to receiving the command <NUM> that includes an indication of a start command, the electronic document application <NUM> may perform the following: fetch names of all sheets, tables, etc.; fetch name of selected sheet; fetch address of selected range, etc. The response <NUM> to the command <NUM> may be stored in metadata <NUM>. The metadata <NUM> may be information regarding a state of the electronic document application <NUM> before the recording of an operation <NUM> begins. Internal format <NUM> (<FIG>) is an example of metadata <NUM> that is retrieved from a spreadsheet.

In some embodiments, the macro recorder module <NUM> receives an event <NUM> from the event listener module <NUM> and transforms an operation <NUM> included in the event <NUM> into an internal format <NUM>. The internal format <NUM> is described herein (e.g., <FIG>) and facilitates the generation of code <NUM>. The macro recorder module <NUM> maintains an ordered list of operations <NUM> from the events <NUM>. The ordered list of operations <NUM> is an ordered list of operations <NUM> in an internal format, in accordance with some embodiments.

Generate code module <NUM> takes the ordered list of operations <NUM> and generates code <NUM>. The code <NUM> is a readable format that may be displayed by the UI module <NUM> to a user. The code <NUM> may have a script name <NUM> associated with the code <NUM>. The code <NUM> may be in JavaScript®, VisualBasic®, or another programming language that utilizes the API module <NUM> to perform operations <NUM> and access entities <NUM> within the electronic document application <NUM>. The code <NUM> replays the ordered list of operations <NUM>. The code <NUM> may be generated based on the metadata <NUM> as disclosed herein. Because the context may be different (e.g., the code may be executed in a different spreadsheet), the code <NUM> may replay the ordered list of operations <NUM>, but the result within the electronic document application <NUM> may not be exactly the same as when the input of the user caused the operations <NUM> to be performed by the electronic document application <NUM>.

In some embodiments, generate code module <NUM> is configured to add extra code <NUM> preceding an operation <NUM> that references an entity <NUM> with an alias <NUM>. For example, as disclosed in conjunction with <FIG> code <NUM> is added to set alias <NUM> "sheet" to entity <NUM> "SheetID: <ID1>". In some embodiments, generate code module <NUM> generates code <NUM> to set an alias <NUM> for operations <NUM> that create an entity <NUM>. For example, referring to <FIG>, code <NUM> sets alias <NUM> "table" to a value of the table created by "createtable" of operation <NUM>.

Optimization module <NUM> may perform one or more optimizations of the code <NUM>. For example, optimization module <NUM> may include aliasing <NUM> and combining <NUM>. The optimization module <NUM> may be performed during the generation of the code <NUM> by generate code module <NUM>. Generate code module <NUM> may generate a code tree <NUM> as an intermediary step in generating the code <NUM>. In some embodiments, generate code module <NUM> generates a code tree <NUM> with each node comprising a code snippet with placeholders (e.g., "EntityKeyWrapper[id]". ) Entity <NUM> information may be stored in entity information <NUM>, which may include names and ids of entities <NUM>. Entity information <NUM> may be used as part of generating the code <NUM>. Entity information <NUM> may include alias <NUM> for an entity <NUM>. The alias <NUM> may be a name to use in the code <NUM> to refer to entity <NUM> in the electronic document application <NUM>. In some embodiments, generate code module <NUM> processes the code tree <NUM> in an inorder traversal where for each node the following is performed. For each placeholder, if an alias has not yet been generated, create one. Use the entity information <NUM> for the details if an alias has been created. Replace placeholders with the alias for that placeholder's id. Then all the resulting strings are concatenated together to create the code <NUM>. In some embodiments, an operation may be termed an action.

The embodiments illustrated in <FIG> do not fall under the scope of protection of the present claims. <FIG> illustrates a method <NUM> for aliasing entities in macro recorded code, in accordance with some embodiments. <FIG> will be disclosed in conjunction with <FIG>. The method <NUM> begins at operation <NUM> with starting. For example, start <NUM> may be selected on the UI module <NUM> (or user interface module <NUM>). The recorder application <NUM> may retrieve metadata <NUM> from the electronic document application <NUM> as described in conjunction with <FIG>. <FIG> illustrates the operation of a method <NUM> for aliasing entities in macro recorded code, in accordance with some embodiments. Illustrated in <FIG> is events <NUM>, ordered list of operations <NUM>, and internal format <NUM>. The events <NUM> may be the same or similar as events <NUM> of <FIG>. The ordered list of operations <NUM> may be the same or similar as ordered list of operations <NUM> of <FIG>. The internal format <NUM> may be the same as similar as internal format <NUM> of <FIG>. In another example of operation <NUM>, start event <NUM> may be received by the recorder application <NUM>, e.g., by event listener module <NUM>.

The method <NUM> continues at operation <NUM> with fetching and storing context data. For example, the recorder application <NUM> may retrieve internal format <NUM> from the electronic document application <NUM> and store it as metadata <NUM>. The internal format <NUM> or metadata <NUM> may include one or more of the following: an indication of the operation <NUM>, "OPERATION: 'START‴; information regarding an entity <NUM> with ID <NUM> being "id1" with the following specific information: name: 'Sheet <NUM>', code to access: "context. getItem('id1')", and isAssignment equal to "false"; information regarding another entity <NUM> with ID <NUM> being "id2" with the following specific information: name: "Sheet <NUM>", codeToAccess: "context. getItem("id2")", isAssignment: false; and, with an indication that a script name <NUM> is "MyScript". Internal format <NUM> or metadata <NUM> indicates that there are two sheets already created "SHEET <NUM>" ("ID1") and "SHEET <NUM>" ("ID2").

The method <NUM> may continue at operation <NUM> with receiving event. For example, referring to <FIG>, add sheet <NUM> may be received. The method <NUM> may continue at operation <NUM> with determining UI event type. For example, recorder application <NUM> may determine that add sheet <NUM> is not an event <NUM> of type stop. The method <NUM> may continue at operation <NUM> with convert to internal format. For example, the macro recorder <NUM> may convert add sheet <NUM> to: "Operation: 'add sheet' and worksheetid:'id3‴. The operation <NUM> is "add sheet' and the ID <NUM> of the entity <NUM> worksheet that is created is "id3". The method <NUM> continues at operation <NUM> with storing in ordered list. For example, internal format <NUM> may be added to ordered list of operations <NUM>.

The method <NUM> returns to operation <NUM> with receiving event. For example, referring to <FIG>, edit cell <NUM> may be received. The method <NUM> may continue at operation <NUM> with determine UI event type. For example, recorder application <NUM> may determine that edit cell <NUM> is not an event <NUM> of type stop. The method <NUM> may continue at operation <NUM> with convert to internal format. For example, the macro recorder <NUM> may convert edit cell <NUM> to: "Operation: 'edit cell'; worksheetId: 'id3'; address: 'A1'; and values: 'kitty‴. These indicate that the operation <NUM> is "edit cell' and that an ID <NUM> of the entity <NUM> worksheet that is edited is "id3". The method <NUM> continues at operation <NUM> with storing in ordered list. For example, internal format <NUM> may be added to ordered list of operations <NUM>.

The method <NUM> returns to operation <NUM> with receiving event. For example, referring to <FIG>, edit cell <NUM> may be received. The method <NUM> may continue at operation <NUM> with determine UI event type. For example, recorder application <NUM> may determine that edit cell <NUM> is not an event <NUM> of type stop. The method <NUM> may continue at operation <NUM> with convert to internal format. For example, the macro recorder <NUM> may convert edit cell <NUM> to: "Operation: 'edit cell'; worksheetId: 'id2'; address: 'B3'; and values: 'puppy‴. These indicate that the operation <NUM> is "edit cell' and that an ID <NUM> of the entity <NUM> worksheet that is edited is "id2". The method <NUM> continues at operation <NUM> with storing in ordered list. For example, internal format <NUM> may be added to ordered list of operations <NUM>.

The method <NUM> returns to operation <NUM> with receiving event. For example, referring to <FIG>, end recording <NUM> may be received. The method <NUM> may continue at operation <NUM> with determine UI event type. For example, recorder application <NUM> may determine that end recording <NUM> is an event <NUM> of type stop. A user may have selected stop <NUM> in the UI module <NUM> (or user interface module <NUM>).

The method <NUM> may continue at operation <NUM> with stopping. For example, the macro recorder <NUM> may stop recording. The method <NUM> may continue at operation <NUM> with generating code. For example, <FIG> and <FIG> illustrate an embodiment of generating code from the ordered list of operations <NUM>.

<FIG> illustrates generation of a code tree <NUM>, in accordance with some embodiments. Illustrated in <FIG> is ordered list of operations <NUM>, internal format <NUM>, and code tree <NUM> comprising nodes <NUM>. The nodes <NUM> are <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, and <NUM>. Generate code module <NUM> generates the code tree <NUM> (e.g., code tree <NUM>) from the ordered list of operations <NUM> (e.g., internal format <NUM>). The arrows <NUM> indicate the nodes <NUM> that are generated from the internal format <NUM>. For example, generate code module <NUM> generates nodes <NUM>, <NUM>, <NUM>, and <NUM> from internal format <NUM>. Node <NUM> names the code and entities. Node <NUM> waits for the electronic document application <NUM> (e.g., Excel®) and defines the entities. Node <NUM> closes the code and defines the entities. Node <NUM> completes the code close and defines the entities. The code may be determined based on JavaScript® or another programming language. The code is determined based on the API module <NUM> to access the electronic document application <NUM>. For example, "context. worksheets. add()" of node <NUM> is a call to an API module <NUM> routine to add a sheet to a spreadsheet. The API module <NUM> of the electronic document application <NUM> may provide entry routines for the recorder application <NUM> to call using the API module <NUM>.

Generate code module <NUM> generates node <NUM> from internal format <NUM>, where node <NUM> includes code to perform the operation of adding a sheet of a spreadsheet. Generate code module <NUM> determines that internal format <NUM> is adding a sheet ("Operation: 'add sheet‴) that was not created at the start of the script, i.e., it is not part of internal format <NUM>. Generate code module <NUM> determines the code should be "let EntityKeyWrapper[id3] = context. worksheets. add()," where "EntityKeyWrapper[id3]" is place holder for the sheet or alias.

Generate code module <NUM> generates node <NUM> from internal format <NUM> where a reference to the sheet created in node <NUM> is used, i.e., "newWorksheet. " Node <NUM> includes code to perform the edit cell in accordance with internal format <NUM>. Node <NUM> includes code to perform edit cell in accordance with internal format <NUM>. Generate code module <NUM> generates node <NUM> based on the sheet being referenced ("worksheetid:'id2‴) already existing when the start <NUM> was selected.

After the code tree <NUM> is generated, generate code module <NUM> generates code <NUM>. <FIG> illustrates code tree <NUM>, nodes <NUM>, code <NUM>, and inorder traversal <NUM>, in accordance with some embodiments. Inorder traversal <NUM> indicates that generate code module <NUM> traverses the code tree <NUM> inorder to generate the code <NUM>. An inorder traversal <NUM> is to traverse a code tree <NUM> by first visiting nodes <NUM> in the following order: a left child node, a node, and a right child node, where the procedure is performed recursively. The order of the nodes <NUM> of the code tree <NUM> as illustrated in <FIG> is of an inorder traversal.

Generate code module <NUM> generates code <NUM> from node <NUM>, code <NUM> from <NUM>, code <NUM> from <NUM>, code <NUM> from <NUM>, code <NUM> from node <NUM>, code <NUM> from node <NUM>, and code <NUM> from node <NUM>. The alias (e.g., alias <NUM>) "newWorksheet" is created by code <NUM>. The id "id3" may be used within the electronic document application <NUM> to reference "newWorksheet. " "Id3" is used to determine the name to use from node <NUM>, e.g., "newWorksheet. " Code <NUM> uses the alias "newWorksheet" to edit cell A1 to the value of "kitty. " Code <NUM> uses the alias "Sheet_2" to edit cell B3 to the value of "puppy.

Because isAssignment is true in node <NUM>, which indicates a sheet create, generate code module <NUM> does not explicitly generate a line of code to create the alias "newWorksheet. " The alias "newWorksheet" is assigned as a byproduct of the operation the user is taking, i.e., code <NUM>.

In node <NUM> a sheet with id "id2" is being accessed without first an assignment, i.e., "isAssignment: false. " This means the sheet with id "id2" already exists. Generate code module <NUM> first generates a line of code that sets "Sheet_2" to the value of codeToAccess (from node <NUM>), "context. getitem("id2"). And then generate code module <NUM>, generates a line of code to edit cell B3 of "Sheet_2" to the value "puppy". The code <NUM> may then be executed to recreate the events <NUM>.

The method <NUM> may continue with displaying code <NUM>. For example, recorder application <NUM> or macro recorder <NUM> may display the code <NUM> generated as part of a UI module <NUM>. The code executer module <NUM> may execute the code <NUM>, which may produce the same results as events <NUM>. In some embodiments, the code <NUM> may be saved and used on another spreadsheet of the electronic document application <NUM>.

The method <NUM> may include one or more additional operations. One or more of the operations of method <NUM> may be optional. The operations of method <NUM> may be performed in a different order, in accordance with some embodiments.

<FIG> illustrates macro code <NUM>, in accordance with some embodiments. The macro code <NUM> may be in Visual Basic®. The macro code <NUM> does not include aliases. For example, "ActiveCell. FormulaR1C1 = '<NUM>‴ implicitly is referring to an active sheet, which is "Sheet2". The macro code <NUM> may not run properly if it were executed by code executor <NUM>. For example, if macro code <NUM> were run a second time, then the next "Sheets. Add After := ActiveSheet" would be set to "Sheet3". But the next line of macro code would be "Sheets('Sheet2'). Select", so "Sheet2" would be selected. The rest of the operations would be performed on "Sheet2" rather than "Sheet3. " Or if "Sheet2" has been renamed or deleted (or the macro code <NUM> run in a new spreadsheet), then the macro code <NUM> would most like not operate properly because "Sheets(` Sheet2'). Select" would fail.

In some embodiments, the macro code is generated so that when an entity <NUM> is referenced, then an alias <NUM> is used to refer to the entity <NUM>. User interface module <NUM> constructs or operations <NUM> such as select or activate (e.g., operations <NUM> that set a default or implicit entity <NUM> such as a sheet) are not used in the macro code, in accordance with some embodiments.

<FIG> illustrates macro code <NUM>, in accordance with some embodiments. The macro code <NUM> may be in Visual Basic®. The macro code <NUM> may be easier for a user to read than the macro code <NUM> due to the additions of aliases. The alias "sheet" is set to "context. worksheets. This enables the following operations to use the alias "sheet. " Additionally, the alias "body" is set to "sheet. getRange("A2:B3")". This enables the subsequent operation to use the alias "body. " Additionally, "chart" is set to "sheet. add (Excel. barClustered, body)". This enables subsequent operations to use the alias "chart. " The use of aliases may make the macro code <NUM> more portable as easier to understand.

<FIG> illustrates the operation of a method for aliasing entities in macro recorded code where an extra code line is not generated, in accordance with some embodiments. Illustrated in <FIG> is electronic document application <NUM>, operations <NUM>, and code <NUM>. Electronic document application <NUM> may be the same or similar as electronic document application <NUM>. Operations <NUM> may be the same or similar as operations <NUM>. Code <NUM> may be the same or similar as code <NUM>. The operations <NUM> may be generated based on (referring to <FIG>) a user generating events <NUM> from the use of the user interface module <NUM>. In some embodiments the operations <NUM> have been partially or wholly processed into an internal format <NUM>. The code <NUM> is code (e.g., Visual Basic®) generated by generate code module <NUM>.

Generate code module <NUM> generates an alias "sheet" in code <NUM> for "addsheet" in operation <NUM>. The alias "sheet" enables the other code <NUM>, <NUM> to use the alias "sheet" rather than using a default or implicit sheet of the electronic document application <NUM>. Generate code module <NUM> can create the alias "sheet" without an extra line because the operation <NUM> is creating the sheet within the electronic document application <NUM>. Generate code module <NUM> generates code <NUM> from operation <NUM> where rather than using an implicit sheet of electronic document application <NUM>, the alias "sheet" is used explicitly. Generate code module <NUM> generates code <NUM> from operation <NUM> where the alias "sheet" is used rather than using an implicit sheet of electronic document application <NUM>.

<FIG> illustrates the operation of a method for aliasing entities in macro recorded code where an extra code line is generated, in accordance with some embodiments. Illustrated in <FIG> is electronic document application <NUM>, operations <NUM>, and code <NUM>. Electronic document application <NUM> may be the same or similar as electronic document application <NUM>. Operations <NUM> may be the same or similar as operations <NUM>. Code <NUM> may be the same or similar as code <NUM>. The operations <NUM> may be generated based on (referring to <FIG>) a user generating events <NUM> from the use of the user interface module <NUM>. In some embodiments the operations <NUM> have been partially or wholly processed into an internal format <NUM>. The code <NUM> is code (e.g., Visual Basic®) generated by generate code module <NUM>. In response to operation <NUM>, generate code module <NUM> generates an alias <NUM> "sheet" in code <NUM> that "add[s]" a sheet. The alias <NUM> "sheet" enables the other code <NUM>, <NUM> to use the alias <NUM> "sheet" rather than using a default or implicit sheet of the electronic document application <NUM>. Generate code module <NUM> needs an extra line of code <NUM> because the operation <NUM> is using a sheet "<ID1>" that is already created. Generate code module <NUM> generates code <NUM> from operation <NUM> where rather than using sheet ("sheeted: <id1>") of electronic document application <NUM>, the alias <NUM> "sheet" is used. Generate code module <NUM> generates code <NUM> from operation <NUM> where the alias <NUM> "sheet" is used rather than using an implicit sheet of electronic document application <NUM>. The code <NUM> may be more portable as it creates a "sheet" that is not dependent on a sheet ("sheetID:<ID1>") already existing within the electronic document application <NUM>. The code <NUM> may be more readable as the code <NUM>, <NUM>, and <NUM>, explicitly reference the alias <NUM> "sheet" so that it is clear which sheet is being referenced.

<FIG> illustrates the operation of a method for aliasing entities in macro recorded code where extra code lines are generated, in accordance with some embodiments. Illustrated in <FIG> is electronic document application <NUM>, operations <NUM>, and code <NUM>. Electronic document application <NUM> may be the same or similar as electronic document application <NUM>. Operations <NUM> may be the same or similar as operations <NUM>. Code <NUM> may be the same or similar as code <NUM>. The operations <NUM> may be generated based on (referring to <FIG>) a user generating events <NUM> from the use of the user interface module <NUM>. In some embodiments the operations <NUM> have been partially or wholly processed into an internal format <NUM>. The code <NUM> is code (e.g., Visual Basic®) generated by generate code module <NUM>. In response to operation <NUM>, generate code module <NUM> generates code <NUM>, <NUM>, and <NUM>. Generate code module <NUM> generates an alias <NUM> "sheet" in code <NUM> that provides an alias <NUM> "sheet" for "sheeted: <ID1>" of electronic document application <NUM>. Generate code module <NUM> generates code <NUM> with an alias <NUM> "range" for "range:'A1:C3‴ of operation <NUM>. The alias <NUM> "range" enables "range" to be used in the code <NUM>. Generate code module <NUM> generates code <NUM> with an alias <NUM> "table" that enables the alias <NUM> "table" to be used in code <NUM>.

Generate code module <NUM> generates code <NUM> to use the alias <NUM> "table. " The code <NUM> may be more readable as the code <NUM>, <NUM>, <NUM>, and <NUM>, explicitly reference the aliases "sheet", "range", and "table" so that there are not implicit references to entities <NUM> within electronic document application <NUM>.

<FIG> illustrates a method <NUM> for aliasing entities in recorded code, in accordance with some embodiments. Method <NUM> begins at operation <NUM> with receiving an event from an electronic document application, the event indicating an operation within the electronic document application. For example, referring to <FIG>, recorder application <NUM> may receive event <NUM> from electronic document application where the event <NUM> indicates an operation <NUM>. In another example, referring to <FIG>, recorder application <NUM> may receive events <NUM> with indications of operations within electronic document application <NUM>, e.g., add sheet <NUM>. In another example, referring to <FIG>, <FIG>, and <FIG>, application <NUM> may receive operations <NUM>, <NUM>, <NUM>, from electronic document application <NUM>. In another example, referring to <FIG>, method <NUM> may be performed by recorder application <NUM> where at operation <NUM> an event that includes an operation is received from electronic document application <NUM>.

The method <NUM> continues at operation <NUM> with generating code that when executed performs the operation within the electronic document application. For example, referring to <FIG>, generate code module <NUM>, generates code <NUM> that when executed (e.g., code executer module <NUM>) performs the operation <NUM> indicated in the event <NUM>. In another example, operation <NUM> as disclosed in conjunction with <FIG>, generates code <NUM> that when executed (e.g., code executer module <NUM>) performs operation <NUM> within the electronic document application <NUM>. In another example, referring to <FIG>, generate code module <NUM> generates code <NUM> from code tree <NUM>. The code <NUM> performs operations (e.g., "edit cell" <NUM>) within electronic document application <NUM>. In another example, code <NUM> is an example of code that may be generated by generate code module <NUM> that include code that execute operations <NUM> within the electronic document application <NUM>, e.g., "sheet. getRange("B2"). values = [[<NUM>]]". In other examples, code <NUM>, <NUM>, <NUM>, illustrate code (e.g., <NUM>, <NUM>, <NUM>) that when executed performs operations within the electronic document application <NUM>.

The method <NUM> continues at operation <NUM> with in response to the operation indicating generation of an object within the electronic document application, generating the code to include code to set a variable within the code to a value of the object. For example, in response to operation "add sheet" <NUM> (<FIG>) generate code <NUM> generates code <NUM> "let newWorksheet = context. worksheets. " In another example, referring to <FIG>, generate code module <NUM> from operation <NUM> "operation:addsheet sheeted: <id1>" generates code <NUM> "let sheet = context. worksheets. " Similarly, generate code module <NUM> generates code <NUM> from operation <NUM>.

The method <NUM> continues at operation <NUM> with in response to the operation indicating a change to the object, generating the code to perform the operation with a reference to a name of the variable. For example, generate code module <NUM> (<FIG>) generates code <NUM> (<FIG>) that references "newWorksheet". In another example, generate code module <NUM> generates code <NUM> and <NUM> (<FIG>) to reference "sheet. " In another example, generate code module <NUM> generates code <NUM> and <NUM> (<FIG>) to reference "sheet". In another example, generates code module <NUM> generates code <NUM> to reference "sheet," and generates code <NUM> and <NUM> to reference "table.

Method <NUM> may be performed on a computing device that includes a processor and memory comprising instructions which when performed by the processor, cause the processor to perform operations of method <NUM>. Method <NUM> may include one or more additional operations. One or more of the operations of method <NUM> may be optional. Method <NUM> may be performed in a different order.

Method <NUM> begins at operation <NUM> with in response to the operation indicating generation of a first object within the electronic document application, generating a first line of code that when executed within an operation recorder application generates the first object within the electronic document application and sets a first variable to a first value of the first object within the operation recorder application. For example, in response to operation "add sheet" <NUM> (<FIG>) generate code <NUM> generates code <NUM> (<FIG>) "let newWorksheet = context. worksheets. " In another example, referring to <FIG>, generate code module <NUM> in response to operation <NUM> "operation:addsheet sheeted: <id1>" generates code <NUM> "let sheet = context. worksheets. " Similarly, generate code module <NUM> generates code <NUM> from operation <NUM>.

The method <NUM> may continue at operation <NUM> with in response to the operation indicating a reference to a second object within the electronic document application and a second value of the second object not being set to a second variable within the operation recorder application, generating a second line of code that when executed sets the second variable to the second value of the second object within the operation recorder application, and generating a third line of code that when executed within the operation recorder application performs the operation within the electronic document application, where the second object is referenced using the second variable in the third line of code. For example, generate code module <NUM> (<FIG>) in response to event "edit cell" <NUM> where a value of "worksheetid: 'id2‴ is not set to an alias or second variable (e.g., "sheet_2"), generates code <NUM> (<FIG>) with (second line of code) "let Sheet_2 = " and (third line of code) "sheet_2. In another example, generate code module <NUM> (<FIG>) in response to operation <NUM> where "sheetID: <ID1>" is not set to an alias or second variable (e.g., "sheet"), generates code <NUM> (second line of code) "let sheet =. " and code <NUM> (third line of code) ""sheet. In another example, generate code module <NUM> (<FIG>) in response to operation <NUM> (<FIG>) where a value of "sheetID: <id1>" is not set to an alias or second variable (e.g., "sheet") generates code <NUM> (second line of code) "let sheet. " and code <NUM> (third line of code) "Let range = sheet.

The method <NUM> continues at operation <NUM> with in response to the operation not generating the first object and not indicating the reference to the second object, generating a fourth line of code that when executed within the operation recorder application performs the operation within the electronic document application. For example, if operation <NUM> and <NUM> are not applicable, then operation <NUM> is performed if there is operation received. For example, generate code module <NUM> (<FIG>) may generate code <NUM> (<FIG>) in response to event <NUM> where "newworksheet" has already been set to a value in code <NUM> and event <NUM> is not generating a new sheet (e.g., object). In another example, generate code module <NUM> (<FIG>) may generate code <NUM> that includes code such as "sheet. getRange('A1'). " where "sheet" has already been set to a value and is not generating a new sheet (e.g., object). In another example, generate code module <NUM> (<FIG>) may generate code <NUM> (<FIG>) from operation <NUM> since "sheet" has already been set to a value and the operation <NUM> is not generating a newssheet.

<FIG> and <FIG> will be disclosed in conjunction with one another. <FIG> illustrates a method <NUM> of combining recorded operations, in accordance with some embodiments. The method <NUM> may be an embodiment of generate code <NUM> (<FIG>), in accordance with some embodiments. Referring to <FIG>, the method <NUM> may be an embodiment of combining <NUM>, in accordance with some embodiments. In some embodiments, the method <NUM> begins after a stop <NUM> from the UI module <NUM>. The operations <NUM> (or <NUM> of <FIG>) may be from a sequence of events <NUM> received by the recorder application <NUM> after a start <NUM> is selected from the UI module <NUM>.

Method <NUM> begins at operation <NUM> with combining operations based on the combinability of the operations into groups. For example, <FIG> illustrates an example of operation <NUM>. <FIG> illustrates the operation of a method of combining recorded operations, in accordance with some embodiments. Illustrated in <FIG> is events <NUM>, operations <NUM>, buckets <NUM>, and combined ranges <NUM>. Events <NUM> may be the same or similar as events <NUM> of <FIG>. Operations <NUM> may be the same or similar as operations <NUM> of <FIG>. Buckets <NUM> may be combined operations <NUM>. Combined ranges <NUM> may be ranges that have been combined based on the operations <NUM> that have been combined together.

Buckets <NUM> may be an example of recorded operations (e.g., operations <NUM>) being combined based on the combinability of the operations (e.g., operations <NUM>) into groups (e.g., buckets <NUM>). The buckets <NUM> are determined based on the type <NUM> (<FIG>) of operation <NUM>, e.g., bucket <NUM> is of type <NUM> "cell value edits. " The buckets <NUM> may also be determined based on other factors, e.g., if there is an interruption operation <NUM>, then operations <NUM> may be placed in separate buckets <NUM> even if the operations <NUM> are a same type <NUM>. Interruptions operations <NUM> may include creation of a chart, creation of a table, creation of sheet, etc..

The combinability may be based on whether the operations <NUM> can have combined ranges (e.g., range <NUM> of <FIG>) within the electronic document application <NUM>. For example, the combinability may be based on whether the ranges can be combined in a range <NUM> of the operation <NUM>. The combinability may depend on how many cells of a spreadsheet that are included in the range <NUM> are null or not operations <NUM> of a same type <NUM>. For example, there may be cells that the operations <NUM> are not performed on or there may be intervening operations <NUM> with a different type <NUM>.

The combinability of operations <NUM> may depend on more than just a type of the operation <NUM>, e.g., for the operation <NUM> "bold", only operations that are setting the "bold" to "true" may be combinable, in accordance with some embodiments. A bucket <NUM> is generated for each of the different types of operations <NUM> that are combinable, e.g., as illustrated "edit", "bold", and "color". As illustrated operations <NUM>, <NUM>, and operation <NUM> are combined into bucket "cell value edits" <NUM>; operations <NUM>, <NUM>, and <NUM> are combined into bucket "cell bold = true" <NUM>; and, operation <NUM> is combined into bucket "cell color = true" <NUM>.

The method <NUM> may continue at operation <NUM> with sorting operations within groups based on geographical adjacency or temporal adjacency. For example, operation <NUM>, <NUM>, and <NUM> may be sorted within bucket <NUM> based on geographic adjacency (e.g., based on the cell locations within a spreadsheet) so that operation <NUM> is first as it references cell A1, operation <NUM> may be second as it references cell A2, and operation <NUM> may be last as it references cell J9. Similarly bucket <NUM> may be sorted based on geographic adjacency. Bucket <NUM> only has one entry. In some embodiments, the operations <NUM> may be sorted based on temporal adjacency. In some embodiments, the operations <NUM> may be sorted based on temporal adjacency as well as geographic adjacency. For example, if operation <NUM> was performed after operation <NUM> and there were several operations <NUM> between the performance of operation <NUM> and <NUM>, then operation <NUM> may be in a sort order before operation <NUM>. In some embodiments, a new bucket <NUM> may be created after a threshold number of operations <NUM> so that operations <NUM> that are not temporally adjacenct are not combined. In some embodiments, a new bucket <NUM> may be created if an operation is performed that separates the operations <NUM>, e.g., an interruption operation may separate the operations.

In some embodiments, the buckets <NUM> may be determined based on user expectation, e.g., only one bucket <NUM> for combinable operations <NUM> performed in a sequence, e.g., cell edits or cell formats. In some embodiments, operations <NUM> may be determined not to be combinable based on operations <NUM> that are performed between the operations <NUM>. For example, if one or more predefined operations <NUM> are performed between operations <NUM> that would be combinable otherwise, they may be determined not to be combinable. For example, operations <NUM> and <NUM> are combinable as illustrated, but if they were separated by a predetermined operation, e.g., interruption operation, they may be determined not to be combinable. The predetermined operation or interruption operation may include creation of a chart, table, or sheet, or an entity edit such as chart formatting or sheet renaming. If operations <NUM> that would be combinable if they were next to one another are determined to be not combinable based on operations <NUM> that are intervening operations, then an additional bucket <NUM> may be created with one bucket <NUM> for the operations before the predetermined operation and one for the operations <NUM> after the predetermined operation.

<FIG> and <FIG> are disclosed in conjunction with <FIG> and <FIG>. <FIG> illustrates the operation of a method of combining recorded operations, in accordance with some embodiments. Illustrated in <FIG> is code <NUM>, <NUM>, <NUM>, combining recorded operations <NUM>, and code with combined ranges <NUM>, <NUM>, and <NUM>. The code <NUM> is processed by combining recorded operations <NUM> (e.g., <NUM>, <NUM>, <NUM>, <NUM>) that combines recorded operations <NUM> to generate code with combined ranges <NUM>. The code <NUM> may be code <NUM> (<FIG>). In some embodiments, the code <NUM> is generated from operations <NUM> of events <NUM>, and then it is optimized (e.g., combining <NUM>). In some embodiments, combining recorded operations <NUM> works an internal format (e.g., <NUM>) before code <NUM> (or code <NUM>) is generated.

Code <NUM> has operations <NUM> that are all combinable (e.g., the range <NUM> is combinable and the operations <NUM> are all the same type of assigning a cell a value. ) Code <NUM> is not all combinable. The code <NUM> that includes formatting for "format. bold" is combinable (e.g., range <NUM> is combinable to "A1:B1" and the operations <NUM> are all of the same type) and would get a separate bucket <NUM>. The code <NUM> for "format. color" is combinable (e.g., range <NUM> is combinable to "A2:A4" and the operations <NUM> are all of the same type) and would get a separate bucket <NUM>. The code <NUM> for "format. italic" is combinable (e.g., range <NUM> is combinable to "B2:B4" and the operations <NUM> are all of the same type) and would get a separate bucket <NUM>.

<FIG> illustrates the operation of a method of combining recorded operations, in accordance with some embodiments. Illustrated in <FIG> is code <NUM>, <NUM>, <NUM>, <NUM>, combine recorded operations <NUM>, and code with combined ranges <NUM>, <NUM>, <NUM>, and <NUM>. The code <NUM> is processed by combine recorded operations <NUM> (e.g., <NUM>, <NUM>, <NUM>, <NUM>) that combines recorded operations <NUM> to generate code with combined ranges <NUM>.

Code <NUM> and <NUM> would be combinable into a range "A1:B4" with the operations <NUM> all being the same. However, due to intermediary operations of code <NUM>, the method (e.g., <NUM> or another disclosed herein) determines not to combine code <NUM> and code <NUM>, and instead generates code with combined ranges <NUM>, <NUM>. The code <NUM> that includes "values" is combinable (e.g., range <NUM> is combinable to "A1:B2" and the operations <NUM> are all of the same type) and would get a separate bucket <NUM>, in accordance with some embodiments. The code <NUM> that includes "values" is combinable (e.g., range <NUM> is combinable to "A3:B4" and the operations <NUM> are all of the same type) and would get a separate bucket <NUM>, in accordance with some embodiments. In some embodiments, operation <NUM> of method <NUM> may generate a new bucket <NUM> when the intermediary operations <NUM> are processed.

Method <NUM> may continue at operation <NUM> with for each current group of the groups. For example, referring to <FIG>, the method <NUM> may continue for each of the buckets <NUM>. Method <NUM> may continue with selecting an operation of the current group not combined and set it to a current combined operations (there may be only one operation in current combined operations), where the operation is selected based on the sort of the current group. For example, bucket <NUM> includes operations <NUM>, <NUM>, and <NUM>, where the operations <NUM> would be sorted in that order. Operation <NUM> would be the operation selected from the current group (bucket <NUM>). The sort may be based on the cells of a spreadsheet (e.g., <FIG> with a column of numbers <NUM> and a row of letters <NUM>).

Method <NUM> may continue at operation <NUM> for each operation of the current group not combined, determine whether to combine the operation with the current combined operations. For example, referring to <FIG>, operation <NUM> may be the current combined operations. Generate code module <NUM> may determine whether operations <NUM> and <NUM> should be combined with operation <NUM>. Generate code module <NUM> may determine to combine <NUM>, but not <NUM> since the address "J9" may not be determined to be combinable with "A1" and "A2". For example, if "J9" were combined with "A1" and "A2" then there would be too many cells that do not have an operation <NUM> associated with the cell, or there may be other operations <NUM> that are references the cells not referenced by an operation <NUM>. <FIG> provides examples of combining cells of a spreadsheet.

Method <NUM> may continue at operation <NUM> with, for each operation with a determination to combine the each operation with the current combined operations, combine the each operation to the current combined operations and determine the each operation is combined. For example, referring to <FIG>, operation <NUM> may be combined with operation <NUM> to generate combined ranges <NUM>, i.e., "set values in A1:A2" where "A1:A2" may be the range <NUM>. Operation <NUM> may be determined to be combined.

Method <NUM> continues at operation <NUM> with additional operations in the current group that are not combined. For example, referring to <FIG>, operation <NUM> is not combined and it was in the current group. The method <NUM> would return to operation <NUM> where operation <NUM> is selected to the current combined operations. Method <NUM> continues at operation <NUM> where nothing is done since there are no more operations <NUM> in the current group. Method <NUM> continues at operation <NUM> where generate code module <NUM> may generate combined ranges <NUM>, "set value in J9" where "J9" is range <NUM>.

Method <NUM> continues at operation <NUM> with additional operations in the current group that are not combined. Continuing with the example above, there are no more operations <NUM> as operations <NUM> and <NUM> were combined into combined ranges <NUM> and operation <NUM> was combined with no other operation into combined ranges <NUM>. Method <NUM> continues at "N" to operation <NUM> with additional groups. Continuing the example of <FIG>, there are more groups.

The method <NUM> continues at "Y" to operation <NUM> with for each current group of the groups. Continuing with the example above, the current group would be bucket <NUM>. The method <NUM> continues at operation <NUM>. Continuing with the example above, the operation selected would be <NUM> as is not combined and would be the first by a sort of the geography of a spreadsheet.

Method <NUM> would continue at operation <NUM>. Continuing the example above, generate code module <NUM> would determine to combine operations <NUM> and <NUM> as both have ranges <NUM> that are combinable with operation <NUM>.

Method <NUM> continues at operation <NUM>. Continuing the example above, generate code module <NUM> would generate combined ranges <NUM> with "set bold = true for A1:A3" where "A1:A3" is the range <NUM>. Method <NUM> continues at operation <NUM>. Continuing the example above, there are no additional operations in the current group (bucket <NUM>).

Method <NUM> continues at "N" to operation <NUM> additional groups. Continuing the example above, there is one more group. Method <NUM> continues to operation <NUM> where the each current group is set to bucket <NUM>.

Method <NUM> continues to operation <NUM>. Continuing the example above, there is only one operation <NUM> in bucket <NUM> (current group). Method <NUM> continues at operation <NUM>. Continuing the example above, there are no more operations in bucket <NUM> (current group). Method <NUM> continues at operation <NUM>. Combined ranges <NUM> is generated with "cell color = red for A1" where "A1" is the range <NUM>. Continuing the example above, there are no operations that were determined to be combined.

Method <NUM> continues to operation <NUM>. Continuing the example above, there are no additional operation <NUM> in bucket <NUM>. The method <NUM> continues to operation <NUM>. Continuing the example above, there is an additional bucket <NUM> (additional group). The method <NUM> continues to operation <NUM> and then to operation <NUM>. Continuing the example above, operation <NUM> is selected as it is the only operation <NUM> in the bucket <NUM> (group). The method <NUM> continues to operation <NUM>, <NUM>. Continuing the example above, generate code module <NUM> generates combined ranges <NUM> with "cell color = red for A1".

Method <NUM> continues to operation <NUM> and follows "N" since there are no additional operations in bucket <NUM>. Method <NUM> continues to operation <NUM> and follows "N" since there are no additional buckets <NUM> after bucket <NUM>. Method <NUM> may continue to end <NUM>.

<FIG> will be disclosed in conjunction with one another. <FIG> illustrates a method <NUM> of combining recorded operations, in accordance with some embodiments. Illustrated in <FIG> is lines <NUM>. <FIG> illustrates a method <NUM> of combining recorded operations, in accordance with some embodiments. Illustrated in <FIG> is lines <NUM>. <FIG> illustrates the operation of a method of combining recorded operations, in accordance with some embodiments.

Illustrated in <FIG> are cells <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, and <NUM>. The cells <NUM> are cells in a spreadsheet. Rows <NUM> are along a vertical axis and columns <NUM> are along a horizontal axis. The cells <NUM> indicate which cells have operations <NUM> that are combinable. For example, in cells <NUM>, a letter (X in this case) at row <NUM> and column B indicates there is an operation <NUM> that has been combined with other operations <NUM> indicated in cells <NUM> with an X. Referring to <FIG>, the six lines of code <NUM> that includes "A1", "B1", "A2", "B2", "A3", and "B3" would be represented by cells <NUM> (note, though that code <NUM> does not include the column <NUM> C). The Xs of cells <NUM> indicate that all the cells were combined into a range <NUM>. Similarly, the Ys of cells <NUM> indicate that all the cells were combined into a range <NUM>. A letter and "N" indicates that the corresponding cell has been joined in a range even though there is no operation <NUM> associated with the cell. For example, E2 of cells <NUM> is "X N", which indicates E2 is combined into a range <NUM> with B2, C2, D2, B3, C3, D3, and E3, but that there is no operation <NUM> associated with E2. In some embodiments, the cells <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, and <NUM> are the same or similar as buckets <NUM>.

In some embodiments, the method <NUM> of <FIG> is the same or similar as methods <NUM> or <NUM>. In some embodiments, the method <NUM> of <FIG> is the same or similar as method <NUM> or <NUM>. The methods <NUM> and <NUM> are in JScript®, in accordance with some embodiments. The methods <NUM> and <NUM> are in pseudo-code, in accordance with some embodiments. The method <NUM> begins at line <NUM> with a function definition where a parameter "edited_cells" are the cells of a spreadsheet to perform the method <NUM> on. For example, "edited_cells" may be operations <NUM> where "edited_cells" includes an operation <NUM> and range <NUM> the operation <NUM> is performed on. The "edited_cells" may already be sorted into operations <NUM> that are combinable, e.g., edit cells, format cells, etc. The "edited_cells" may be the same or similar as buckets <NUM>.

The method <NUM> continues with line <NUM> that sorts "edited_cells" by column value, e.g., referring to <FIG>, an operation <NUM> that references cell A1 would be before an operation that references cell B1. In some embodiments, the sort may be based on a different value than the column value, e.g., row value.

The method <NUM> continues at lines <NUM>, <NUM>, and <NUM> where each "cell" in "edited_cells" has a "used" value associated with it that indicates "false", which may be the same or similar as "combined" as disclosed in conjunction with the method <NUM>. Line <NUM> initializes "cell_map" for each "cell", which may be used to map between an index of a "cell" in "edited_cells" and a "cell address. " The "cell_map" may be the same or similar as cells <NUM>.

The method <NUM> continues at line <NUM> where "rectangles" is initialized. The method <NUM> continues at lines <NUM> through <NUM> with a loop for each "cell" in "edited_cells". For example, the loop may be performed for each cell that has an "X" or "Y" in <FIG>. In another example, the loop may be performed for each operation <NUM> of events <NUM>. Lines <NUM> and <NUM> test to see if the "cell" is used and move to the next "cell" if the cell has been used. Lines <NUM> through <NUM> are an embodiment of operation <NUM>, in accordance with some embodiments.

Line <NUM> sets "cell" used to true so that a "cell" is only examined once. Line <NUM> initializes a "rect" to a smallest size. Lines <NUM> through <NUM> attempt to grow the smallest size "rect. " The "rect" is attempted to be grown "right", "down", and "up". Left is not needed because the "cells" are sorted according to columns, e.g., <NUM>.

When a "rect" has been grown as much as it can be (based on the thresholds of method <NUM>), then the "while" of line <NUM> ends as "rectincreased" is "false", and the method <NUM> moves to line <NUM> where a next "cell" with "used" equal to "false. " The method <NUM> ends at line <NUM> when all the "cells" have a "used" equal to "true.

The method <NUM> tries to increase the size of the rectangle that is passed to it at line <NUM>, "rect". At line <NUM> the "rect" is stretched by one in "direction. " For example, referring to <FIG>, A1 at cells <NUM> may be stretched to the right, which would include B1. The A1 at cells <NUM> may not be stretched up. The A1 at cells <NUM> may be stretched down to include A2.

Method <NUM> at line <NUM> determines the "diffrect", which is any new cells added to the "rect". At line <NUM> "newlycoveredcount" is the number of cells in "diffract". At line <NUM> "prospectivecount" is the number of cells in "stretchedrect. " Lines <NUM> and <NUM> determine whether the "stretchedrect" covers enough edited cells. Line <NUM> determines whether "newlycoveredcount" is less than <NUM> times "cells in diffract". In some embodiments, a different threshold may be used other than <NUM>, e.g., a threshold chosen within the range of <NUM> through <NUM>. Line <NUM> determines whether "prospectivecount" is less than <NUM> times "cells in stretchedrect". In some embodiments, a different threshold may be used other than <NUM>, e.g., a threshold chosen within the range of <NUM> through <NUM>. Lines <NUM> through <NUM> are performed if there is a determination to stretch the "rect". Cells "used" is marked as "true" and "rect" is increased to include "stretchedrect.

The following are examples of methods <NUM> and <NUM> being performed on cells of a spreadsheet. Referring to <FIG>, at cells <NUM>, if the current "rect" is B1 and C1 with a direction of "down", then "stretchedrect" is B1, C1, B2, and C2; the "diffrect" would be B2 and C2; "newlycoveredcout" would be <NUM> (i.e., B2); and "prospectivecourt" would be <NUM>, i.e., B1, C1, and C2. At line <NUM>, the test would be "if <NUM> < <NUM> * <NUM>", which is false. At line <NUM>, the test would be <NUM> < <NUM> * <NUM> (cells in stretchedrect), which is false. The method <NUM> would continue to line <NUM> where "used" for each "cell" in "diffract" is set to "true", and "rect" is increased to include "stretcheddirect. " Continuing with the example above, "rect" would be set to B1, C1, B2, and C2 of <NUM>. B2 does not have an operation <NUM> associated with it so it is not an edited cell. Method <NUM> would return "true" to method <NUM>, which would call method <NUM> again to try to expand the "rect" with "down.

In some embodiments, the value of <NUM> (plus delta or "<" changed to "<=") may be used as a threshold in line <NUM> so that the rectangle is not expanded to include one empty cell and one edited cell (e.g., as in the example above with cells <NUM> with "rect" B1 and C1 being expanded to B1, C1, B2, and C2 when C2 is an edited cell, but B2 is not an edited cell.

In some embodiments, methods <NUM> and <NUM> may determine to readjust "rect". For example, referring to cells <NUM>, "rect" may be A1 to start, and then B1 may be added with "right", then A2 and B2 may be added with "down. " Then C1 and C2 would be attempted to be added with "right". But "rect" A1, B1, C1, A2, B2, and C2 may fail the test at line <NUM>, since "prospectivecount" (<NUM>) is less than <NUM> times "cells in stretchedrect" (<NUM>), i.e., <NUM> < <NUM>. This would mean that C1 would not be added. C1 would then be a second rectangle. However, method <NUM> or method <NUM> (or another method) may determine to readjust the "rectangles". For example, methods <NUM> and <NUM> may determine rectangle A1, B1, A2, B2, should be readjusted because of the empty space at A2 or C2. The rectangles may then be readjusted (as illustrated at <NUM>) to "X" rectangle of A1, B1, and C1, and the rectangle "Y" of B2.

<FIG> illustrates a method <NUM> of combining recorded operations, in accordance with some embodiments. The method <NUM> begins at operation <NUM> with receiving events from an electronic document application, the events indicating operations performed on cells within the electronic document application, the operations having types and indicating cells of the electronic document application on which the operations are performed.

For example, referring to <FIG>, recorder application <NUM> may receive event <NUM> from electronic document application where the event <NUM> indicates an operation <NUM>. In another example, referring to <FIG>, recorder application <NUM> may receive events <NUM> with indications of operations within electronic document application <NUM>, e.g., add sheet <NUM>. In another example, referring to <FIG>, <FIG>, and <FIG>, application <NUM> may receive operations <NUM>, <NUM>, <NUM>, from electronic document application <NUM>. In another example, referring to <FIG>, method <NUM> may be performed by recorder application <NUM> where at operation <NUM> an event that includes an operation <NUM> is received from electronic document application <NUM>. In another example, method <NUM> may have received operations <NUM> from recorder application <NUM>.

Method <NUM> continues at operation <NUM> with determining whether operations of a same type are combinable with a range of cells expression. For example, method <NUM> determines whether operations of a same type are combinable with a range of cells expression. In another example, combined ranges <NUM>, <NUM>, and <NUM> may be the result of applying method <NUM>, <NUM>, <NUM>, or <NUM>. The methods <NUM> and <NUM> may be used to determined whether operation of a same type are combinable with a range of cells expression. In another example, <FIG> illustrates cells <NUM> where the combinability of operations with a same type are determined. In another example, combining <NUM> may determine whether operations <NUM> received from events <NUM> are combinable with a range <NUM>.

Method <NUM> continues at operation <NUM> with in response to a determination that the two or more operations are combinable: generating code comprising the range of cells expression within an operation recorder application that when executed within the operation recorder application, performs the two or more operations in the electronic document application. In an example, generate code module <NUM> or combining <NUM> may determine whether operations <NUM> received from events <NUM> are combinable with a range <NUM>. <FIG> illustrates partial code generated at combined ranges <NUM>. <FIG> illustrates code with combined ranges <NUM> with a line of code, e.g., <NUM> and <NUM>. <FIG> illustrates code with combined ranges <NUM> with a line of code, e.g., <NUM>, <NUM>, and <NUM>. In some embodiments, the code may be a single line of code.

<FIG> illustrates a method <NUM> of combining recorded operations, in accordance with some embodiments. The method <NUM> begins at operation <NUM> with receiving, at a recorder application, a first indication of a first operation and a second indication of a second operation from an electronic document application, the first indication of the first operation indicating that the first operation is performed on a first cell of the electronic document application and the second indication of the second operation indicating the second operation is performed on a second cell of the electronic document application, where the first operation and the second operation have a same type of operation.

Method <NUM> continues at operation <NUM> with determining a range of cells expression that indicates a rectangle of cells that includes the first cell and the second cell. For example, determining the range of cells expression may be the same or similar as determining if two operations having a same type are combinable with a range of cells expression. For example, method <NUM> determines whether operations of a same type are combinable with a range of cells expression. In another example, combined ranges <NUM>, <NUM>, and <NUM> may be the result of applying method <NUM>, <NUM>, <NUM>, or <NUM>. The methods <NUM> and <NUM> may be used to determine whether operation of a same type are combinable with a range of cells expression. In another example, <FIG> illustrates cells <NUM> where the combinability of operations with a same type are determined. In another example, combining <NUM> may determine whether operations <NUM> received from events <NUM> are combinable with a range <NUM>.

Method <NUM> continues at operation <NUM> with generating within the recorder application code comprising an indication of a third operation of the same type and the range of cells expression, wherein the code is configured to, when played back by the recorder application, cause: the third operation of the same type to be performed by the electronic document application on the first cell and the third operation of the same type to be performed by the electronic document application on the second cell.

In an example, generate code module <NUM> or combining <NUM> may determine whether operations <NUM> received from events <NUM> are combinable with a range <NUM>. <FIG> illustrates partial code generated at combined ranges <NUM>. <FIG> illustrates code with combined ranges <NUM> with a line of code, e.g., <NUM> and <NUM>. <FIG> illustrates code with combined ranges <NUM> with a line of code, e.g., <NUM>, <NUM>, and <NUM>. In some embodiments, the code may be a single line of code.

<FIG> illustrates a block diagram of an example machine <NUM> upon which any one or more of the techniques (e.g., methodologies) discussed herein may perform. The machine <NUM> may be a server, personal computer (PC), a tablet PC, a set-top box (STB), a personal digital assistant (PDA), a portable communications device, a mobile telephone, a smart phone, a web appliance, a network router, switch or bridge, or any machine capable of executing instructions (sequential or otherwise) that specify operations to be taken by that machine.

Specific examples of main memory <NUM> include Random Access Memory (RAM), and semiconductor memory devices, which may include, in some embodiments, storage locations in semiconductors such as registers. Specific examples of static memory <NUM> include non-volatile memory, such as semiconductor memory devices (e.g., Electrically Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM)) and flash memory devices; magnetic disks, such as internal hard disks and removable disks; magneto-optical disks; RAM; and CD-ROM and DVD-ROM disks.

The machine <NUM> may further include a display device <NUM>, an input device <NUM> (e.g., a keyboard), and a user interface (UI) navigation device <NUM> (e.g., a mouse). In an example, the display device <NUM>, input device <NUM> and UI navigation device <NUM> may be a touch screen display. The machine <NUM> may additionally include a mass storage (e.g., drive unit) <NUM>, a signal generation device <NUM> (e.g., a speaker), a network interface device <NUM>, and one or more sensors <NUM>, such as a global positioning system (GPS) sensor, compass, accelerometer, or other sensor. In some embodiments the processor <NUM> and/or instructions <NUM> may comprise processing circuitry and/or transceiver circuitry.

For example, one or more of electronic document application <NUM>, recorder application <NUM>, or macro recorder <NUM> may be implemented by machine <NUM> to form a special purpose machine <NUM>. In an example, one or any combination of the hardware processor <NUM>, the main memory <NUM>, the static memory <NUM>, or the storage device <NUM> may constitute machine-readable media. Example machine-readable medium may include non-transitory machine-readable medium that may include tangible non-transitory medium for storing information in a form readable by one or more computers, such as but not limited to read only memory (ROM); random access memory (RAM); magnetic disk storage media; optical storage media; a flash memory, etc..

Specific examples of machine-readable media may include: non-volatile memory, such as semiconductor memory devices (e.g., EPROM or EEPROM) and flash memory devices; magnetic disks, such as internal hard disks and removable disks; magneto-optical disks; RAM; and CD-ROM and DVD-ROM disks.

The instructions <NUM> may further be transmitted or received over a communications network <NUM> using a transmission medium via the network interface device <NUM> utilizing any one of a number of transfer protocols (e.g., frame relay, internet protocol (IP), transmission control protocol (TCP), user datagram protocol (UDP), hypertext transfer protocol (HTTP), etc.). Example communication networks may include a local area network (LAN), a wide area network (WAN), a packet data network (e.g., the Internet), mobile telephone networks (e.g., cellular networks), Plain Old Telephone (POTS) networks, and wireless data networks (e.g., Institute of Electrical and Electronics Engineers (IEEE) <NUM> family of standards known as Wi-Fi®, Licensed Assisted Access (LAA), IEEE <NUM>. <NUM> family of standards, a Long Term Evolution (LTE) family of standards, a Universal Mobile Telecommunications System (UMTS) family of standards, peer-to-peer (P2P) networks, among others.

In an example, the network interface device <NUM> may include one or more physical jacks (e.g., Ethernet, coaxial, or phone jacks) or one or more antennas to connect to the communications network <NUM>. In an example, the network interface device <NUM> may include one or more antennas <NUM> to wirelessly communicate using at least one of single-input multiple-output (SIMO), multiple-input multiple-output (MIMO), or multiple-input single-output (MISO) techniques. In some examples, the network interface device <NUM> may wirelessly communicate using Multiple User MIMO techniques. The term "transmission medium" shall be taken to include any intangible medium that is capable of storing, encoding or carrying instructions for execution by the machine <NUM>, and includes digital or analog communications signals or other intangible medium to facilitate communication of such software.

It should be appreciated that where software is described in a particular form (such as a component or module) this is merely to aid understanding and is not intended to limit how software that implements those functions may be architected or structured. For example, modules are illustrated as separate modules, but may be implemented as homogenous code, as individual components, some, but not all of these modules may be combined, or the functions may be implemented in software structured in any other convenient manner.

Furthermore, although the software modules are illustrated as executing on one piece of hardware, the software may be distributed over multiple processors or in any other convenient manner.

Claim 1:
A computing device (<NUM>), the computing device comprising:
a processor (<NUM>);
a memory (<NUM>), comprising instructions, which when performed by the processor (<NUM>), cause the processor (<NUM>) to perform operations comprising:
receiving (<NUM>), at a recorder application (<NUM>), a first indication of a first operation and a second indication of a second operation from an electronic document application (<NUM>), the first indication of the first operation indicating that the first operation is performed on a first cell of the electronic document application (<NUM>) and the second indication of the second operation indicating the second operation is performed on a second cell of the electronic document application (<NUM>),
determining (<NUM>) that the first operation and the second operation are combinable based on the type of operation , wherein the first operation and the second operation have a same type of operation;
determining (<NUM>) a range of cells expression that indicates a rectangle of cells that includes the first cell and the second cell; and
generating (<NUM>) within the recorder application (<NUM>) code comprising an indication of a third operation of the same type and the range of cells expression, wherein the code is configured to, when played back by the recorder application (<NUM>), cause:
the third operation of the same type to be performed by the electronic document application (<NUM>) on the first cell and
the third operation of the same type to be performed by the electronic document application (<NUM>) on the second cell.