This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > PainShop Pro Scripting > February 2006 > Ping - Fred, Spandex, Suz etc...





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Ping - Fred, Spandex, Suz etc...
Howard Dickson

2006-02-20, 3:36 am

Guys,

When you have an open image, it appears as an available Pattern in the
Materials Palette, along with all the other patterns (always the top
pattern).

Is there a way, using the 'SetMaterial' code, to select it as the active
pattern, so it can be used by the script later on as as a fill, without
actually manually selecting it?

I've tried a few parameters, which are obviously wrong, as they just
activate 'Animal Leopard' which is by default the first pattern on the
list (even when my image is shown as an available patern).

Any help appreciated.

Rgds,
Howard
--

---oooOOOooo---

Sheilsoft
ComputerSystems

www.sheilsoft.com

---oooOOOooo---
Joske

2006-02-20, 3:36 am

Howard Dickson wrote:

> Guys,


> When you have an open image, it appears as an available Pattern
> in the Materials Palette, along with all the other patterns
> (always the top pattern).


> Is there a way, using the 'SetMaterial' code, to select it as the
> active pattern, so it can be used by the script later on as as a
> fill, without actually manually selecting it?


> I've tried a few parameters, which are obviously wrong, as they
> just activate 'Animal Leopard' which is by default the first
> pattern on the list (even when my image is shown as an available
> patern).


> Any help appreciated.


This seems tricky to me. I know you're going to create a New Image
with the script, but there is no guarantee the user will only have
one other image (for the pattern fill open)... so you can't fill
with something called Image1 or something, and you don't know which
shows up first in the materials. Even if you used SelectDocument and
TargetDocument, you wouldn't know which one (relative in order of
opening) to select.

Unless you can force users to have a freshly opened PSP plus only
the fill image open, I can't think of a way to do this quickly from
within SetMaterial or the palette.

How about, maybe...

Create the New Image, put up a dialog asking the user to activate
the image with the pattern. ReturnImageInfo from the pattern image,
give it a name, and make that the fill.

You would need

#def Do( Environment:
ImageInfo = App.Do (Environment, 'ReturnImageInfo')
OtherImage = ImageInfo['FileName']

and for the fill something like

'Material': OtherImage,

Too late here to puzzle on this further :-)

Joske




Joske

2006-02-20, 3:36 am

Joske wrote:

> How about, maybe...


> Create the New Image, put up a dialog asking the user to activate
> the image with the pattern. ReturnImageInfo from the pattern
> image, give it a name, and make that the fill.


> You would need


> #def Do( Environment:
> ImageInfo = App.Do (Environment, 'ReturnImageInfo')
> OtherImage = ImageInfo['FileName']


> and for the fill something like
>
> 'Material': OtherImage,


> Too late here to puzzle on this further :-)


I forgot: this in itself would work without the user using the
Materials Palette. I think you would want them to go in there? Maybe
to resize or rotate the pattern?

A quick thought: once you did the initial fill for them as described
above, a second dialog asking them if they accept it (Yes) or want
to try again (No) can take them to the Materials Palette and I think
(but it's late here so don't laugh at me if I'm wrong) the last
selected material should still be selected in there.

Joske
http://members.home.nl/j.backer/cba...oring-baby.html



Howard Dickson

2006-02-20, 3:36 am

Joske wrote:
> Joske wrote:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> I forgot: this in itself would work without the user using the
> Materials Palette. I think you would want them to go in there? Maybe
> to resize or rotate the pattern?
>
> A quick thought: once you did the initial fill for them as described
> above, a second dialog asking them if they accept it (Yes) or want
> to try again (No) can take them to the Materials Palette and I think
> (but it's late here so don't laugh at me if I'm wrong) the last
> selected material should still be selected in there.
>
> Joske
> http://members.home.nl/j.backer/cba...oring-baby.html
>
>
>

Joske,

Yeah, I don't really want any further dialogs for the user, nor do I
want to pause the script, and manually select the image pattern from the
Patterns list. The open file would already have a filename, and is shown
in the Patterns list under this filename. I'm just looking for a way to
set it at the active pattern, as you would any of the default patterns,
using SetMaterial.

I noticed when I tried to record the action of selecting this pattern, I
ended up with some kind of metadata embedded within the script relating
to the image pattern, with a script size of 8 MB!

Rgds,
Howard

--

---oooOOOooo---

Sheilsoft
ComputerSystems

www.sheilsoft.com

---oooOOOooo---
Joske

2006-02-20, 3:36 am

Joske wrote:
> Howard Dickson wrote:


[color=darkred]
> You can uncheck 'Save Materials' when saving.


> Good luck.


It is late, can you tell... :-)

You have the New Image dialog. Provided the image with the pattern
is the active image, you can use my ReturnImageInfo directions for
the NewFile FillMaterial. Now it's up to you to have your script
look into its crystal ball to know that the user doesn't have other
images open or active.

Joske


Howard Dickson

2006-02-24, 10:28 am

Joske wrote:
> Joske wrote:
>
>
>
>
>
>
>
>
>
> It is late, can you tell... :-)
>
> You have the New Image dialog. Provided the image with the pattern
> is the active image, you can use my ReturnImageInfo directions for
> the NewFile FillMaterial. Now it's up to you to have your script
> look into its crystal ball to know that the user doesn't have other
> images open or active.
>
> Joske
>
>

