This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > PainShop Pro Scripting > February 2006 > PSP-9 script fails with PSP-10 - has a command name changed?
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 |
PSP-9 script fails with PSP-10 - has a command name changed?
|
|
| David J Taylor 2006-02-25, 6:19 pm |
| Folks, a script which worked on PSP-9 fails on PSP-10. Here is a fragment
where the failure occurs:
---------------------------------------
os.path.walk( DirectoryToUse, FoundDir, CandidateDirs )
for Folder in CandidateDirs:
print 'Browse: ', Folder
# Browse
App.Do( Environment, 'Browse', {
'Folder': Folder,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
---------------------------------------
The error message is:
----------------------------------------
Executing RunScript
Browse: F:\Meteosat
Traceback (most recent call last):
File "E:\Program Files\Corel\Corel Paint Shop Pro
X\Scripts-Trusted\BrowseTree.PspScript", line 45, in Do
App.Do( Environment, 'Browse', {
JascApp.InvalidCommandName: Invalid or missing command name
------- Command Execution Failed -----------
Command Name: RunScript
Error Text: The script could not be executed.
----------------------------------------
So did the command name for Browse change or what? Where can I find a
list of the PSP-10 commands? Would having the browser window normally
closed affect this.
Your help would be appreciated.
Thanks,
David
| |
| Howard Dickson 2006-02-25, 6:19 pm |
| David J Taylor wrote:
> Folks, a script which worked on PSP-9 fails on PSP-10. Here is a fragment
> where the failure occurs:
>
> ---------------------------------------
> os.path.walk( DirectoryToUse, FoundDir, CandidateDirs )
> for Folder in CandidateDirs:
> print 'Browse: ', Folder
> # Browse
> App.Do( Environment, 'Browse', {
> 'Folder': Folder,
> 'GeneralSettings': {
> 'ExecutionMode': App.Constants.ExecutionMode.Silent,
> 'AutoActionMode': App.Constants.AutoActionMode.Match
> }
> })
> ---------------------------------------
>
> The error message is:
>
> ----------------------------------------
> Executing RunScript
> Browse: F:\Meteosat
> Traceback (most recent call last):
> File "E:\Program Files\Corel\Corel Paint Shop Pro
> X\Scripts-Trusted\BrowseTree.PspScript", line 45, in Do
> App.Do( Environment, 'Browse', {
> JascApp.InvalidCommandName: Invalid or missing command name
> ------- Command Execution Failed -----------
> Command Name: RunScript
> Error Text: The script could not be executed.
> ----------------------------------------
>
> So did the command name for Browse change or what? Where can I find a
> list of the PSP-10 commands? Would having the browser window normally
> closed affect this.
>
> Your help would be appreciated.
>
> Thanks,
> David
>
>
David,
The error says... JascApp.InvalidCommandName...
PSPX scripts run as PSPApp...
Make sure your script begins...
from PSPApp import *
import PSPUtils
and not the old...
from JascApp import *
import JascUtils
(you may not need the Utils impotered, depending on the content of the
script).
Rgds,
Howard
--
---oooOOOooo---
Sheilsoft
ComputerSystems
www.sheilsoft.com
---oooOOOooo---
| |
| Howard Dickson 2006-02-25, 6:19 pm |
| Howard Dickson wrote:
>
> (you may not need the Utils impotered, depending on the content of the
> script).
>
impotered?
(imported)
Sorry... I'm hitting the cooking sherry early today! :)
Rgds,
Howard
--
---oooOOOooo---
Sheilsoft
ComputerSystems
www.sheilsoft.com
---oooOOOooo---
| |
| David J Taylor 2006-02-25, 6:19 pm |
| Howard Dickson wrote:
> David J Taylor wrote:
> David,
>
> The error says... JascApp.InvalidCommandName...
> PSPX scripts run as PSPApp...
>
>
> Make sure your script begins...
>
> from PSPApp import *
> import PSPUtils
>
> and not the old...
>
> from JascApp import *
> import JascUtils
>
> (you may not need the Utils impotered, depending on the content of the
> script).
>
> Rgds,
> Howard
Howard,
Many thanks for your suggestion.
The start of my script now reads: from PSPApp import *
I didn't have the import JascUtils before so I didn't add it. However, I
still get exactly the same error message. The other scripts in the
\Scripts-Trusted\ directory typically have the header:
from JascApp import *
import JascUtils
although other scripts do have the PSPApp instead.
I also checked if having the Browser palette open or not before running
the script makes any difference, and it does not. Can I find a list of
the PSP-10 commands and their arguments somewhere? Perhaps the new
browser doesn't support the older commands?
Cheers,
David
| |
| Howard Dickson 2006-02-25, 6:19 pm |
| David J Taylor wrote:
> Howard Dickson wrote:
>
>
>
> Howard,
>
> Many thanks for your suggestion.
>
> The start of my script now reads: from PSPApp import *
> I didn't have the import JascUtils before so I didn't add it. However, I
> still get exactly the same error message. The other scripts in the
> \Scripts-Trusted\ directory typically have the header:
>
> from JascApp import *
> import JascUtils
>
> although other scripts do have the PSPApp instead.
>
> I also checked if having the Browser palette open or not before running
> the script makes any difference, and it does not. Can I find a list of
> the PSP-10 commands and their arguments somewhere? Perhaps the new
> browser doesn't support the older commands?
>
> Cheers,
> David
>
>
David as far as I'm aware, I haven't seen any new scripting resource
since the PSP9 'Scripting for Script Authors'. Going by all the problems
people have been having with PSPX's browser, it wouldn't surprise me
if the code and subsequent access commands have been altered. Sorry,
it's just something I've never used, or scripted for.
Rgds,
Howard
--
---oooOOOooo---
Sheilsoft
ComputerSystems
www.sheilsoft.com
---oooOOOooo---
| |
| SuzShook 2006-02-25, 6:19 pm |
|
Howard Dickson wrote:
> David J Taylor wrote:
> David,
>
> The error says... JascApp.InvalidCommandName...
> PSPX scripts run as PSPApp...
>
>
> Make sure your script begins...
>
> from PSPApp import *
> import PSPUtils
>
> and not the old...
>
> from JascApp import *
> import JascUtils
PSP X supports the JascApp import command - that's not the problem here.
I'm suspecting any commands which supported the pre-PSP X browser will not
work in PSP X, as the browser is now a palette. Just checked the Command
API for PSP X, and the command BROWSE is not in there. So that's the
problem, David. The command, like the browser window, disappeared in PSP X.
Suz
--
Suz Shook
C-Tech Volunteer
>
> (you may not need the Utils impotered, depending on the content of the
> script).
>
> Rgds,
> Howard
| |
| SuzShook 2006-02-25, 6:19 pm |
|
David J Taylor wrote:
> Howard Dickson wrote:
>
> Howard,
>
> Many thanks for your suggestion.
>
> The start of my script now reads: from PSPApp import *
> I didn't have the import JascUtils before so I didn't add it. However, I
> still get exactly the same error message. The other
> scripts in the \Scripts-Trusted\ directory typically have the header:
>
> from JascApp import *
> import JascUtils
>
> although other scripts do have the PSPApp instead.
>
> I also checked if having the Browser palette open or not before
> running the script makes any difference, and it does not. Can I find
> a list of the PSP-10 commands and their arguments somewhere? Perhaps
> the new browser doesn't support the older commands?
>
> Cheers,
> David
You're right there, David - some of the older commands are no longer
supported. Here's where you can get the complete command reference - it's
the PSPXCommandApi.ZIP document:
ftp://ftp.corel.com/pub/documentation/PSP/
--
Suz Shook
C-Tech Volunteer
| |
| RonaldV 2006-02-25, 6:19 pm |
| On Sat, 25 Feb 2006 14:26:41 -0000, "David J Taylor"
<david-taylor@blueyonder.co.not-this-bit.nor-this-part.uk.invalid>
wrote:
>Folks, a script which worked on PSP-9 fails on PSP-10. Here is a fragment
>where the failure occurs:
>
>---------------------------------------
> os.path.walk( DirectoryToUse, FoundDir, CandidateDirs )
> for Folder in CandidateDirs:
> print 'Browse: ', Folder
> # Browse
> App.Do( Environment, 'Browse', {
> 'Folder': Folder,
> 'GeneralSettings': {
> 'ExecutionMode': App.Constants.ExecutionMode.Silent,
> 'AutoActionMode': App.Constants.AutoActionMode.Match
> }
> })
>---------------------------------------
>
>The error message is:
>
>----------------------------------------
>Executing RunScript
>Browse: F:\Meteosat
>Traceback (most recent call last):
> File "E:\Program Files\Corel\Corel Paint Shop Pro
>X\Scripts-Trusted\BrowseTree.PspScript", line 45, in Do
> App.Do( Environment, 'Browse', {
>JascApp.InvalidCommandName: Invalid or missing command name
>------- Command Execution Failed -----------
>Command Name: RunScript
>Error Text: The script could not be executed.
>----------------------------------------
>
>So did the command name for Browse change or what? Where can I find a
>list of the PSP-10 commands? Would having the browser window normally
>closed affect this.
>
>Your help would be appreciated.
>
>Thanks,
>David
>
It almost appears as if the two different Walk commands are mixed up.
There's both a os.walk(x,y,z)
and a os.path.walk(x,y,z)
The definition of the os.path walk is:
walk( path, visit, arg)
Calls the function visit with arguments (arg, dirname, names) for each
directory in the directory tree rooted at path (including path itself,
if it is a directory). The argument dirname specifies the visited
directory, the argument names lists the files in the directory (gotten
from os.listdir(dirname)). The visit function may modify names to
influence the set of directories visited below dirname, e.g., to avoid
visiting certain parts of the tree. (The object referred to by names
must be modified in place, using del or slice assignment.)
For the code seqment you posted, there must be a
def FoundDir( DirectorytoUse, dirname, names):
"""what occurs here??"""
| |
| David J Taylor 2006-02-25, 10:16 pm |
| SuzShook wrote:
[]
> PSP X supports the JascApp import command - that's not the problem
> here. I'm suspecting any commands which supported the pre-PSP X
> browser will not work in PSP X, as the browser is now a palette. Just
> checked the Command API for PSP X, and the command BROWSE is not
> in there. So that's the problem, David. The command, like the
> browser window, disappeared in PSP X. Suz
Thanks, Suz.
I just got the documentation from the FTP server (the Web site is a
complete lack of help in finding that!), and I'll have a scan.
Do you think ShowBrowser is the same thing?
Thanks,
David
| |
| David J Taylor 2006-02-25, 10:16 pm |
| RonaldV wrote:
> On Sat, 25 Feb 2006 14:26:41 -0000, "David J Taylor"
> <david-taylor@blueyonder.co.not-this-bit.nor-this-part.uk.invalid>
> wrote:
>
> It almost appears as if the two different Walk commands are mixed up.
>
> There's both a os.walk(x,y,z)
> and a os.path.walk(x,y,z)
>
> The definition of the os.path walk is:
> walk( path, visit, arg)
>
> Calls the function visit with arguments (arg, dirname, names) for each
> directory in the directory tree rooted at path (including path itself,
> if it is a directory). The argument dirname specifies the visited
> directory, the argument names lists the files in the directory (gotten
> from os.listdir(dirname)). The visit function may modify names to
> influence the set of directories visited below dirname, e.g., to avoid
> visiting certain parts of the tree. (The object referred to by names
> must be modified in place, using del or slice assignment.)
>
> For the code seqment you posted, there must be a
>
> def FoundDir( DirectorytoUse, dirname, names):
> """what occurs here??"""
> .
> .
> return
>
> segment in the code.
>
> Ron
Ron,
Yes, there is such a segment - it simply adds each found folder to the
list:
------------------------------------
def FoundDir( OutList, CurrentDir, FilesInDir ):
''' Called by os.path.walk for each directory we encounter. Gets
passed the
list of files we are building up (OutList), the directory we are
visiting
(CurrentDir), and a list of all the filenames (without path) in the
current
directory. We need to strip out anything that is a directory or
doesn't
match our search string.
'''
' *** Add a folder to the list'
OutList.append( CurrentDir )
------------------------------------
(the comments remain from the code I lifted this from some years ago).
My current version looks like this:
------------------------------------
os.path.walk( DirectoryToUse, FoundDir, CandidateDirs )
for Folder in CandidateDirs:
print 'Browse: ', Folder
# Browse
App.Do( Environment, 'ShowBrowser', {
'BrowseToFolder': Folder,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
------------------------------------
and this doesn't fail, but neither does it set the folder to browse each
iteration. The print statement correctly shows each folder in the tree.
So how am I supposed to tell the program which folder to browse, and is
there some magic switch I may have failed to set (I'm not at all up on
scripts, although quite happy with programming in general). Is
"BrowseToFolder" the correct thing to try and set, and am I setting it
correctly?
Thanks,
David
| |
| RonaldV 2006-02-25, 10:16 pm |
| On Sat, 25 Feb 2006 16:41:42 -0000, "David J Taylor"
<david-taylor@blueyonder.co.not-this-bit.nor-this-part.uk.invalid>
wrote:
>
>My current version looks like this:
>
>------------------------------------
> os.path.walk( DirectoryToUse, FoundDir, CandidateDirs )
> for Folder in CandidateDirs:
> print 'Browse: ', Folder
> # Browse
> App.Do( Environment, 'ShowBrowser', {
> 'BrowseToFolder': Folder,
> 'GeneralSettings': {
> 'ExecutionMode': App.Constants.ExecutionMode.Silent,
> 'AutoActionMode': App.Constants.AutoActionMode.Match
> }
> })
>------------------------------------
>
>and this doesn't fail, but neither does it set the folder to browse each
>iteration. The print statement correctly shows each folder in the tree.
>So how am I supposed to tell the program which folder to browse, and is
>there some magic switch I may have failed to set (I'm not at all up on
>scripts, although quite happy with programming in general). Is
>"BrowseToFolder" the correct thing to try and set, and am I setting it
>correctly?
It appears that there is a problem and a change.
The following is the PSPX version:
# ShowBrowser
App.Do( Environment, 'ShowBrowser', {
'BrowseToFolder': u'D:\\2005',
'Command': App.Constants.ShowCommands.Hide,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((10,0,3),1)
}
Where the command can be one of three: Hide (shown), Show,
Toggle (default)
Hide to remove, Show to turn it on, and Toggle to switch to the
opposide state.
The glitch I've run into is getting the script to accept any defined
folder. It always seems to show the previously manual set directory
no matter what I put into BrowseToFolder. And I've tried string
variables, localy defined, as above. I also tried a new defined
default directory, using os.chdir('where ever') which didn't seem to
change anything.
Looks like X holds it's own Directory location, and uses that.
Ron
| |
| David J Taylor 2006-02-25, 10:16 pm |
| RonaldV wrote:
> On Sat, 25 Feb 2006 16:41:42 -0000, "David J Taylor"
> <david-taylor@blueyonder.co.not-this-bit.nor-this-part.uk.invalid>
> wrote:
>
>
>
> It appears that there is a problem and a change.
>
> The following is the PSPX version:
> # ShowBrowser
> App.Do( Environment, 'ShowBrowser', {
> 'BrowseToFolder': u'D:\\2005',
> 'Command': App.Constants.ShowCommands.Hide,
> 'GeneralSettings': {
> 'ExecutionMode': App.Constants.ExecutionMode.Default,
> 'AutoActionMode': App.Constants.AutoActionMode.Match,
> 'Version': ((10,0,3),1)
> }
>
> Where the command can be one of three: Hide (shown), Show,
> Toggle (default)
>
> Hide to remove, Show to turn it on, and Toggle to switch to the
> opposide state.
>
> The glitch I've run into is getting the script to accept any defined
> folder. It always seems to show the previously manual set directory
> no matter what I put into BrowseToFolder. And I've tried string
> variables, localy defined, as above. I also tried a new defined
> default directory, using os.chdir('where ever') which didn't seem to
> change anything.
>
> Looks like X holds it's own Directory location, and uses that.
>
> Ron
Yes, that's the (very tentative) conclusion I had reached as well. Which
means that the BrowseToFolder parameter is completely ignored, doesn't it?
Given a little more confirmation from the scripting experts here, I might
submit this to Corel tech support.
Many thanks for your efforts.
David
| |
| Spandex Rutabaga 2006-02-27, 6:21 pm |
| David J Taylor wrote:
>
> RonaldV wrote:
>
> Yes, that's the (very tentative) conclusion I had reached as well. Which
> means that the BrowseToFolder parameter is completely ignored, doesn't it?
You could try editing the registry from a script to point to the
folder you want to browse. What a kluge! :)
| |
| David J Taylor 2006-02-27, 6:21 pm |
| Spandex Rutabaga wrote:
> David J Taylor wrote:
>
>
> You could try editing the registry from a script to point to the
> folder you want to browse. What a kluge! :)
Indeed it would be!
I expect software I have paid good money for to work as documented.
I am still waiting for a response from the Company on this one.
David
| |
| RonaldV 2006-02-27, 6:21 pm |
| On Mon, 27 Feb 2006 11:07:21 -0600, Spandex Rutabaga
<SpRu@agabatur.xednaps> wrote:
>David J Taylor wrote:
>
>
>You could try editing the registry from a script to point to the
>folder you want to browse. What a kluge! :)
I don't think that would work, since the PSP stored value would over
ride it for the Python command. The os.chdir() Python command works
directly upon the os default dir. and that didn't work.
RonV
Tangling with the Python
| |
| Spandex Rutabaga 2006-02-27, 6:21 pm |
| RonaldV wrote:
>
> On Mon, 27 Feb 2006 11:07:21 -0600, Spandex Rutabaga
> <SpRu@agabatur.xednaps> wrote:
>
>
> I don't think that would work, since the PSP stored value would over
> ride it for the Python command. The os.chdir() Python command works
> directly upon the os default dir. and that didn't work.
You choose the folder you want to work on. You use it in the
os.whatever() command if needed. You also write it as a replacement
value for the PSP key currently stored in the the registry. After
all that, you have the script do something useful (e.g. browse)
driven by the new key value now in effect. PSP doesn't know you
snuck behind its back and changed the thing it wrote to the
registry. (At least I imagine it doesn't know.)
> RonV
> Tangling with the Python
| |
| RonaldV 2006-02-27, 10:17 pm |
| On Mon, 27 Feb 2006 15:28:13 -0600, Spandex Rutabaga
<SpRu@agabatur.xednaps> wrote:
>You choose the folder you want to work on. You use it in the
>os.whatever() command if needed. You also write it as a replacement
>value for the PSP key currently stored in the the registry. After
>all that, you have the script do something useful (e.g. browse)
>driven by the new key value now in effect. PSP doesn't know you
>snuck behind its back and changed the thing it wrote to the
>registry. (At least I imagine it doesn't know.)
I haven't had any luck so far...
Here's what I've tried to do.
Open PSPX, open browser, navigate to D:\pictures
and let it populate the thumbs.
Close PSPX.
Run Regedit
Find the Corel 10 Browse section, change the address from D:\pictures
to C:\temp\pictures (also a legal dir.)
Open PSPX
Open Browser, and views the contents of
D:\pictures
From this, it doesn't appear that the end around play doesn't work.
Always willing to try more, though.
Ron
|
|
|
| | Copyright 2003 - 2009 forum4designers.com Software forum Computer Hardware reviews |
|