In response to a post at this link ( http://forum.corel.com/EN/viewtopic.php?f=56&t=61952 ) I provided one solution that came to mind. I would like to script it but I want the script to start by selecting the Rectangle object from the Preset Shapes flyout. I would have certain parameters already set in that tools Tool Options bar, and would prefer that those parameters be set when the tool is selected. I would then pause the script to allow the user to draw out the rectangle. Starting the script again would have to select the Pen tool, pausing again for user input. Starting the script again would complete the operation as set out in my previous post in that thread.
But I'm again stumped as to how to get the script to start by selecting the first tool I need from whatever tool might have been previously selected. And I likely would have the same problem selecting the Pen tool for the second step. I have a script that selects the Selection tool but, if that can be modified, I'm not sure how because perhaps I don't have the correct name for the Rectangle Object tool (and maybe the Pen tool??). Any help would be appreciated!
Need to start a script by selecting Rectangle Object tool
Moderator: Kathy_9
-
JoeB
- Posts: 2778
- Joined: Fri Mar 28, 2008 10:04 pm
- System_Drive: C
- 32bit or 64bit: 64 Bit
- motherboard: LENOVO 4524PE4 ThinkCentre M91p
- processor: 3.10 gigahertz Intel Quad Core i5-2400
- ram: 8 GB
- Hard_Drive_Capacity: 4.6 TB
- Corel programs: PSP 9, X7 to 2019, 32 & 64-bit
- Location: Canada
Need to start a script by selecting Rectangle Object tool
Regards,
JoeB
Using PSP 2019 64bit
JoeB
Using PSP 2019 64bit
-
LeviFiction
- Advisor
- Posts: 6831
- Joined: Thu Oct 02, 2008 1:07 pm
- System_Drive: C
- 32bit or 64bit: 64 Bit
- motherboard: Alienware M17xR4
- processor: Intel Core i7-3630QM CPU - 2_40GH
- ram: 6 GB
- Video Card: NVIDIA GeForce GTX 660M
- sound_card: Sound Blaster Recon3Di
- Hard_Drive_Capacity: 500GB
- Corel programs: PSP: 8-2023
- Location: USA
Re: Need to start a script by selecting Rectangle Object too
The "SelectTool" command selects a tool and returns the name of the previously selected tool. So one way to get the tool's name is to write a script that prints the return value of the SelectTool command. Then select the tool you want to use, an run the script. The script output should now show the name of the tool you had selected.
Also the Scripting For Script Authors PDF contains a list of the tools
Code: Select all
def Do(Environment):
print App.Do(Environment, 'SelectTool', {'Tool':'Airbrush'})
Code: Select all
['Airbrush','ArtEraserTool','AutoSelection','BackgroundEraser','Burn',
'ChalkTool','ChangeToTarget','CloneBrush', 'ColorChanger','ColoredPencilTool',
'ColorReplacer','CrayonTool','Crop','Dodge','EllipseTool',
'EmbossTool', 'Eraser','Eyedropper','Fill','FreehandSelection',
'Hue','LightenDarken','MagicWand','Makeover','MarkerTool',
'MeshWarping','Mover','OilBrushTool','PaintBrush','PaletteKnifeTool',
'Pan','PatternFill','PastelTool','PenTool','PerspectiveTransform',
'Pick','PictureTube','PresetShapes','PushBrush', 'RectangleTool',
'Redeye','Saturation','ScratchRemover','Selection', 'SharpenBrush',
'SmartSelection','SmearTool','SmudgeBrush','SoftenBrush','Straighten',
'SymmetricShapeTool','TextEx', 'WarpingBrush', 'WatercolorBrushTool','Zoom']
https://levifiction.wordpress.com/
-
JoeB
- Posts: 2778
- Joined: Fri Mar 28, 2008 10:04 pm
- System_Drive: C
- 32bit or 64bit: 64 Bit
- motherboard: LENOVO 4524PE4 ThinkCentre M91p
- processor: 3.10 gigahertz Intel Quad Core i5-2400
- ram: 8 GB
- Hard_Drive_Capacity: 4.6 TB
- Corel programs: PSP 9, X7 to 2019, 32 & 64-bit
- Location: Canada
Re: Need to start a script by selecting Rectangle Object too
Thanks for that info! I was missing the "print" part of the command I was going to copy from my other script that selects the Selection tool. And I should have checked the pdf instead of doing a google search. My google search came up with some of the tool names but not all, so I had tried Rectangle and RectangleObject. I now see (from the code you supplied) that some tools use the word Tool as part of the name while some don't.
Should be able to create the script I want now. While the OP in the other thread seemed happy to have a script that provided a small, medium and large curve as the three options I figured that if curve variance matters at all then it would be better to have a script that gives the user complete control of the variance, which might be useful depending on the size of the selected image. And as it also allows immediate and easy control of positioning and resizing the selected area that might be useful also. Don't know if anyone else would find this useful but I'll enjoy creating it anyway.
Should be able to create the script I want now. While the OP in the other thread seemed happy to have a script that provided a small, medium and large curve as the three options I figured that if curve variance matters at all then it would be better to have a script that gives the user complete control of the variance, which might be useful depending on the size of the selected image. And as it also allows immediate and easy control of positioning and resizing the selected area that might be useful also. Don't know if anyone else would find this useful but I'll enjoy creating it anyway.
Regards,
JoeB
Using PSP 2019 64bit
JoeB
Using PSP 2019 64bit
