Return Crop Tool Position

Moderator: Kathy_9

Post Reply
Dave_SMR
Posts: 8
Joined: Fri Jul 29, 2016 10:08 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: FOXCONN A76ML-K 30 1.0
processor: Athlon II X4 640
ram: 8GB
Video Card: ATI Radeon 3000 Graphics
Hard_Drive_Capacity: 250GB
Monitor/Display Make & Model: Hanns.G HL225D x 2
Corel programs: PSP X7 / VS X8

Return Crop Tool Position

Post by Dave_SMR »

I have a script that starts from a user set crop area, applies the crop and adds some borders. I'd like to know the offset of the defined crop area when it first runs. Is this possible?
LeviFiction
Advisor
Posts: 6831
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
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: Return Crop Tool Position

Post by LeviFiction »

Yes and no. Mostly no. xD Yet more fun with PSP scripting. PSP rarely has any access to current at the moment information about the state of the program. The active location of a tool for example is not known.

Now, if they have applied the crop before then you can grab the previously used settings and use those. But that's about it.

So, if you tell your user to set the crop, apply it and then undo the crop you can find out what that value was.
https://levifiction.wordpress.com/
Dave_SMR
Posts: 8
Joined: Fri Jul 29, 2016 10:08 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: FOXCONN A76ML-K 30 1.0
processor: Athlon II X4 640
ram: 8GB
Video Card: ATI Radeon 3000 Graphics
Hard_Drive_Capacity: 250GB
Monitor/Display Make & Model: Hanns.G HL225D x 2
Corel programs: PSP X7 / VS X8

Re: Return Crop Tool Position

Post by Dave_SMR »

That could be useful. How do I grab those previously used values?
LeviFiction
Advisor
Posts: 6831
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
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: Return Crop Tool Position

Post by LeviFiction »

This is taken the AddBordersAndSelect Script.

Code: Select all

    # now call GetCommandInfo to extract the last used parameters.
    Info = App.Do(Environment,  'GetCommandInfo', {
                'TargetCmd': 'AddBorders',
                'ParamInfo': App.Constants.ParamInfo.LastUsed
                } )
    
    # command parameters are stored in a key consisting of library name and command name
    CmdParam = Info[ 'Library' ] + '\\' + Info['Name']
    Params = Info[CmdParam] # get a simpler dictionary to work with
Just change the 'TargetCmd' parameter to the command you want to get the last settings of. And Params will hold a dictionary of all of the parameters.
https://levifiction.wordpress.com/
Post Reply