Thanks Joske... I forgot about the Save Materials option when saving.

However it doesn't help with setting the current image as the active
pattern from within a script. I tried using App.ActiveDocument.Name (and
Title) in the SetMaterials code, but it didn't work.

Any further ideas folks?

Rgds,
Howard

--

---oooOOOooo---

Sheilsoft
ComputerSystems

www.sheilsoft.com

---oooOOOooo---
SuzShook

2006-02-24, 10:28 am

I don't know how you'd do this, Howard. But, if the image is chosen and
opened before running the script, the user could set the Materials Palette
to that image before starting, say in the Foreground Material box. Then by
filling with the Foreground Material in the script, you'd get the pattern
you want, without additional dialogs or pauses. However, that might not be
what you want - seems too simple. The only other way I can think of to do
it is to insert a GetMaterial command into the script, in Interactive mode,
and have the user select the appropriate pattern from the list. I know it's
always at the top of the list, but the SetMaterial command uses a name from
the available Pattern locations, and won't take the current image, even if
it is a saved image, unless it's a saved image in one of the Patterns
folders. Suz

Howard Dickson wrote:
> Guys,
>
> When you have an open image, it appears as an available Pattern in the
> Materials Palette, along with all the other patterns (always the top
> pattern).
>
> Is there a way, using the 'SetMaterial' code, to select it as the
> active pattern, so it can be used by the script later on as as a
> fill, without actually manually selecting it?
>
> I've tried a few parameters, which are obviously wrong, as they just
> activate 'Animal Leopard' which is by default the first pattern on the
> list (even when my image is shown as an available patern).
>
> Any help appreciated.
>
> Rgds,
> Howard



Howard Dickson

2006-02-24, 10:28 am

SuzShook wrote:
> I don't know how you'd do this, Howard. But, if the image is chosen and
> opened before running the script, the user could set the Materials Palette
> to that image before starting, say in the Foreground Material box. Then by
> filling with the Foreground Material in the script, you'd get the pattern
> you want, without additional dialogs or pauses. However, that might not be
> what you want - seems too simple. The only other way I can think of to do
> it is to insert a GetMaterial command into the script, in Interactive mode,
> and have the user select the appropriate pattern from the list. I know it's
> always at the top of the list, but the SetMaterial command uses a name from
> the available Pattern locations, and won't take the current image, even if
> it is a saved image, unless it's a saved image in one of the Patterns
> folders. Suz
>


Suz,

Yeah, I was afraid that it would be a problem. I didn't really want to
pause to get the user to GetMaterial (I use that method in another part
of the script). You'd think that because it appears as a pattern, at the
top of the list, there would be a naming convention or source link which
ties it to the Foreground material when selected, so therefore should be
able to be set as current material when scripting.

It can't just be the file location, because if you make a change to the
open image (without saving it), then select it as the foreground
material, it is the altered image which is used for fills etc, not the
source file.

Hmmm... (noise of head banging against wall)

Rgds,
Howard

--

---oooOOOooo---

Sheilsoft
ComputerSystems

www.sheilsoft.com

---oooOOOooo---
SuzShook

2006-02-24, 10:28 am



Howard Dickson wrote:
> SuzShook wrote:
>
> Suz,
>
> Yeah, I was afraid that it would be a problem. I didn't really want to
> pause to get the user to GetMaterial (I use that method in another
> part of the script). You'd think that because it appears as a
> pattern, at the top of the list, there would be a naming convention
> or source link which ties it to the Foreground material when
> selected, so therefore should be able to be set as current material
> when scripting.
> It can't just be the file location, because if you make a change to
> the open image (without saving it), then select it as the foreground
> material, it is the altered image which is used for fills etc, not the
> source file.


I'm not sure I'm following you here, Howard. Are you saying this happens in
a script? Or in PSP? In a script, if you choose the open image using a
GetMaterial command after the image is changed, you'll get the changed
image. But you have to do it that way, I think - with a GetMaterial
command. I don't think you can do it with the image's name, as that
parameter searches the Pattern Locations to get the name you enter in the
Name parameter. I think the key here is you make the change and "then
select it as the foreground material" - you are now selecting the open image
rather than the source file. Or are you talking about something else? Suz
>
> Hmmm... (noise of head banging against wall)
>
> Rgds,
> Howard



