Is there a way to set a specific layer name or number to be selected in a script? I need to have the first layer turned on or off, no matter what layer is currently selected.
I've already created a script that turns a layer on or off if I click on a bound button but it will only do it for a layer that is the same number of layers above the current layer as when I created the script.
Set specific layer to be selected in script
Moderator: Kathy_9
-
wds937
- Posts: 189
- Joined: Mon Dec 13, 2010 8:58 pm
- System_Drive: C
- 32bit or 64bit: 32 Bit
- motherboard: Dell 0HN7XN A01
- processor: Intel Pentium Dual Core E5800 - 64-bit - 3.20 GHz
- ram: 4 GB
- Video Card: Intel G41 Express - integrated
- sound_card: Realtek High Definition Audio - integrated
- Hard_Drive_Capacity: 320 GB
- Monitor/Display Make & Model: ASUS VS247
- Location: New Orleans, LA, USA
Re: Set specific layer to be selected in script
Perhaps you could use App.Do( Environment, 'SelectLayer', ... in your script to select the layer.
Two suggestions:
1. Look at some of the scripts that are supplied with Paint Shop Pro. The location varies with each version, but for X3 you may want to start with C:\Program Files\Corel\Corel PaintShop Photo Pro\X3\PSPClassic\Languages\EN\Scripts-Restricted\Artistic. Several of the supplied scripts work with multiple layers. Use these to get ideas for your new script.
2. Start recording a script and select the layer you want with the user interface. Save the script, examine it, and copy/paste into your new script.
Two suggestions:
1. Look at some of the scripts that are supplied with Paint Shop Pro. The location varies with each version, but for X3 you may want to start with C:\Program Files\Corel\Corel PaintShop Photo Pro\X3\PSPClassic\Languages\EN\Scripts-Restricted\Artistic. Several of the supplied scripts work with multiple layers. Use these to get ideas for your new script.
2. Start recording a script and select the layer you want with the user interface. Save the script, examine it, and copy/paste into your new script.
-
riggsdp
- Posts: 6
- Joined: Sun Dec 05, 2010 11:11 pm
- System_Drive: C
- 32bit or 64bit: 32 Bit
- motherboard: ASUSTeK Computer INC. P6T Rev 1.xx
- processor: 2.67 gigahertz Intel Core i7 920
- ram: 12 GB
- Video Card: NVIDIA GeForce GTX 280
- sound_card: Onboard
- Hard_Drive_Capacity: 2 TB
- Location: Utah
- Contact:
Re: Set specific layer to be selected in script
I've tried all that and the only thing I can see where it determines the layer is by selecting where the layer to select is in relation to the layer that is currently selected.
So, if I have three layers and start recording with the first layer from the top selected, then select the third layer, then the first layer, then second layer, the script indicates to select 0,-2, which is the layer two down from the selected layer, then 0,2, which is two layers up from the layer I just selected, then 0,-1 which is the layer one down from the layer just selected.
I can't find a way to select the very first layer at the very top of the listing no matter what layer I'm currently on.
If I have layer 256 selected, then I need it to turn layer 1 on or off, if I have layer 36 selected, I still layer 1 turned on or off.
So, if I have three layers and start recording with the first layer from the top selected, then select the third layer, then the first layer, then second layer, the script indicates to select 0,-2, which is the layer two down from the selected layer, then 0,2, which is two layers up from the layer I just selected, then 0,-1 which is the layer one down from the layer just selected.
I can't find a way to select the very first layer at the very top of the listing no matter what layer I'm currently on.
If I have layer 256 selected, then I need it to turn layer 1 on or off, if I have layer 36 selected, I still layer 1 turned on or off.
-dar
-
df
- Posts: 1224
- Joined: Mon Feb 08, 2010 11:21 pm
- System_Drive: C
- 32bit or 64bit: 64 Bit
- motherboard: GIGABYTE Z690 AERO G DDR4
- processor: 13th Gen Intel Core i7-13700K
- ram: 64gb
- Video Card: RTX 3060 Ti 8gb GDRR6
- Hard_Drive_Capacity: 1 Tb
- Location: Washington State
- Contact:
Re: Set specific layer to be selected in script
To select the very top layer simply have your script select the base layer, add a new layer, arrange that layer to the top, then delete that layer. You now have the top layer selected by default. If you just add a layer without selecting the base layer first then the script will come up with a fault if you already have the top layer selected.
I'm sure there are other solutions as well.
I'm sure there are other solutions as well.
Regards, Dan
"Smoke me a kipper, I'll be back for breakfast."
"Smoke me a kipper, I'll be back for breakfast."
-
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: Set specific layer to be selected in script
Most of the time you won't want to be selecting a specific layer unless you've made the layer and then it's a simple up or down scenario. So there isn't a special command for it but you can use the SelectLayer() command with the strict setting turned off to force Paint Shop Pro to approximate the topmost or bottommost layers.
The document "Scripting for Script Authors" gives a more detailed example of selecting layers so I suggest you read it. If you don't have it you can download it here: http://corel.custhelp.com/app/answers/d ... stallation
This is a direct quote from that document on some ways to select specific layers.
To select the bottommost layer: (9999, -9999, [], False)
To select the topmost layer: (9999, 9999, [], False)
To select the topmost element of the current group: (0, 9999, [], False)
To select the topmost child of the current layer (0, 0, [9999], False)
To select the next layer up: (0, 1, [], False)
To select the next layer down: (0, -1, [], False)
To select the parent layer: (1, 0, [], False)
The document "Scripting for Script Authors" gives a more detailed example of selecting layers so I suggest you read it. If you don't have it you can download it here: http://corel.custhelp.com/app/answers/d ... stallation
This is a direct quote from that document on some ways to select specific layers.
To select the bottommost layer: (9999, -9999, [], False)
To select the topmost layer: (9999, 9999, [], False)
To select the topmost element of the current group: (0, 9999, [], False)
To select the topmost child of the current layer (0, 0, [9999], False)
To select the next layer up: (0, 1, [], False)
To select the next layer down: (0, -1, [], False)
To select the parent layer: (1, 0, [], False)
https://levifiction.wordpress.com/
-
riggsdp
- Posts: 6
- Joined: Sun Dec 05, 2010 11:11 pm
- System_Drive: C
- 32bit or 64bit: 32 Bit
- motherboard: ASUSTeK Computer INC. P6T Rev 1.xx
- processor: 2.67 gigahertz Intel Core i7 920
- ram: 12 GB
- Video Card: NVIDIA GeForce GTX 280
- sound_card: Onboard
- Hard_Drive_Capacity: 2 TB
- Location: Utah
- Contact:
Re: Set specific layer to be selected in script
Thanks, I'll try the one to select the topmost layer. I've also downloaded the scripting help file.
Much appreciated, dar
Much appreciated, dar
-dar
