SCOUG-HELP Mailing List Archives
Return to [ 09 |
October |
2005 ]
<< Previous Message <<
>> Next Message >>
Content Type: text/plain
Steven,
Let me give you a cleaned up version of the non-working code (the previous version
has some errors, due to some troubleshooting I was doing). OK, here it is:
StartingSubClass = .WPDesktop
SAY StartingSubClass
StartingSubClass = .DTTOOLS~CORRECT_CLASS_ID(SubClass, StartingSubClass,
"WPObject")
SAY StartingSubClass
DeskTopArray = .DTTOOLS~GETFOLDEROBJECTS(StartingSubClass)
::CLASS DESKTOP
::CLASS DTTOOLS SUBCLASS DESKTOP
::METHOD ISOLATE_CLASS CLASS /*Removes unprintable characters from the
SUPERCLASSES and SUBCLASSES search results*/
USE ARG Input
Input = TRANSLATE(Input, Copies('20'x, 256), XRANGE('7F'x, '1F'x))
/*Translate unprintable characters to spaces so that PARSE can separate
printable data from binary data*/
SELECT
WHEN TRANSLATE(Input) = "THE WORKPLACE DESKTOP" THEN
IsolatedClass = "WPDesktop"
WHEN LEFT(Input, 1) = "." THEN IsolatedClass = SUBSTR(Input, 2,
(LENGTH(Input) - 1))
OTHERWISE DO
PARSE VAR Input First Second
Second = STRIP(Second, "B")
PARSE VAR Second IsolatedClass Remainder
END /*Ends "OTHERWISE DO" Section*/
END /*Ends "SELECT" Section*/
RETURN IsolatedClass
::METHOD CORRECT_CLASS_ID CLASS /*Workaround for
XWorkPlace problem (for some reason an "WP...," classes become "X...,", after using
the "dot" class code instruction??*/
USE ARG Class, StartingClass, Stop
IF TRANSLATE(Class) = "WPDESKTOP" THEN DO
SStartingClass = TRANSLATE(StartingClass, Copies('20'x, 256),
XRANGE('7F'x, '1F'x))
IF TRANSLATE(SStartingClass) = "THE WORKPLACE DESKTOP"
THEN DO
SIGNAL ON NOMETHOD NAME WPDESKTOP_ERROR
SIGNAL ON ANY NAME WPDESKTOP_ERROR
TestClass = .XFldDesktop
TestStartingClass = .DTTOOLS~ISOLATE_CLASS(TestClass)
END /*End "IF TRANSLATE(SStartingClass) = "THE WORKPLACE
DESKTOP" THEN DO" Section*/
ELSE DO
TestStartingClass =
.DTTOOLS~ISOLATE_CLASS(StartingClass)
TestClass = StartingClass
END /*Ends "ELSE DO" Section*/
END /*Ends "IF TRANSLATE(Class) = "WPDESKTOP" THEN DO"
Section*/
ELSE DO
TestStartingClass = .DTTOOLS~ISOLATE_CLASS(StartingClass)
TestClass = StartingClass
END /*Ends "ELSE DO" Section*/
IF TRANSLATE(TestStartingClass) \= TRANSLATE(Class) THEN DO
SELECT
WHEN TRANSLATE(LEFT(TestStartingClass, 1)) = "X" &
TRANSLATE(LEFT(Class, 1)) = "W" | Class = "WPLaunchPad" | Class = "WPPrinter" |
Class = "WPSystem" THEN DO
DO UNTIL TRANSLATE(TestStartingClass) =
TRANSLATE(Class) | TestStartingClass = Stop
GetSuperClasses =
TestClass~SUPERCLASSES
Index = GetSuperClasses~FIRST
TestClass = GetSuperClasses[Index]
TestStartingClass =
.DTTOOLS~ISOLATE_CLASS(TestClass)
END /*Ends "DO UNTIL
TRANSLATE(TestStartingClass) = TRANSLATE(Class) | TestStartingClass = Stop"
Section*/
END /*Ends "WHEN
TRANSLATE(LEFT(TestStartingClass, 1)) = "X" & TRANSLATE(LEFT(Class, 1)) = "W"
| Class = "WPLaunchPad" | Class = "WPPrinter" | Class = "WPSystem" THEN DO"
Section*/
WHEN TRANSLATE(LEFT(TestStartingClass, 1)) = "W" &
TRANSLATE(LEFT(Class, 1)) = "X" THEN DO
DO UNTIL TRANSLATE(TestStartingClass) =
TRANSLATE(Class) | TestStartingClass = Ancestor | Index = .NIL
Ancestor =
.DTTOOLS~ISOLATE_CLASS(TestClass)
GetSubClasses = TestClass~SUBCLASSES
Index = GetSubClasses~FIRST
IF Index \= .NIL THEN DO
TestClass = GetSubClasses[Index]
TestStartingClass =
.DTTOOLS~ISOLATE_CLASS(TestClass)
END /*Ends "IF Index \= .NIL THEN DO"
Section*/
ELSE TestClass = StartingClass
END /*Ends "DO UNTIL
TRANSLATE(TestStartingClass) = TRANSLATE(Class) | TestStartingClass = Ancestor
| Index = .NIL" Section*/
END /*Ends "WHEN
TRANSLATE(LEFT(TestStartingClass, 1)) = "W" & TRANSLATE(LEFT(Class, 1)) = "X"
THEN DO" Section*/
OTHERWISE NOP
END /*Ends "SELECT" Section*/
END /*Ends "IF TRANSLATE(TestStartingClass) \= TRANSLATE(Class)
THEN DO" Section*/
RETURN TestClass
WPDESKTOP_ERROR:
SIGNAL OFF NOMETHOD
SIGNAL OFF ANY
INTERPRET "TestClass = ."Class
RETURN TestClass
::METHOD GETFOLDEROBJECTS CLASS
EXPOSE wpconst
USE ARG Folder
FolderArray = .ARRAY~NEW
Index = 0
TRACE ?R
NOP
Folder~wpPopulate(0, Folder~wpQueryTitle, .FALSE)
FirstOne = Folder~wpQueryContent(Folder,.wpconst[QC_FIRST])
LastOne = Folder~wpQueryContent(Folder,.wpconst[QC_LAST])
ThisOne = FirstOne /* Start with the first object*/
DO WHILE ThisOne \= .NIL
Index = Index + 1
FolderArray[Index] = ThisOne /* Save object pointer in array*/
SAY "TITLE: "ThisOne~wpQueryTitle
IF ThisOne = LastOne then ThisOne = .NIL /* At end of list? If so,
indicate at end*/
ELSE DO
ThisOne =
Folder~wpQueryContent(ThisOne,.wpconst[QC_NEXT]) /* Otherwise, get the next
folder item */
NOP
END
END
RETURN FolderArray
==================BEGIN FORWARDED MESSAGE==================
>X-Apparently-To: hmotin@sbcglobal.net via 206.190.37.122; Sun, 09 Oct 2005 07:09:31
-0700
>X-Originating-IP: [63.200.17.147]
>Return-Path:
>Authentication-Results: mta136.sbc.mail.mud.yahoo.com
> from=sbcglobal.net; domainkeys=neutral (no sig)
>Received: from 207.115.57.54 (EHLO ylpvm23.prodigy.net) (207.115.57.54)
> by mta136.sbc.mail.mud.yahoo.com with SMTP; Sun, 09 Oct 2005 07:09:31 -0700
>X-Originating-IP: [63.200.17.147]
>Received: from scoug.com (adsl-63-200-17-147.dsl.lsan03.pacbell.net [63.200.17.147])
> by ylpvm23.prodigy.net (8.12.10 083104/8.12.10) with SMTP id
j99E8DBK009124;
> Sun, 9 Oct 2005 10:08:13 -0400
>Received: from www (adsl-63-200-17-147.dsl.lsan03.pacbell.net [63.200.17.147]) by
scoug.com
> (Hethmon Brothers Smtpd) id 20051009070854-17411-9 ; Sun, 09 Oct 2005 07:08:54
-0700
>Received: from smtp102.sbc.mail.mud.yahoo.com (smtp102.sbc.mail.mud.yahoo.com
[68.142.198.201]) by scoug.com
> (Hethmon Brothers Smtpd) id 20051009070851-53777-9 ; Sun, 09 Oct 2005 07:08:51
-0700
>Message-Id: <20051009070851-53777-9@scoug.com>
>Received: (qmail 43364 invoked from network); 9 Oct 2005 14:08:49 -0000
>Received: from unknown (HELO HCM) (hmotin@sbcglobal.net@69.231.34.90 with
login)
> by smtp102.sbc.mail.mud.yahoo.com with SMTP; 9 Oct 2005 14:08:49 -0000
>X-Mailer: PMMail 2.20.2382 for OS/2 Warp 4.5
>MIME-Version: 1.0
>Content-Type: text/plain; charset="iso-8859-1"
>Content-Transfer-Encoding: 7bit
>Date: Sun, 9 Oct 2005 07:08:52 PDT7
>X-OldDate: Sun, 09 Oct 2005 07:09:12 -0700 (PDT)
>Sender: scoug-programming-owner
>X-Listname: scoug-programming@scoug.com
>Reply-To: scoug-programming@scoug.com
>From: "Harry Motin"
>To: "scoug-programming@scoug.com"
>Subject: SCOUG-Programming: REXX and WPS programming
>
On Tue, 4 Oct 2005 21:21:13 PDT7, Steven Levine wrote:
>If you want to post your code, I'll take a look at it.
Thank you, Steven.
I'm thinking that my use of XWorkplace has something to do with this (interfering with the
OREXX-to-WPS class interface). For example, when I use the following code:
TestClass = .WPDesktop
The response that comes back for TestClass is "The XFldDesktop Class". I can then
use the "SUPERCLASS" method on that object, TestClass, to move one class upward
and get back to the WPDesktop class. That is:
Ancestor = SUPERCLASS~TestClass
produces the response "The WPDesktop Class". I have similar problems with other
WPS classes. For example, the code
TestClass = .WPFolder
produces the response "The XFolder Class". Again, I have to use the SUPERCLASS
method to go up three levels to get back to "The WPFolder Class".
Anyway, the code that I'm using, the one that causing my REXX code to stop is as
follows (If you have a chance, please try it out on your system, thanks):
CALL WPCONST.CMD /*Call the WPCONST.CMD REXX script */
SubClass = .WPDesktop
SubClass = .DTTOOLS~CORRECT_CLASS_ID(SSubClass, SubClass, "WPObject")
SAY SubClass
DeskTopArray = .DTTOOLS~GETFOLDEROBJECTS(SubClass)
::CLASS DESKTOP
::CLASS DTTOOLS SUBCLASS DESKTOP
::METHOD CORRECT_CLASS_ID CLASS /*Workaround for
XWorkPlace problem (for some reason an "WP...," classes become "X...,", after using
the "dot" class code instruction??*/
USE ARG Class, StartingClass, Stop
IF TRANSLATE(Class) = "WPDESKTOP" THEN DO
SStartingClass = TRANSLATE(StartingClass, Copies('20'x, 256),
XRANGE('7F'x, '1F'x))
IF TRANSLATE(SStartingClass) = "THE WORKPLACE DESKTOP"
THEN DO
SIGNAL ON NOMETHOD NAME WPDESKTOP_ERROR
SIGNAL ON ANY NAME WPDESKTOP_ERROR
TestClass = .XFldDesktop
TestStartingClass =
.WPSCLASSES~ISOLATE_CLASS(TestClass)
END /*End "IF TRANSLATE(SStartingClass) = "THE WORKPLACE
DESKTOP" THEN DO" Section*/
ELSE DO
TestStartingClass =
.WPSCLASSES~ISOLATE_CLASS(StartingClass)
TestClass = StartingClass
END /*Ends "ELSE DO" Section*/
END /*Ends "IF TRANSLATE(Class) = "WPDESKTOP" THEN DO"
Section*/
ELSE DO
TestStartingClass = .WPSCLASSES~ISOLATE_CLASS(StartingClass)
TestClass = StartingClass
END /*Ends "ELSE DO" Section*/
IF TRANSLATE(TestStartingClass) \= TRANSLATE(Class) THEN DO
SELECT
WHEN TRANSLATE(LEFT(TestStartingClass, 1)) = "X" &
TRANSLATE(LEFT(Class, 1)) = "W" | Class = "WPLaunchPad" | Class = "WPPrinter" |
Class = "WPSystem" THEN DO
DO UNTIL TRANSLATE(TestStartingClass) =
TRANSLATE(Class) | TestStartingClass = Stop
GetSuperClasses =
TestClass~SUPERCLASSES
Index = GetSuperClasses~FIRST
TestClass = GetSuperClasses[Index]
TestStartingClass =
.WPSCLASSES~ISOLATE_CLASS(TestClass)
END /*Ends "DO UNTIL
TRANSLATE(TestStartingClass) = TRANSLATE(Class) | TestStartingClass = Stop"
Section*/
END /*Ends "WHEN
TRANSLATE(LEFT(TestStartingClass, 1)) = "X" & TRANSLATE(LEFT(Class, 1)) = "W"
| Class = "WPLaunchPad" | Class = "WPPrinter" | Class = "WPSystem" THEN DO"
Section*/
WHEN TRANSLATE(LEFT(TestStartingClass, 1)) = "W" &
TRANSLATE(LEFT(Class, 1)) = "X" THEN DO
DO UNTIL TRANSLATE(TestStartingClass) =
TRANSLATE(Class) | TestStartingClass = Ancestor | Index = .NIL
Ancestor =
.WPSCLASSES~ISOLATE_CLASS(TestClass)
GetSubClasses = TestClass~SUBCLASSES
Index = GetSubClasses~FIRST
IF Index \= .NIL THEN DO
TestClass = GetSubClasses[Index]
TestStartingClass =
.WPSCLASSES~ISOLATE_CLASS(TestClass)
END /*Ends "IF Index \= .NIL THEN DO"
Section*/
ELSE TestClass = StartingClass
END /*Ends "DO UNTIL
TRANSLATE(TestStartingClass) = TRANSLATE(Class) | TestStartingClass = Ancestor
| Index = .NIL" Section*/
END /*Ends "WHEN
TRANSLATE(LEFT(TestStartingClass, 1)) = "W" & TRANSLATE(LEFT(Class, 1)) = "X"
THEN DO" Section*/
OTHERWISE NOP
END /*Ends "SELECT" Section*/
END /*Ends "IF TRANSLATE(TestStartingClass) \= TRANSLATE(Class)
THEN DO" Section*/
RETURN TestClass
WPDESKTOP_ERROR:
SIGNAL OFF NOMETHOD
SIGNAL OFF ANY
INTERPRET "TestClass = ."Class
RETURN TestClass
::METHOD GETFOLDEROBJECTS CLASS
EXPOSE wpconst
USE ARG Folder
FolderArray = .ARRAY~NEW
Index = 0
Folder~wpPopulate(0, Folder~wpQueryTitle, .FALSE)
FirstOne = Folder~wpQueryContent(Folder,.wpconst[QC_FIRST])
LastOne = Folder~wpQueryContent(Folder,.wpconst[QC_LAST])
ThisOne = FirstOne /* Start with the first object*/
DO WHILE ThisOne \= .NIL
Index = Index + 1
FolderArray[Index] = ThisOne /* Save object pointer in array*/
SAY "TITLE: "ThisOne~wpQueryTitle
IF ThisOne = LastOne then ThisOne = .NIL /* At end of list? If so,
indicate at end*/
ELSE DO
ThisOne =
Folder~wpQueryContent(ThisOne,.wpconst[QC_NEXT]) /* Otherwise, get the next
folder item */
NOP
END
END
RETURN FolderArray
******************************************************************************************************
Let me interpret the above for you:
1. The "GETFOLDEROBJECTS" method is almost a direct copy of the
code found in the OREXX online reference, REXX.INF ("A Workplace Shell Example:
Displaying Titles). You can also find it on the Internet in "A Simple Object REXX Class
Hierarchy"
2. The above REXX code stops on the line,
SAY "TITLE: "ThisOne~wpQueryTitle
in the "GETFOLDEROBJECTS" method. As I stated before, it just
stops, no error message, nothing.
3. The "CORRECT_CLASS_ID CLASS" method is from me. It corrects the
fault on my system, where I call for a particular WPS class and I get a XWorkplace
class instead (I explained that above).
Thanks for any help or insight on this. I would be interested to know if you experience
any of the above problems
HCM
=====================================================
To unsubscribe from this list, send an email message
to "steward@scoug.com". In the body of the message,
put the command "unsubscribe scoug-programming".
For problems, contact the list owner at
"postmaster@scoug.com".
=====================================================
===================END FORWARDED MESSAGE===================
=====================================================
To unsubscribe from this list, send an email message
to "steward@scoug.com". In the body of the message,
put the command "unsubscribe scoug-help".
For problems, contact the list owner at
"postmaster@scoug.com".
=====================================================
<< Previous Message <<
>> Next Message >>
Return to [ 09 |
October |
2005 ]
The Southern California OS/2 User Group
P.O. Box 26904
Santa Ana, CA 92799-6904, USA
Copyright 2001 the Southern California OS/2 User Group. ALL RIGHTS
RESERVED.
SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group.
OS/2, Workplace Shell, and IBM are registered trademarks of International
Business Machines Corporation.
All other trademarks remain the property of their respective owners.
|