Electronic device and macro recording method
By introducing storage devices and processing circuits into electronic devices, macro steps from other electronic devices can be recorded and replayed, solving the problem of limited macro combination range in traditional optical mice and expanding the application range of macros.
Patent Information
- Application Number
- CN202411716658.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-05-16
- Filing Date
- 2024-11-27
- Publication Date
- 2025-11-18
AI Technical Summary
Traditional optical mice can only record the macro steps they execute, which limits the combination and application of macros.
Electronic devices, through storage devices and processing circuits, can record macro steps provided by source devices, convert them into macro code for storage, and output them to target devices for replay.
The combination and application of macros have been expanded, enabling electronic devices to record and replay macro steps provided by themselves or other electronic devices.
Smart Images

Figure CN120973244A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to an electronic device capable of recording a macro and a macro recording method, and in particular, to an electronic device capable of recording a macro from another electronic device and a macro recording method. BACKGROUND
[0002] A conventional optical mouse can record a macro comprising a plurality of macro steps. A macro provides a user with a convenient action, especially in a game. For example, a user can trigger a function or a menu of a game by clicking a right button once, then clicking a left button three times, and then pressing a middle button. However, if a macro comprising the above three macro steps is pre-recorded in the optical mouse, the user can only click the buttons of the optical mouse to replay the macro to trigger the function or the menu. However, the conventional optical mouse can only record the macro steps performed by itself, and thus the combination and application range of the macro is limited. SUMMARY
[0003] An object of the present application is to provide an electronic device capable of recording a macro provided by itself or another electronic device.
[0004] Another object of the present application is to provide a macro recording method capable of recording a macro provided by itself or another electronic device.
[0005] One embodiment of the present application discloses an electronic device comprising: a storage device; and a processing circuit configured to obtain a first macro code of a first macro step provided by a source device, and configured to record the first macro code into the storage device, wherein the source device is independent of the electronic device. The electronic device further outputs the first macro code to a target device, so that the target device replays a macro corresponding to the first macro step.
[0006] Another embodiment of the present application discloses a macro recording method used in an electronic device comprising a storage device and a processing circuit, comprising: the processing circuit obtaining a first macro code of a first macro step provided by a source device; the processing circuit recording the first macro code into the storage device, wherein the source device is independent of the electronic device; and the electronic device further outputs the first macro code to a target device, so that the target device replays a macro corresponding to the first macro step.
[0007] According to the above-mentioned embodiments, the electronic device can record a macro provided by itself or another electronic device. The combination and application range of the macro can be expanded. BRIEF DESCRIPTION OF DRAWINGS
[0008] Figure 1 A schematic diagram of a macro recording action according to one embodiment of the present application is shown.
[0009] Figure 2 A schematic diagram of a macro recording action according to one embodiment of the present application is shown.Figure 1 Block diagram showing detailed structure of optical mouse.
[0010] Figure 3 A diagram showing a code format of a first macro code according to an embodiment of the present application.
[0011] Figure 4 、 Figure 5 and Figure 6 A diagram showing an example of a first macro code and a second macro code according to an embodiment of the present application.
[0012] Figure 7 A flowchart showing an encoding operation according to an embodiment of the present application.
[0013] Figure 8 A flowchart showing a decoding operation according to an embodiment of the present application.
[0014] Figure 9 A flowchart showing a code recording method according to an embodiment of the present application.
[0015] In the drawings, the following reference numerals are used:
[0016] 100 optical mouse
[0017] 100_1 processing circuit
[0018] 100_3 storage device
[0019] 101 computer
[0020] 103 keyboard
[0021] 201 buffer
[0022] 300 code format
[0023] 701...723 steps
[0024] 801...821 steps
[0025] 901...905 steps
[0026] CG_1, CG_2, CG_3 code group
[0027] DC_1, DC_2 definition code
[0028] MS_11 MS_12 first macro step
[0029] RC_1, RC_2 repeat code
[0030] SC_1, SC_2 state code DETAILED DESCRIPTION
[0031] The present invention will be described below with reference to several embodiments. Please note that the terms "first," "second," and similar descriptions used in the following description are only used to define different elements, parameters, data, signals, or steps, and are not intended to limit their order. For example, the first device and the second device may be devices with the same structure but different from each other.
[0032] Figure 1 A schematic diagram illustrating a macro recording operation according to an embodiment of the present invention is shown. Figure 1 In one embodiment, the optical mouse 100 obtains a first macro code independent of the first macro step provided by the source device, and records the first macro code into a storage device therein. The optical mouse 100 further outputs the first macro code to the target device so that the target device replays the macro corresponding to the first macro step.
[0033] In one embodiment, the target device is a computer 101, and the source device is a HID (Human Interface Device) device that has a wireless or wired connection to the target device. For example, the HID device is a keyboard 103, which provides a first macro step MS_11 to the computer 101, and then the computer 101 transmits the first macro step MS_11 to an optical mouse 100. In this case, the first macro step MS_11 can be a button press or release action on the keyboard 103. However, the first macro step MS_11 may vary depending on the specific HID device.
[0034] In another embodiment, the target device is a computer 101, which serves as the source device. For example, in Figure 1 In one embodiment, computer 101 provides a first macro step MS_12 to optical mouse 100. In this case, the first macro step MS_12 may be a step for executing at least one program stored in computer 101. For example, the first macro step MS_12 may be a step for executing calculator software stored in computer 101. It should also be understood that, in embodiments of the invention, the step of providing or receiving a macro step may be providing or receiving signals or data representing a macro step.
[0035] After receiving the first macro step, the optical mouse 100 can convert the first macro step into first macro code. However, the step of converting the first macro step can also be performed by the computer 101, which is the host device of the optical mouse 100. Therefore, the above-mentioned step "transmitting the first macro steps MS_11, MS_12 to the optical mouse 100" can be replaced by "transmitting the first macro code of the first macro steps MS_11, MS_12 to the optical mouse 100". In addition, besides the macro steps provided by the source device, the optical mouse 100 can also record the macro steps it executes itself. In this case, the optical mouse 100 can also obtain the second macro code of the second macro step executed by the optical mouse 100 and record the second macro code into a storage device.
[0036] Figure 2 An illustration is provided according to an embodiment of the present invention. Figure 1 A block diagram showing the detailed structure of an optical mouse. (As shown) Figure 2 As shown, the optical mouse 100 includes a processing circuit 100_1 and a storage device 100_3. The processing circuit 100_1 receives the first macro step, first macro code, second macro step, or second macro code from the buffer 201. The storage device 100_3 stores the first macro code or the second macro code. The buffer 201 buffers the data before storing the first macro step, first macro code, second macro step, or second macro code in the storage device 100_3, or before transmitting the data to the computer 101. The buffer 201 can be located inside the optical mouse 100 or outside the optical mouse 100. For example, the buffer 201 can be located inside the optical mouse 100. Figure 1 In computer 101.
[0037] The first and second macro codes mentioned above can be stored in a specific code format. Figure 3 A schematic diagram illustrating the code format of a first macrocode according to an embodiment of the present invention is shown. Note also that the second macrocode can also be based on... Figure 3 The code format shown is used for storage. For example... Figure 3 As shown, code format 300 includes repeating codes RC_1 and RC_2, and code groups CG_1, CG_2, and CG_3. Code groups CG_1, CG_2, and CG_3 respectively include status codes SC_1 and SC_2, and definition codes DC_1 and DC_2. Please note that the number and arrangement of codes and code groups are not limited to... Figure 3 The example shown.
[0038] The repetition codes RC_1 and RC_2 indicate the number of times all code groups CG_1, CG_2, and CG_3 are executed. For example, if the repetition codes RC_1 and RC_2 indicate a repetition count of 3, then code groups CG_1, CG_2, and CG_3 will be executed 3 times. The status codes SC_1 and SC_2 indicate the status of the first macro step. These statuses can indicate, for example, that at least one button has been triggered, at least one program has been executed, or at least one action has been performed.
[0039] Definition codes DC_1 and DC_2 represent the target or value of a state. For example, if state codes SC_1 and SC_2 indicate that at least one button is pressed, then definition codes DC_1 and DC_2 specifically define which button is triggered. Similarly, if state codes SC_1 and SC_2 indicate that at least one program is executed, then definition codes DC_1 and DC_2 specifically indicate which program is executed. For another example, if state codes SC_1 and SC_2 indicate that an action is performed, then definition codes DC_1 and DC_2 specifically represent the value of the action. In one embodiment, different states of the first macro step correspond to definition codes with different amounts of data. Furthermore, in one embodiment, the first macro code also includes a delay code representing the delay between different macro steps in the first macro step.
[0040] Figure 4 , Figure 5 as well as Figure 6 Examples of the first macrocode and the second macrocode according to embodiments of the present invention are illustrated. Figure 4 , Figure 5 and Figure 6 The example in the example uses hexadecimal. However, if a different base method is used, the code may differ. Additionally, the code may differ depending on user-defined rules.
[0041] Figure 4 One example is a macro provided by the keyboard. Figure 4 In the embodiment, byte 1 and byte 2 are repeating codes with a value of 4, therefore Figure 4 The macro steps corresponding to byte 3...byte 2*n+1 in the example are repeated three times. Additionally, a value of 8 for byte 3 indicates "pressed," and a value of 1 for byte 3 indicates a delay of 1ms. Furthermore, byte 4 with a value of 04 indicates button "a." Additionally, a value of 0 for byte 5 indicates "released," and a value of 1 for byte 3 indicates a delay of 1ms. Furthermore, byte 6 with a value of 04 indicates button "a." Correspondingly, Figure 4 Bytes 3, 4, 5, and 6 in the code represent the "a" key being pressed and released on the keyboard, with a delay of 1ms between the press and release. In this case, bytes 3 and 4 form one code group, and bytes 5 and 6 form another code group.
[0042] Similarly, bytes 7, 8, 9, and 10 represent the pressing and releasing of the 'b' key on the keyboard, with a delay of 1ms between "pressing" and "releasing". Bytes 11...2*n+1 are all 0, indicating that the macro step will not be executed. Therefore, Figure 4 The macro shown indicates pressing and releasing the "a" key, then pressing and releasing the "b" key, repeating this action three times. Figure 4 In the embodiment, bytes 3, 5, 7, and 9 include Figure 3 The aforementioned status code and delay code, bytes 4, 6, 8, and 10 are... Figure 3 The aforementioned definition code.
[0043] Figure 5 An example of this is the macro provided by an optical mouse. Figure 5 In the embodiment, byte 1 and byte 2 are repeating codes, i.e., 20, therefore Figure 5 The macro representation of the embodiment indicates that the macro steps corresponding to byte 3 to byte 2*n+1 are repeated 20 times.
[0044] Additionally, the value 32 of byte 3 represents a delay of 50ms. The value F5 of byte 4 indicates "mouse XY movement". The values 00 and 64 of bytes 5 and 6 represent the value of movement in the X direction, and the values 00 and 00 of bytes 7 and 8 represent the value of movement in the Y direction. Accordingly, bytes 3, 4, 5, 6, 7, and 8 constituting the code group represent mouse XY movement (X=100, Y=0) with a delay of 50ms. In this case, byte 3 is the delay code, byte 4 is the status code, and bytes 5, 6, 7, and 8 are the definition code. Following the same rule, the code group consisting of bytes 9-15 represents mouse XY movement (X=0, Y=-100) with a delay of 100ms, the code group consisting of bytes 16-21 represents mouse XY movement (X=-100, Y=0) with a delay of 100ms, and the code group consisting of bytes 22-27 represents mouse XY movement (X=0, Y=100) with a delay of 50ms. Bytes 28…2*n+1 are all 0, therefore no further movement is performed. Therefore, Figure 5 The macro shown indicates that the optical mouse moves 20 times according to the values and directions mentioned above.
[0045] Figure 6 The embodiment is a host device of an optical mouse 100 (such as...) Figure 1 The macros generated by computer 101. Figure 6 In the embodiment, byte 1 and byte 2 are repeating codes with a value of 1, therefore Figure 6 The macro steps corresponding to byte 3...byte 10 in the example are executed only once.
[0046] Additionally, byte 3 with a value of 8 indicates "pressed," and byte 3 with a value of A indicates a delay time of 10ms. Furthermore, byte 4 with a value of F7 indicates "user action," meaning the macro was generated by the host device. Additionally, bytes 5 and 6 with values of 01 and 92 indicate "calculator icon." Therefore, Figure 6 Bytes 3, 4, 5, and 6 indicate that the calculator was activated by being pressed, with a delay of 10ms. In this case, bytes 3, 4, 5, and 6 form a code group.
[0047] Following the same rules, a value of 0 for byte 7 indicates "release," and a value of 1 for byte 7 indicates a delay of 1ms. Furthermore, a value of F7 for byte 8 indicates "user action," meaning the macro was generated by the host device. Additionally, values 01 and 92 for bytes 9 and 10 indicate "calculator icon." Therefore, Figure 6 Bytes 7, 8, 9, and 10 indicate that the calculator has been activated with a 1ms delay. In this case, bytes 7, 8, 9, and 10 form a code group. Figure 4 In the embodiment, bytes 3, 4, 7, and 8 include Figure 3 The aforementioned status code and delay code, bytes 5, 6, 9, and 10 are... Figure 3 The aforementioned definition code.
[0048] As described above, the optical mouse 100 can acquire and record the first macro code; this step can also be called the encoding action. Furthermore, the first macro can be read from the storage device; this step can also be called the decoding action. The encoding and decoding actions can be performed by… Figure 2 The processing circuit 100_1 shown is executed.
[0049] Figure 7 A flowchart illustrating the encoding operation according to an embodiment of the present invention is shown, including the following steps: Step 701
[0050] start.
[0051] Step 703
[0052] Records of macro triggers.
[0053] For example, pressing both buttons on the optical mouse 100 triggers the recording of macros.
[0054] Step 705
[0055] Processing circuit 100_1 from Figure 2 The buffer 201 acquires the signal or code of the macro step.
[0056] This step can determine the type of macro step.
[0057] Step 707
[0058] Is the macro step involving mouse movement via XY? If yes, proceed to step 709. If no, proceed to step 711.
[0059] Step 709
[0060] Encode 6-byte data. For example, in Figure 5 In one embodiment, each code group includes 6 bytes, such as bytes 3-8 or bytes 9-15.
[0061] Step 711
[0062] Is the macro step a mouse button? If yes, proceed to step 713. If no, proceed to step 715.
[0063] Step 713
[0064] Encode 2-byte data. For example, in Figure 4 In one embodiment, if the state is "button in use", each code group includes 2 bytes, such as bytes 3-4 or bytes 5-6.
[0065] Step 715
[0066] Is the macro step a user action? If yes, proceed to step 717. If no, proceed to step 719.
[0067] Step 717
[0068] Encode 4-byte data. For example, in Figure 6 In one embodiment, each code group includes 4 bytes, such as bytes 3-6 or bytes 7-10.
[0069] Step 719
[0070] Is the macro step a keyboard button? If yes, proceed to step 721. If no, other steps can be performed depending on the design.
[0071] Step 721
[0072] Encode 2-byte data. For example, in Figure 4 In one embodiment, if the state is "button in use", each code group includes 2 bytes, such as bytes 3-4 or bytes 5-6.
[0073] Step 723
[0074] Store the data (first macro code or second macro code) to storage device 100_3.
[0075] Storage devices can be, for example, memory.
[0076] Step 725
[0077] Stop recording?
[0078] For example, press or release the button on the optical mouse 100 to stop recording macros.
[0079] If yes, proceed to step 727. If no, return to step 705.
[0080] Step 727.
[0081] Finish
[0082] Figure 8 A flowchart illustrating a decoding operation according to an embodiment of the present invention is shown, including the following steps: Step 801
[0083] start.
[0084] Step 803
[0085] Obtain the duplicate code.
[0086] Step 805
[0087] Obtain the first two codes of the code group.
[0088] This step can obtain the status code and delay code, for example Figures 4-6 Bytes 3 and 4 in the embodiment.
[0089] Step 807
[0090] Check if the check code is 0, i.e., excluding macro steps. If yes, proceed to step 823 and end. If no, proceed to step 809.
[0091] Step 809
[0092] Determine the status code.
[0093] If the status code represents a user action, proceed to step 813. If the status code represents mouse movement (XY), proceed to step 811. If the status code is any other, proceed to step 815.
[0094] Step 811
[0095] Get the next 4 bytes, for example Figure 5 bytes 5-8 in the text.
[0096] Step 813
[0097] Get the next 2 bytes, for example Figure 6 bytes 5-6 in the text.
[0098] Step 815
[0099] Determine whether the status code indicates a mouse button. If yes, proceed to step 817; otherwise, proceed to step 819.
[0100] Step 817
[0101] Obtain the definition code, such as Figure 4 Byte 4 in the middle.
[0102] Step 819
[0103] Determine if the status code represents a keyboard button.
[0104] Step 821
[0105] The obtained macro code is stored in a buffer, such as Figure 2 Buffer 201.
[0106] In one embodiment, buffer 201 is a ping-pong buffer used to store macro steps, macro codes, and data generated by the real-time actions of the optical mouse 100. More specifically, the ping-pong buffer includes at least two buffers in which the data generated by the macro steps, macro codes, and real-time operations of the optical mouse 100 are stored alternately to avoid conflicts between different types of data. For example, a ping-pong buffer is used if a user moves the optical mouse 100 to control the cursor while the optical mouse 100 is recording a macro.
[0107] Step 823
[0108] Finish.
[0109] In one embodiment, to avoid conflicts between different types of data, the optical mouse 100 performs at least one of the following actions while recording the first macro step: pre-clearing the storage device 100_3, reducing the report rate of the optical mouse 100, and ignoring at least some of the tasks from the computer 101.
[0110] The aforementioned target device and source device are not limited to Figure 1 The computer 101 and keyboard 103 are included. Furthermore, the optical mouse 100 can be replaced by any other electronic device. According to the above embodiment, a macro recording method can be obtained. Figure 9 A flowchart illustrating a code recording method according to an embodiment of the present invention is shown. This macro recording method is applied to a storage device and a processing circuit, and includes the following steps:
[0111] Step 901
[0112] The processing circuit obtains the first macro code of the first macro step provided by the source device.
[0113] Step 903
[0114] The processing circuit records the first macro code to the storage device, wherein the source device is independent of the electronic device.
[0115] For example, the source device is Figure 1 The computer 101 or keyboard 103 is independent of the optical mouse 100.
[0116] Step 905
[0117] The electronic device further outputs the first macro code to the target device so that the target device replays the macro corresponding to the first macro step.
[0118] In one embodiment, the target device is computer 101, and the source device is an HID device, such as keyboard 103. In another embodiment, the target device is computer 101 and serves as the source device, and the first macro step is the step of executing at least one program stored in the target device.
[0119] According to the above embodiments, the electronic device can record macros provided by itself or another electronic device. The combination and application scope of macros can be expanded.
[0120] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. An electronic device, characterized in that, include: Storage device; as well as A processing circuit is used to obtain the first macro code of the first macro step provided by the source device and to record the first macro code into the storage device, wherein the source device is independent of the electronic device. The electronic device further outputs the first macro code to the target device so that the target device can replay the macro corresponding to the first macro step.
2. The electronic device as claimed in claim 1, characterized in that, The target device is a computer, and the source device is a human-machine interface device that is wirelessly or wiredly connected to the target device.
3. The electronic device as claimed in claim 2, characterized in that, The source device is a keyboard.
4. The electronic device as claimed in claim 1, characterized in that, The target device is a computer, which also serves as the source device; The first macro step is the step of executing the program stored in the target device.
5. The electronic device as claimed in claim 1, characterized in that, The first macro code includes a status code representing the state of the first macro step.
6. The electronic device as claimed in claim 5, characterized in that, The first macrocode includes a definition code representing the target or value of the state, and different states of the first macrostep correspond to the definition code with different amounts of data.
7. The electronic device as claimed in claim 5, characterized in that, The first macrocode further includes a delay code representing the delay between different first macro steps.
8. The electronic device as claimed in claim 1, characterized in that, The processing circuit is further used to obtain the second macro code of the second macro step executed by the electronic device, and to record the second macro code into the storage device.
9. The electronic device as claimed in claim 1, characterized in that, The electronic device is an optical mouse that connects wirelessly or wired to the host device, wherein the electronic device also performs at least one of the following actions when recording the first macro step: The storage device is cleared in advance, the optical mouse's polling rate is reduced, and tasks from the host device are ignored.
10. A macro recording method used in an electronic device including a storage device and processing circuitry, characterized in that, include: The processing circuit obtains the first macro code of the first macro step provided by the source device; The processing circuit records the first macro code to the storage device, wherein the source device is independent of the electronic device; as well as The electronic device further outputs the first macro code to the target device so that the target device replays the macro corresponding to the first macro step.
11. The macro recording method as described in claim 10, characterized in that, The target device is a computer, and the source device is a human-machine interface device that is wirelessly or wiredly connected to the target device.
12. The macro recording method as described in claim 11, characterized in that, The source device is a keyboard.
13. The macro recording method as described in claim 10, characterized in that, The target device is a computer, which also serves as the source device; The first macro step is the step of executing the program stored in the target device.
14. The macro recording method as described in claim 10, characterized in that, The first macro code includes a status code representing the state of the first macro step.
15. The macro recording method as described in claim 14, characterized in that, The first macrocode includes a definition code representing the target or value of the state, wherein different states of the first macrostep correspond to the definition code with different amounts of data.
16. The macro recording method as described in claim 14, characterized in that, The first macrocode further includes a delay code representing the delay between different first macro steps.
17. The macro recording method as described in claim 10, characterized in that, Further includes: The processing circuit obtains the second macro code of the second macro step executed by the electronic device; as well as The processing circuit records the second macrocode into the storage device.
18. The macro recording method as described in claim 10, characterized in that, The electronic device is an optical mouse that connects wirelessly or wired to the host device, wherein the electronic device also performs at least one of the following actions when recording the first macro step: The storage device is cleared in advance, the optical mouse's polling rate is reduced, and tasks from the host device are ignored.