|
| 1 | +// This is a macro to demonstrate the use of some functions available with AutoClickerJ plugin, using Macro Extensions. |
| 2 | +// It means that you can call functions with this code pattern: " Ext.<function-name>(<parameter1>, <parameter2>, ...); " |
| 3 | +// Please click on "Plugins > AutoClickerJ > AutoClickerJ Macro Extensions" to display the documentation. |
| 4 | +// |
| 5 | +// You can compare this macro to the one made with the GUI and see how lighter the code is here... |
| 6 | +// Note: all can be achieved with proper macro code, so the goal here is only for you to see some code and how it works for real... |
| 7 | +// Author: Patrice Mascalchi |
| 8 | + |
| 9 | +// -- Allow the use of macro extensions -------------------------------- |
| 10 | +run("AutoClickerJ Macro Extensions"); |
| 11 | + |
| 12 | +// -- Create a new empty Image ------------------------------------ |
| 13 | +newImage("AutoClickerJ-demo", "8-bit black", 400, 400, 1); |
| 14 | +setLocation(50, 50); |
| 15 | + |
| 16 | +// -- Create a circle shape using SHIFT key to preserve 1:1 ratio for width and height ------------------------------------ |
| 17 | +setTool("oval"); |
| 18 | +Ext.PressSHIFT(100); |
| 19 | +Ext.PressLeftClick(156, 185, 100); |
| 20 | + |
| 21 | +Ext.ReleaseLeftClick(366, 405, 100); |
| 22 | +Ext.ReleaseSHIFT(100); |
| 23 | + |
| 24 | +setForegroundColor(255, 255, 255); |
| 25 | +run("Fill", "slice"); |
| 26 | +run("Select None"); |
| 27 | + |
| 28 | + |
| 29 | +// -- Write text ---------------------------------- |
| 30 | +setForegroundColor(0, 0, 0); |
| 31 | +setTool("text"); |
| 32 | + |
| 33 | +Ext.ClickAndKeyWrite(152, 274, 100, "AutoClickerJ demo..."); |
| 34 | +run("Draw", "slice"); |
| 35 | + |
| 36 | +Ext.LeftClick(160, 320, 100); // to reinitialize the text tool |
| 37 | +Ext.ClickAndKeyWrite(155, 320, 100, "... using Macro Extensions"); |
| 38 | +run("Draw", "slice"); |
| 39 | + |
| 40 | +// -- Write text with "ClickAndKeyCopy" will paste it to the clipboard if Text tool is selected ---------------------------------- |
| 41 | +setTool("rectangle"); |
| 42 | +Ext.ClickAndKeyCopy(180, 360, 100, " ClickAndKeyCopy cannot be used with Text tool!!"); |
0 commit comments