Samples of keystroke macros. ---- Part1. Selector in state 0 (no selection): available macro ----- 1) Move all, Delta X = 1. <|'1'|0| //////////////////////////////////////////////////////////////// // Description: - select all, move delta x = 1. // // Requirements: - default configuration of editbars. // // Shortcut key: - '1'. // // Selector state: no selection (0). // //////////////////////////////////////////////////////////////// VK_CONTROL, 'A', VK_CONTROL, // Ctrl-A (select all) VK_TAB(10), // Go to editbar 'Delta X' '1', VK_RETURN, // Write '1', press 'Enter' VK_ESCAPE // ESC - deselect |> 2) Open TCW file. <|'2'|0| //////////////////////////////////////////////////////////////// // Description: - open (or activate) TCW file Sample.tcw. // // Requirements: - // // Shortcut key: - '2'. // // Selector state: no selection (0). // //////////////////////////////////////////////////////////////// VK_MENU, 'F', 'O', VK_MENU, Sleep(900), // Open file dialog VK_CONTROL, 'A', VK_CONTROL, VK_DELETE, // Ctrl-A, Del - clear string Str(ProfilesPath), Str("Macros\Samples\Sample.tcw"), // Enter path for drawing VK_RETURN |> 3) File Save As BMP. <|'3'|0| //////////////////////////////////////////////////////////////// // Description: - save drawing as .bmp // // use data/time in file name. // // Requirements: - mshta.exe available in OS // // Shortcut key: - '3'. // // Selector state: no selection (0). // //////////////////////////////////////////////////////////////// VK_LWIN, 'R', VK_LWIN, Sleep(100), // Open 'Run' dialog Str("mshta "), '"', Str("javascript: // Build mshta command line window.moveTo(-5000,-5000); // Hide mshta window window.resizeTo(1,1); var d=new Date(); // Generate data/time string // as "Drawing1 (Tuesday, July 28, 2015 11.25.32 PM).bmp" clipboardData.setData('text', // Copy a string to a clipboard ' (' + d.toLocaleString().replace(/:/g, '.') + ')'); close(); // close mhta "),'"', VK_RETURN,Sleep(200), // Press 'Enter' SetFocus, Sleep(200), // Return focus to TC VK_MENU, 'F', 'A', VK_MENU, Sleep(500), // Alt-F, Alt-A VK_END, VK_BACK(4), // Delete extension '.tcw' VK_CONTROL, 'V', Sleep(100),VK_CONTROL, // Ctrl - V VK_TAB, Str("b"), VK_RETURN, // Select 'BMP' filter VK_RETURN // Press 'Enter' |> 4) Select by type (Line). <|'4'|0| //////////////////////////////////////////////////////////////// // Description: - select by type (Line). // // Requirements: - lines in drawing. // // Shortcut key: - '4'. // // Selector state: no selection (0). // //////////////////////////////////////////////////////////////// VK_CONTROL, 'T', VK_CONTROL, // Ctrl-T (Select by Entity Type) VK_TAB(3), // Go to list Str("line"), // Select option 'Line' VK_RETURN // Press 'Enter' |> 5) Create a screenshot and copy it to MS Paint. <|'5'|0| //////////////////////////////////////////////////////////////// // Description: - Create a screenshot and copy it to mspaint. // // Requirements: - MS Paint available in OS. // // Shortcut key: - '5'. // // Selector state: no selection (0). // //////////////////////////////////////////////////////////////// VK_MENU, VK_SNAPSHOT, VK_MENU, // Alt-Print Screen Sleep(500), VK_LWIN, 'R', VK_LWIN, Sleep(100), // Open 'Run' dialog Str("mspaint"), VK_RETURN, // Run MS Paint Sleep(500), VK_CONTROL, 'V', VK_CONTROL // Ctrl - V |> 6) "Hello world!" in MS Word. <|'6'|0| //////////////////////////////////////////////////////////////// // Description: - "Hello world!" in MS Word. // // Requirements: - MS Word available in OS. // // Shortcut key: - '6'. // // Selector state: no selection (0). // //////////////////////////////////////////////////////////////// VK_LWIN, 'R', VK_LWIN, Sleep(100), // Open 'Run' dialog Str("winword"), VK_RETURN, // Run MS Word Sleep(1000), Str("Hello world!") // Write "Hello world!" |> 7) "Hello world!" in Notepad. <|'7'|0| //////////////////////////////////////////////////////////////// // Description: - "Hello world!" in Notepad. // // Requirements: - Notepad available in OS. // // Shortcut key: - '7'. // // Selector state: no selection (0). // //////////////////////////////////////////////////////////////// VK_LWIN, 'R', VK_LWIN, Sleep(100), // Open 'Run' dialog Str("notepad"), VK_RETURN, // Run Notepad Sleep(500), Str("Hello world!") // Write "Hello world!" |> 8) Local menu 'Selector 3D properties'. <|'8'|0| ////////////////////////////////////////////////////////////////////// // Description: - Local menu 'Selector 3D properties'. // // Requirements: - // // Shortcut key: - '8'. // // Selector state: no selection (0). // // Notes: // // - Uncomment one of the macros for using. // // - To get a complete list of menu IDs use command // // CopyToClipboard(LocalMenuItems) // ////////////////////////////////////////////////////////////////////// LocalMenuExec(107) // 107 - Open … 3D selector properties dialogue // Uncomment one of the lines to use a command // //LocalMenuExec(100) // 100 - Switch between the 2D/3D Dimension mode //LocalMenuExec(106) // 106 - Open the 2D selector properties dialog |> ---- Part2. Selector in state 1 (has selection): available macro ----- 9) Activate handle (handle is macro onwner). <|'1'|1| //////////////////////////////////////////////////////////////// // Description: - Activate handle. // // Requirements: - // // Shortcut key: - '1'. // // Selector state: has selection (1). // //////////////////////////////////////////////////////////////// ActivateHandle |> 10) Activate handle by name "MoveZ". <|'2'|1| //////////////////////////////////////////////////////////////// // Description: - Activate handle. // // Requirements: - // // Shortcut key: - '2'. // // Selector state: has selection (1). // //////////////////////////////////////////////////////////////// ActivateHandleByName("MoveZ") // Activate handle 'MoveZ' |> 11) Move selection, Delta X = 1. <|'3'|1| ///////////////////////////////////////////////////////////////// // Description: - Activate handle 'MoveX', move X = 1. // // Requirements: - default configuration of editbars. // // Shortcut key: - '3'. // // Selector state: has selection (1). // ///////////////////////////////////////////////////////////////// ActivateHandleByName("MoveX"), // Activate handle 'MoveX' VK_TAB(10), // Go to editbar 'Delta X' '1', // Write '1', VK_RETURN // Press 'Enter' |> 12) Scale *2 using MS Calculator. <|'4'|1| ///////////////////////////////////////////////////////////////// // Description: - Scale *2 using MS Calculator. // // Requirements: - MS Calculator available in OS, // // default configuration of editbars. // // Shortcut key: - '4'. // // Selector state: has selection (1). // ///////////////////////////////////////////////////////////////// VK_TAB, // Go to editbar 'Scale X' VK_CONTROL, 'C', Sleep(100), VK_CONTROL, // Ctrl-C (copy editbar value) VK_LWIN, 'R', VK_LWIN, Sleep(100), // Open 'Run' dialog Str("calc"), Sleep(1), VK_RETURN, Sleep(500), // Run MS Calculator (calc.exe) VK_CONTROL, 'V', Sleep(100), VK_CONTROL, // Ctrl-V VK_MULTIPLY, Str("2="), // Write '*2=' VK_CONTROL, 'C', Sleep(100), VK_CONTROL, // Ctrl-C VK_MENU, VK_F4, VK_MENU, Sleep(100), // Close calc.exe SetFocus, Sleep(100), // Return focus to TC VK_TAB, // Go to editbar 'Scale X' VK_CONTROL, 'V', Sleep(100), VK_CONTROL, // Ctrl-V VK_TAB, // Go to editbar 'Scale Y' VK_CONTROL, 'V', Sleep(100), VK_CONTROL, // Ctrl-V VK_TAB, // Go to editbar 'Scale Z' VK_CONTROL, 'V', Sleep(100), VK_CONTROL, // Ctrl-V VK_RETURN |> 13) Scale *0.5 using using javascript <|'5'|1| ///////////////////////////////////////////////////////////////// // Description: - Scale *0.5 using javascript. // // Requirements: - mshta.exe available in OS, // // default configuration of editbars. // // Shortcut key: - '5'. // // Selector state: has selection (1). // ///////////////////////////////////////////////////////////////// VK_TAB, // Go to editbar 'Scale X' VK_CONTROL, 'C', Sleep(100), VK_CONTROL, // Ctrl-C (copy editbar value) VK_LWIN, 'R', VK_LWIN, // Open 'Run' dialog Sleep(100), Str("mshta "), '"', Str("javascript: // Build mshta command line window.moveTo(-5000,-5000); // Hide mshta window window.resizeTo(1,1); var s=0.5*parseFloat(clipboardData.getData('text')); clipboardData.setData('text',s.toString()); // Copy a string to a clipboard close(); // close mhta "),'"', VK_RETURN,Sleep(500), SetFocus, Sleep(100), // Return focus to TC VK_TAB, // Go to editbar 'Scale X' VK_CONTROL, 'V', Sleep(100), VK_CONTROL, // Ctrl-V VK_TAB, // Go to editbar 'Scale Y' VK_CONTROL, 'V', Sleep(100), VK_CONTROL, // Ctrl-V VK_TAB, // Go to editbar 'Scale Z' VK_CONTROL, 'V', Sleep(100), VK_CONTROL, // Ctrl-V VK_RETURN |> 14) Local menu 'Switch between the 2D/3D Dimension mode'. <|'6'|1| ////////////////////////////////////////////////////////////////////// // Description: - Local menu 'Switch between the 2D/3D'. // // Requirements: - // // Shortcut key: - '6'. // // Selector state: has selection (1). // // Notes: // // Notes: // // - Uncomment one of the macros for using. // // - To get a complete list of menu IDs use command // // CopyToClipboard(LocalMenuItems) // ////////////////////////////////////////////////////////////////////// LocalMenuExec(100) // 100 - Switch between the 2D/3D Dimension mode |> 15) Set orientation. <|'7'|1| //////////////////////////////////////////////////////////////// // Description: - Set orientation. // // Requirements: - default configuration of editbars, // // selector extents by Entity CS. // // Inspector bar World CS or UCS . // // Shortcut key: - '7'. // // Selector state: has selection (1). // //////////////////////////////////////////////////////////////// VK_TAB(13), // Go to editbar 'Angle X' '0', VK_TAB, // Go to editbar 'Angle Y' '0', VK_TAB, // Go to editbar 'Angle Z' '0', VK_RETURN |> 16) Generate reports, using ShowText.hta. <|'8'|1| ///////////////////////////////////////////////////////////////// // Description: - Generate report, using ShowText.hta // // Requirements: - mshta.exe available in OS. // // // // Shortcut key: - '8'. // // Selector state: has selection (1). // ///////////////////////////////////////////////////////////////// CopyToClipboard(LocalMenuItems), // Selector’s local menu // Uncomment one of the lines to use a command // //CopyToClipboard(VirtualKeyCodes), //CopyToClipboard(ActiveDrawingPath), //CopyToClipboard(ActiveDrawingName), //CopyToClipboard(ProfilesPath), //CopyToClipboard(ProfilesPathForwardSlash), //CopyToClipboard(AllHandles), //CopyToClipboard(SelectedGraphics), //CopyToClipboard(SelectedGraphicsVert), //CopyToClipboard(AllMacros), VK_LWIN, 'R', VK_LWIN, Sleep(100), // Open 'Run' dialog Str(ProfilesPath), Str("Macros\ShowText.hta"), VK_RETURN |> 17) Open existing .XLSX file. <|'9'|1| //////////////////////////////////////////////////////////////// // Description: - Open existing .XLSX file. // // Requirements: - MS Excel available in OS, // // mshta.exe available in OS. // // Shortcut key: - '9'. // // Selector state: has selection (1). // //////////////////////////////////////////////////////////////// VK_LWIN, 'R', VK_LWIN, // Open 'Run' dialog Sleep(100), Str("mshta "), '"', Str("javascript: // Build mshta command line moveTo(-5000,-5000); // Hide mshta window resizeTo(1,1); var o = new ActiveXObject('Excel.Application'); o.Visible = true; o.Workbooks.Open('"), Str(ProfilesPathForwardSlash), Str("Macros/Samples/1.xlsx');"), // Enter a path to .xlsx file Str("close();"), // close mhta '"', VK_RETURN |> 18) Create Excel Workbook and add Charts. <|'0'|1| //////////////////////////////////////////////////////////////// // Description: - Create Excel file and add Charts. // // Requirements: - MS Excel available in OS, // // mshta.exe available in OS. // // Shortcut key: - '0'. // // Selector state: has selection (1). // //////////////////////////////////////////////////////////////// VK_LWIN, 'R', VK_LWIN, // Open 'Run' dialog Sleep(100), Str("mshta "), '"', Str("javascript: // Build mshta command line resizeTo(1,1); // Hide mshta window var o=new ActiveXObject('Excel.Application'); o.Workbooks.Add; o.Visible = true; o.Cells(1,1).Value=5; o.Cells(1,2).Value=10; o.Cells(1,3).Value=15; o.Range('A1:C1').Select; o.Charts.Add().Type=-4100; "), Str("close();"), '"', VK_RETURN |>