OfficeCommunity.com
The official WordPerfect Office Community.

Going from WP6 to X4 - Macro issues

rated by 0 users
This post has 8 Replies | 2 Followers

Top 100 Contributor
Posts 5
saugustus Posted: Fri, Feb 12 2010 11:11 AM

Hi Folks,

I am writing on behalf of a client, so if I am missing any pertinent information, let me know and I can try to get it.


Basically, client had WP6 working well for ages, we formatted their PC's and could not find any WP6 installation disks, so we installed what we believed to be the next best, WP7.  WP7 would not allow a certain macro to complete, involving moving pictures into a file.  Since you can't get support for either of these products, we went ahead and upgraded to X4 Standard. 

Tools - Play - Macro

 

"The macro is being canceled because of an our of range token

Completion code error condition processing product command 'WordPerfect.BoxImageRetrieve"."

I found some information that related to WP7 and it had to do with picture sizing.  I had the understanding that X4 would bypass this issue and work.  Not so.  Let me know if anyone has any suggestions, or if you need more information from me.

 

Scott

 

Top 10 Contributor
Posts 206

Without seeing the macro code, there is no way to troubleshoot.

Top 100 Contributor
Posts 5
saugustus replied on Fri, Feb 12 2010 12:35 PM

Application (WordPerfect; "WordPerfect"; Default; "US")
ViewDraft ()
FileOpen (Filename: "L:\database\Merge\landmerge.dat")
PosLineDown ()
PosLineDown ()
PosLineDown ()
PosLineDown ()
PosLineDown ()
PosLineDown ()
PosLineDown ()
ImportSetFileName (Filename: "L:\database\Merge\landdatamerge.txt")
ImportSetSource (SourceType: ASCII!)
ImportSetDestination (DestinationType: MergeData!)
ImportSetAsciiFieldDelimiter (FieldDelimiter: ",")
ImportSetAsciiRecordDelimiter (RecordDelimiter: "")
ImportSetAsciiStrip (StripChars: "")
ImportSetAsciiEncap (EncapsulationChar: """")
ViewDraft ()
ImportDoImport ()
FileSave (Filename: "L:\database\Merge\landmergeddata1.dat"; ExportType: WordPerfect_60!)
Close ()
FileOpen (Filename: "L:\database\Merge\landmergefrm.frm")
MergeDataFile (DataFile: "L:\database\Merge\landmergeddata1.dat")
MergeSelect (SelectType: All!)
MergeRun (FormFileType: Current!; DataFileType: DataFile!; DataFile: "L:\database\Merge\landmergeddata1.dat"; OutputFileType:
ToNewDoc!)
//
//
RUN("L:\database\Merge\photo.wcm")

 

 

 

This is the photo.wcm

 

Application (WordPerfect; "WordPerfect"; Default; "US")

PosDocTop()

OnNotFound(lquit)
SearchString (StrgToLookFor: "##FN##")
while (1 = 1)     SearchNext (SearchMode: Extended!)
    DeleteCharNext ()
    SelectLineEnd ()
    vtest := ?SelectedText()

    PosSelectTop()
    SelectDelete()

    BoxCreate (BoxType: UserBox!)
    BoxWidth (Width: 5.5")
    BoxHeight (Height: 4.0")
    // boxwidth(autowidth!)  // boxheight(autoheight!)
    BoxAttachTo (Anchor: Paragraph!)  BoxVerticalAlignment (Alignment: Center!)  BoxHorizontalAlignment (Alignment: AlignMargins!; Position: Center!; Offset: 0.0")
    BoxTextFlow (Wrap: NeitherSide!)
    BoxOverlap (State: Yes!)
    BoxContentType (Content: Image!)
    if (vtest <> "")
            BoxImageRetrieve (Action: MakeInternal!; Filename: vtest)
    endif     //BorderLeftLine (Style: ThickLine!)
    //BorderRightLine (Style: ThickLine!)
    //BorderTopLine (Style: ThickLine!)
    //BorderBottomLine (Style: ThickLine!)
    BoxUpdateDisplay ()
    BoxEnd (State: Save!)
endwhile
label(lquit)

PosDocTop()

OnNotFound(l2quit) SearchString (StrgToLookFor: "##FP##")
while (1 = 1)     SearchNext (SearchMode: Extended!)
    DeleteCharNext ()
    SelectLineEnd ()
    vtest := ?SelectedText()

    PosSelectTop()
    SelectDelete()

    if (vtest <> "")
        BoxCreate (BoxType: UserBox!)
        BoxWidth (Width: 6.5")
        BoxHeight (Height: 8")
        // boxwidth(autowidth!)  // boxheight(autoheight!)
        BoxAttachTo (Anchor: Paragraph!)  BoxVerticalAlignment (Alignment: Center!)  BoxHorizontalAlignment (Alignment: AlignMargins!; Position: Center!; Offset: 0.0")
        BoxTextFlow (Wrap: NeitherSide!)
        BoxOverlap (State: Yes!)
        BoxContentType (Content: Image!)
        BoxImageRetrieve (Action: MakeInternal!; Filename: vtest)
        BorderLeftLine (Style: ThickLine!)
        BorderRightLine (Style: ThickLine!)
        BorderTopLine (Style: ThickLine!)
        BorderBottomLine (Style: ThickLine!)
        BoxUpdateDisplay ()
        BoxEnd (State: Save!)
    endif endwhile
label(l2quit)

Top 10 Contributor
Posts 206

Without the sample data, it is hard to test.  However, I can see a scenario where you would get that error.  What if vTest does not exist?  Yep, you get the error.  So, replace this,

if (vtest <> "")
            BoxImageRetrieve (Action: MakeInternal!; Filename: vtest)
 endif     //BorderLeftLine (Style: ThickLine!)

with

if (vtest <> "" and DoesFileExist(vtest))
            BoxImageRetrieve (Action: MakeInternal!; Filename: vtest)
endif     //BorderLeftLine (Style: ThickLine!)

You might also need to delete the selected text so that the loop will not repeat there.  You will need something similar for the 2nd search part.

Once the problems are solved, you might think about adding some features to make the DAT file creation faster.  I posted methods in the Code Snippet forum at wpuniverse.com.

Top 100 Contributor
Posts 5
saugustus replied on Fri, Feb 12 2010 4:00 PM

Hi Kenneth,


You have been very helpful and so I appreciate your time.  But, I made the change to the code as you mentioned, and we actually got some progress.  The error messages no longer occur, but the picture also doesn't roll in.  When you right click the picture box, edit, and check the path, it shows no path.  Prior, when the error messages occured, there wasno picture visible, but the path was present. 

 

 

 

Top 10 Contributor
Posts 206

I am not sure how a picture could be inserted if it does not exist.  If you break the code out to a simple macro with one graphic, it makes testing easier.   If it works when it exits and then doesn't do all that you want when it doesn't, manually fix it and post as an attachment.  I can then see what you want.  Maybe the filename that does not exist as a caption for the box?  You can zip and attach 2 or 3 files as needed.

Not Ranked
Posts 1

This is the first time when I joined the discussion here.Well I have found good stuff here.

Colon Cleanse

How to get pregnant

Top 100 Contributor
Posts 5
saugustus replied on Fri, Feb 19 2010 1:59 PM

Hi Kenneth,

I apologize, but I really am less than novice when it comes to programming or writing code for macros.  I don't know what I am able to cut out in order to "simplify" the macro.  Let me see about zipping up some of this data and attaching it.

Top 100 Contributor
Posts 5
saugustus replied on Mon, Feb 22 2010 12:58 PM

Bounce

Can anyone view the code above or tell me what else you might need from me to troubleshoot?

Page 1 of 1 (9 items) | RSS
© Corel Corporation. The content herein is in the form of a personal web log ("Blog") or forum posting. As such, the views expressed in this site are the views of the participants and do not necessarily reflect the views of Corel Corporation, or its affiliates and their respective officers, directors, employees and agents. Terms of use.