Hey guys,
is it possible to detect when the user cancels the script, so we can do some cleanup work?
Maybe something like the API sending such info (maybe via a method) and giving us some time to cleanup before it actually cancels the script?
Detecting User Cancellation?
Moderator: Kathy_9
Detecting User Cancellation?
Good Unofficial PaintShop Pro Tutorials: Creation Cassel • Make Shop Pro • HEC Image Editing • LeviFiction PSP Basics
(plus my own Gimp & Stuff)
(plus my own Gimp & Stuff)
- fs999
- Posts: 89
- Joined: Thu Jul 21, 2011 9:55 pm
- System_Drive: Z
- 32bit or 64bit: 64 Bit
- motherboard: Intel
- processor: i7 860
- ram: 32GB
- Video Card: NVIDIA GeForce GTX 730
- sound_card: Samsung HDMI
- Hard_Drive_Capacity: 28 TB
- Monitor/Display Make & Model: Philips 24P4 & Samsung UE46M6050
- Corel programs: PaintShop 2023 Ultimate
Re: Detecting User Cancellation?
I asked that question some time ago : Interception of a cancelled interactive command.
Re: Detecting User Cancellation?
Ah, sorry I missed it. Thanks for pointing it out!
PS. Seems we cannot, right? In that topic, Levi assumes the script keeps running and provides a couple of ways to detect if a layer has been changed (if I got it right) .
PS. Seems we cannot, right? In that topic, Levi assumes the script keeps running and provides a couple of ways to detect if a layer has been changed (if I got it right) .
Good Unofficial PaintShop Pro Tutorials: Creation Cassel • Make Shop Pro • HEC Image Editing • LeviFiction PSP Basics
(plus my own Gimp & Stuff)
(plus my own Gimp & Stuff)
-
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: Detecting User Cancellation?
migf1 - Correct but I want to make sure I'm being clear. The topic linked was about canceling a single command, not canceling the entire script.
If a user runs a script and the script calls a command like "HSL" interactively, the user can either apply it or cancel the command. Once they've canceled the command PSP asks "do you want to stop running the whole script"? The user can then cancel the entire script, or continue to run the script.
If a user cancels the entire script, the script stops dead. No more execution period. None of the documentation provided by Corel suggests there is a Cleanup routine/callback that is called. It just stops running the script. So no clean-up is possible if they cancel the entire script.
If they don't cancel the script, the script continues to run whether you used that command or not.
In fs999's case they had a plugin, and they wanted to know if they could detect if the plugin was cancelled while the script still ran. So I gave a few possible options. They aren't great options but they are at least manageable.
However, many commands in PSP do return values depending on whether or not they were properly run. So the answer I gave fs999 for dealing with the result of canceling a plugin is not meant to be universal advice. See what the command you're running returns, If anything. If the command normally returns data (e.g GetMaterial) and it now returns "None" the command was cancelled. But if the command never returns data (e.g. ColorAdjustHSL) then you can't check if the command was canceled. Again as far as I know.
If a user runs a script and the script calls a command like "HSL" interactively, the user can either apply it or cancel the command. Once they've canceled the command PSP asks "do you want to stop running the whole script"? The user can then cancel the entire script, or continue to run the script.
If a user cancels the entire script, the script stops dead. No more execution period. None of the documentation provided by Corel suggests there is a Cleanup routine/callback that is called. It just stops running the script. So no clean-up is possible if they cancel the entire script.
If they don't cancel the script, the script continues to run whether you used that command or not.
In fs999's case they had a plugin, and they wanted to know if they could detect if the plugin was cancelled while the script still ran. So I gave a few possible options. They aren't great options but they are at least manageable.
However, many commands in PSP do return values depending on whether or not they were properly run. So the answer I gave fs999 for dealing with the result of canceling a plugin is not meant to be universal advice. See what the command you're running returns, If anything. If the command normally returns data (e.g GetMaterial) and it now returns "None" the command was cancelled. But if the command never returns data (e.g. ColorAdjustHSL) then you can't check if the command was canceled. Again as far as I know.
https://levifiction.wordpress.com/
- fs999
- Posts: 89
- Joined: Thu Jul 21, 2011 9:55 pm
- System_Drive: Z
- 32bit or 64bit: 64 Bit
- motherboard: Intel
- processor: i7 860
- ram: 32GB
- Video Card: NVIDIA GeForce GTX 730
- sound_card: Samsung HDMI
- Hard_Drive_Capacity: 28 TB
- Monitor/Display Make & Model: Philips 24P4 & Samsung UE46M6050
- Corel programs: PaintShop 2023 Ultimate
Re: Detecting User Cancellation?
The idea of counting the colours before and after the command is very good !