Howard Dickson

2006-02-24, 10:28 am

SuzShook wrote:
> Howard Dickson wrote:
>
>
>
> I'm not sure I'm following you here, Howard. Are you saying this happens in
> a script? Or in PSP? In a script, if you choose the open image using a
> GetMaterial command after the image is changed, you'll get the changed
> image. But you have to do it that way, I think - with a GetMaterial
> command. I don't think you can do it with the image's name, as that
> parameter searches the Pattern Locations to get the name you enter in the
> Name parameter. I think the key here is you make the change and "then
> select it as the foreground material" - you are now selecting the open image
> rather than the source file. Or are you talking about something else? Suz
>
>

Suz,

No, sorry I may be confusing you here. I was just thinking, in PSP, what
the name was, given to the open image, as it appears in the Patterns
list. I know it shows on the list, simply as the filename.

I tried using the App.ActiveDocument.Name in the SetMaterial code, and
it didn't work, so I thought perhaps PSP used a longer filename
including it's file location, but as I said, this wouldn't be the case,
as it updates the (unsaved) image pattern when changes are made to it.

Just thinking out loud, as to what the name parameter might be, to pass
to SetMaterial. Maybe it just can't be done!

Rgds,
Howard


--

---oooOOOooo---

Sheilsoft
ComputerSystems

www.sheilsoft.com

---oooOOOooo---
Spandex Rutabaga

2006-02-24, 10:28 am

Howard Dickson wrote:

> It can't just be the file location, because if you make a change to the
> open image (without saving it), then select it as the foreground
> material, it is the altered image which is used for fills etc, not the
> source file.


I haven't the slightest idea how to solve your problem I'm afraid.
However, I believe that when an open image is used as a pattern
it is not referenced by a name. Instead the image data are stored
uuencoded in the script, which makes the script portable even if
the image was never saved.

> Hmmm... (noise of head banging against wall)
>
> Rgds,
> Howard
>
> --
>
> ---oooOOOooo---
>
> Sheilsoft
> ComputerSystems
>
> www.sheilsoft.com
>
> ---oooOOOooo---

Howard Dickson

2006-02-24, 10:28 am

Spandex Rutabaga wrote:
> Howard Dickson wrote:
>
>
>
>
> I haven't the slightest idea how to solve your problem I'm afraid.
> However, I believe that when an open image is used as a pattern
> it is not referenced by a name. Instead the image data are stored
> uuencoded in the script, which makes the script portable even if
> the image was never saved.
>

Ah well, It looks like it's not to be.
It does look as if the parameters get passed internally.

Thanks everyone! :)

Rgds,
Howard
--

---oooOOOooo---

Sheilsoft
ComputerSystems

www.sheilsoft.com

---oooOOOooo---
Willy

2006-02-24, 10:28 am

underprocessable
Willy

2006-02-24, 10:28 am

underprocessable
Howard Dickson

2006-02-24, 10:28 am

Willy wrote:
> Not sure if this is what your trying to do. As I read your question you want
> to imbed a pattern in your script. Here is a simple example. Open an new
> image then run this script.
>
> W
>


Willy,

Yeah... I think all you've managed to do is record your image (with the
Save Materials part of the script save), which is what gets filled when
I run it here... and I'm assuming your image was quite small, going by
the filesize of your script. I did do this on a 'normal' sized image,
and ended up with a 'very' large script.

The point is, you're just recording a specific image's metadata, not a
generic filename that can be edited for use on any open file.

Thanks anyway.

Rgds,
Howard
> "Howard Dickson" <howard@REMOVEsheilsoft.com> wrote in message
> news:43f8f974$1_2@cnews...
>
>
>
>



--

---oooOOOooo---

Sheilsoft
ComputerSystems

www.sheilsoft.com

---oooOOOooo---
Willy

2006-02-24, 10:28 am

Yes that is what I did. This is the only way I know of to make the pattern
portable, in a script, if the pattern is not saved on the user machine.
W
"Howard Dickson" <howard@REMOVEsheilsoft.com> wrote in message
news:43f9f651$1_3@cnews...
> Willy wrote:
>
> Willy,
>
> Yeah... I think all you've managed to do is record your image (with the
> Save Materials part of the script save), which is what gets filled when I
> run it here... and I'm assuming your image was quite small, going by the
> filesize of your script. I did do this on a 'normal' sized image, and
> ended up with a 'very' large script.
>
> The point is, you're just recording a specific image's metadata, not a
> generic filename that can be edited for use on any open file.
>
> Thanks anyway.
>
> Rgds,
> Howard
>
>
> --
>
> ---oooOOOooo---
>
> Sheilsoft
> ComputerSystems
>
> www.sheilsoft.com
>
> ---oooOOOooo---



