cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Open from PDMLink

byork
17-Peridot

Open from PDMLink

Okay I am having a little issue with a small script I am trying to create.

Here it is in a nutshell.  I need to flatten the current document, send it to a service and then open the original file again.  The first two are no problem. I am having a heck of a time opening the original book back up from PDMLink.

Here is my code thus far:

package processInteract

function createInteract(){

    local res1;

    local doc;

    local newname;

    local doc1

    doc = current_doc();

    doc1 = doc_name(current_doc());

    res1 = response("Have you saved? Running this command you will loose any non-saved changes!", "&Yes", "&No", "&Cancel");

    if(res1 == "1" ){

        doc_flatten;

        newname = "c:\\temp\\" . time();

        #message_box(newname,0x20);

        save_as $newname;

        file_close(win,0x0001);

        arg1 = newname. ".xml"

        system('java -cp \\lynms313q\codebase\InteractiveManualCreator.jar;\\lynms313q\codebase\wvs.jar;\\lynms313q\codebase com.toro.plm.pdmlink.arbortextadapter.ArbortextAdapter ' .arg1)

        view(doc1);

    }

}

function view(pdmFileName){

local wcPrefix = "x-wc://file=";

local pdmLogicalId = wcPrefix . pdmFileName;

response(pdmLogicalId);

document = doc_open(pdmLogicalId);

curr_win = current_window();

doc_show(document, curr_win);

}

This is an alternate way that I was trying as well.  It will open the object below the parent object....

package processInteract

function createInteract(){

    local res1;

    local doc;

    local newname;

    local doc1

    doc = current_doc();

    doc1 = doc_name(current_doc());

    local dobj = doc_first_dobj(current_doc());

    dobj_close(dobj);

    response("Logical Id = " . dobj_get_attr(dobj, "IO_ATTR_LOGICAL_ID"));

    response("Dynamic Dcoument Name = " . dobj_get_attr(dobj, "WC_NAME_ATTR"));

    res1 = response("Have you saved? Running this command you will loose any non-saved changes!", "&Yes", "&No", "&Cancel");

    if(res1 == "1" ){

        doc_flatten;

        newname = "c:\\temp\\" . time();

        #message_box(newname,0x20);

        save_as $newname;

        file_close(win,0x0001);

        arg1 = newname. ".xml"

        system('java -cp \\lynms313q\codebase\InteractiveManualCreator.jar;\\lynms313q\codebase\wvs.jar;\\lynms313q\codebase com.toro.plm.pdmlink.arbortextadapter.ArbortextAdapter ' .arg1)

    document = doc_open(dobj_get_attr(dobj, "IO_ATTR_LOGICAL_ID"));

    curr_win = current_window();

    doc_show(document, curr_win);

 

    }

}

As always any help would be greatly appreciated...

Brian

1 ACCEPTED SOLUTION

Accepted Solutions
byork
17-Peridot
(To:byork)

Just in case anyone wants this but here is the working code

function createInteract(){

    local res1;

    local doc;

    local newname;

    local doc1

    doc = current_doc();

    doc1 = doc_name(current_doc());

    local logid = doc_path(current_doc());

   

    res1 = response("Have you saved? Running this command you will loose any non-saved changes!", "&Yes", "&No", "&Cancel");

   

    if(res1 == "1" ){

        doc_flatten;

        newname = "c:\\temp\\" . time();

        #message_box(newname,0x20);

        save_as $newname;

        file_close(win,0x0001);

        arg1 = newname. ".xml"

        edit "$logid"

    }

}

View solution in original post

1 REPLY 1
byork
17-Peridot
(To:byork)

Just in case anyone wants this but here is the working code

function createInteract(){

    local res1;

    local doc;

    local newname;

    local doc1

    doc = current_doc();

    doc1 = doc_name(current_doc());

    local logid = doc_path(current_doc());

   

    res1 = response("Have you saved? Running this command you will loose any non-saved changes!", "&Yes", "&No", "&Cancel");

   

    if(res1 == "1" ){

        doc_flatten;

        newname = "c:\\temp\\" . time();

        #message_box(newname,0x20);

        save_as $newname;

        file_close(win,0x0001);

        arg1 = newname. ".xml"

        edit "$logid"

    }

}

Top Tags