Howard Dickson

2006-02-24, 10:28 am

Willy wrote:
> Yes that is what I did. This is the only way I know of to make the pattern
> portable, in a script, if the pattern is not saved on the user machine.
> W


Hi Willy,

Sorry, I wasn't trying to make the pattern portable... just trying to
get the script to set the current image's pattern as the active
foreground pattern, as you can do with the native patterns.

Rgds,
Howard

--

---oooOOOooo---

Sheilsoft
ComputerSystems

www.sheilsoft.com

---oooOOOooo---
Pat

2006-02-24, 10:28 am

Howard,
One thought would be to save the pattern in the script then after you have
used it delete that file. That would be one way to control which open image
pattern was used.

W
"Howard Dickson" <howard@REMOVEsheilsoft.com> wrote in message
news:43f9fb2e_2@cnews...
> Willy wrote:
>
> Hi Willy,
>
> Sorry, I wasn't trying to make the pattern portable... just trying to get
> the script to set the current image's pattern as the active foreground
> pattern, as you can do with the native patterns.
>
> Rgds,
> Howard
>
> --
>
> ---oooOOOooo---
>
> Sheilsoft
> ComputerSystems
>
> www.sheilsoft.com
>
> ---oooOOOooo---



Spandex Rutabaga

2006-02-24, 10:28 am

Howard Dickson wrote:

> Yeah... I think all you've managed to do is record your image (with the
> Save Materials part of the script save), which is what gets filled when
> I run it here... and I'm assuming your image was quite small, going by
> the filesize of your script. I did do this on a 'normal' sized image,
> and ended up with a 'very' large script.


When you uuencode data you use only printable ASCII characters,
which means using only seven bits of the eight in every byte and
denying yourself the use of characters with low values, which
serve as control characters such as line feed or carriage return.
Consequently the total number of bytes to be stored increases
relative to the number in a binary image.

As I understand it, you want the user to open or create some image
whose name or document index is unknown in advance, select that
image as a pattern source in a script, and apply it to some other
image. I think the problem you are up against is that you have
what one might call a "pending" command. You have a pending fill
with an undefined material waiting for user selection (and a
second round draft choice to be named later). However, PSP doesn't
work that way. Scripts are expected to have complete commands with
all the parameters (or with empty parameters that cause the currently
set values to be used). This characteristic of "completeness" is what
causes all the pain with choice of materials and fonts and so on.
It may be possible to use Gary's pause script to get the user to
choose a pattern image, which you then save under some exotic name
unlikely to be duplicated, use in the second script pass and finally
destroy. That would require a trusted script of course. I'm waving
my hands about here since I don't really know anything about scripts.
Howard Dickson

2006-02-24, 10:28 am

Spandex Rutabaga wrote:
> Howard Dickson wrote:
>
>
>
>
> When you uuencode data you use only printable ASCII characters,
> which means using only seven bits of the eight in every byte and
> denying yourself the use of characters with low values, which
> serve as control characters such as line feed or carriage return.
> Consequently the total number of bytes to be stored increases
> relative to the number in a binary image.
>
> As I understand it, you want the user to open or create some image
> whose name or document index is unknown in advance, select that
> image as a pattern source in a script, and apply it to some other
> image. I think the problem you are up against is that you have
> what one might call a "pending" command. You have a pending fill
> with an undefined material waiting for user selection (and a
> second round draft choice to be named later). However, PSP doesn't
> work that way. Scripts are expected to have complete commands with
> all the parameters (or with empty parameters that cause the currently
> set values to be used). This characteristic of "completeness" is what
> causes all the pain with choice of materials and fonts and so on.
> It may be possible to use Gary's pause script to get the user to
> choose a pattern image, which you then save under some exotic name
> unlikely to be duplicated, use in the second script pass and finally
> destroy. That would require a trusted script of course. I'm waving
> my hands about here since I don't really know anything about scripts.


Folks,

I think we'll just draw a line under this as 'can't be done'!

I appreciate all the advice, and some don't quite understand the
simplicity of what I'm wanting to do ie use the SetMaterials code in a
script allowing you to choose which pattern is selected as the current
pattern ( I use this in scripts quite a lot). No need to record, rename,
save or anything. I just wanted to to do the same with any open image
(which by default by PSP adds to the available patterns). You actually
don't have to use Gary's pause script to choose a material, you just use
the GetMaterial code.

Anyhoo... it's quite obvious it can't be done, so I'll find another
workaround.

Thanks again everyone! :)

Rgds,
Howard



--

---oooOOOooo---

Sheilsoft
ComputerSystems

www.sheilsoft.com

---oooOOOooo---
Sponsored Links


Copyright 2003 - 2009 forum4designers.com  Software forum  Computer Hardware reviews