Topic
  • 17 replies
  • Latest Post - ‏2013-04-15T21:48:24Z by GregM_dxler
SystemAdmin
SystemAdmin
3180 Posts

Pinned topic oleActivate for attributes not working

‏2013-02-06T14:55:39Z |
Greetings,
First time posting here, although I have been reading this forum for quite some time and have learned a lot. Thank you so much for having the forum and providing your knowledge and help. I'm working on developing a dxl script to search in both text and OLEs. Much of it has come from bits and pieces gathered from this forum. However, I have come to a stumbling block that I haven't been able to resolved in regards to activating an OLE that is not in the object text.

When I use the command oleActivate(o, column 3, 0) to activate the first (and only) OLE in column 3 of the object, it doesn't work and I get a returned string "OLE index specified is invalid". However, if I use the command oleCut(o, column 3, 0) this works perfectly to cut the OLE in the column 3. I can even then paste it using the olePasteSpecial(o."Comments", false), into the Comments attribute.

Does anyone know why the oleActivate command doesn't work? I have also tried adding in #include <utils/ole.inc>, but this doesn't help.

Thank you in advance for your time.
Greg
Updated on 2013-02-28T00:57:56Z at 2013-02-28T00:57:56Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: oleActivate for attributes not working

    ‏2013-02-13T17:42:41Z  
    Hello,
    It's been a week on this post now without a reply. Hummm, hopefully it is not because I have offended anyone. The DOORS version I am using is 9.3.0.5.
    Do you think I should submit a bug report?

    Thank you,
    Greg
  • llandale
    llandale
    2986 Posts

    Re: oleActivate for attributes not working

    ‏2013-02-13T18:28:10Z  

    My first time in this OLE stuff. This seems to work:

    int iCol = 2
    int iOle = 0
    Column col2 = column(iCol)
    Object oCurr = current
    string ErrMess
     
    ErrMess = oleActivate(oCurr,col2,iOle)
    print ErrMess
    


    When the column has 1 or 2 OLEs in it. Changing "iOle = 1" however doesn't work. oleCut indeed does seem to work. Be sure it is really an "OLE"; pasted into an embedded Word Object, then pasted into DOORS.

    However, it seems to me that this failed at first, until I successfully activated an OLE in Object Text (col 1), then went back to column 2. Not sure what to think about that.

    This column based OLE is hopeless. Surely it should be obj.attr based.

    -Louie

    Updated on 2014-01-06T13:53:00Z at 2014-01-06T13:53:00Z by iron-man
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: oleActivate for attributes not working

    ‏2013-02-13T20:01:10Z  
    Greg;

    It seems the DXL manual kept using 'object current' where you have just 'o'...maybe it is worth a quick test to put that in your code...
  • llandale
    llandale
    2986 Posts

    Re: oleActivate for attributes not working

    ‏2013-02-13T20:50:57Z  
    Greg;

    It seems the DXL manual kept using 'object current' where you have just 'o'...maybe it is worth a quick test to put that in your code...
    Ha! Perhaps the function works only when the Object input parameter is also the current one? If so:
    • current = o
    before the call.
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: oleActivate for attributes not working

    ‏2013-02-14T23:26:18Z  
    Greetings Louie and Bill and thanks for the responses.

    I agree with Louie's initial comment of the oleActivate should be attribute based and not column based. I've already had to do a workaround where, when I am searching in another attribute than the object text attribute, I have to see if it is in a column and if not, add the column first. Would have been much simplier to just look in the attribute I am interested in. Oh well, I did see where someone else did mention that dxl usually also means workarounds.

    According to the manual, there are two oleActivate commands, the oleActivate(o) which will activate the ole in the object text attribute. The oleActivate (o, column c, index) is the one that is to be used to activate the ole in a different attribute and this is the one I am having trouble with. In my scenerio, I have a _Proposed change attribute that I want to be able to search for a string in both the text and the OLE if it is there. The OLEs we use are mainly excel and visio with some word documents. I haven't cracked how to do a find in visio yet, so I am concentrating on the excel first.

    I used Louie's snippet to match what he did and it still gave me the same error message "OLE index specified is invalid". But the comment he made about doing it in column 1 first gave me an idea. In the object I was trying, there is only an OLE in the _Proposed change column (column 3) and not in the main column (column 2). So I made another object where I had an OLE in both the main column and the _Proposed change column. The snippet worked perfectly for either column, no matter which one I did first.

    So, it appears that the problem is the oleActivate(Object o, Column c, integer index) command doesn't work for any other column unless the object text also has an OLE!

    Adding the current = o or current = oCurr before the oleActivate doesn't fix anything. Louie's snippet already has the Object oCurr = current at the declaration, and even adding it, didn't change anything (nice thought though).

    So, I'm still back to not knowing how I can activate an OLE in a different column when the object text doesn't have an OLE. Main reason to activate it, is because it could be one of three different kinds and it needs to be activated to look at it and find out what application to use. Is there another way? Maybe brute force of trying each application to see which works?

    Again, thanks for the replies and the help. I do appreciate it!
  • Mathias Mamsch
    Mathias Mamsch
    1984 Posts

    Re: oleActivate for attributes not working

    ‏2013-02-15T15:21:14Z  
    Greetings Louie and Bill and thanks for the responses.

    I agree with Louie's initial comment of the oleActivate should be attribute based and not column based. I've already had to do a workaround where, when I am searching in another attribute than the object text attribute, I have to see if it is in a column and if not, add the column first. Would have been much simplier to just look in the attribute I am interested in. Oh well, I did see where someone else did mention that dxl usually also means workarounds.

    According to the manual, there are two oleActivate commands, the oleActivate(o) which will activate the ole in the object text attribute. The oleActivate (o, column c, index) is the one that is to be used to activate the ole in a different attribute and this is the one I am having trouble with. In my scenerio, I have a _Proposed change attribute that I want to be able to search for a string in both the text and the OLE if it is there. The OLEs we use are mainly excel and visio with some word documents. I haven't cracked how to do a find in visio yet, so I am concentrating on the excel first.

    I used Louie's snippet to match what he did and it still gave me the same error message "OLE index specified is invalid". But the comment he made about doing it in column 1 first gave me an idea. In the object I was trying, there is only an OLE in the _Proposed change column (column 3) and not in the main column (column 2). So I made another object where I had an OLE in both the main column and the _Proposed change column. The snippet worked perfectly for either column, no matter which one I did first.

    So, it appears that the problem is the oleActivate(Object o, Column c, integer index) command doesn't work for any other column unless the object text also has an OLE!

    Adding the current = o or current = oCurr before the oleActivate doesn't fix anything. Louie's snippet already has the Object oCurr = current at the declaration, and even adding it, didn't change anything (nice thought though).

    So, I'm still back to not knowing how I can activate an OLE in a different column when the object text doesn't have an OLE. Main reason to activate it, is because it could be one of three different kinds and it needs to be activated to look at it and find out what application to use. Is there another way? Maybe brute force of trying each application to see which works?

    Again, thanks for the replies and the help. I do appreciate it!
    The oleActivate function works for me as expected. See the attached example

    (Sometimes I hate the forum software. It told me the example file contains a virus, it just contains some OLE example)

    Regards, Mathias


    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
  • llandale
    llandale
    2986 Posts

    Re: oleActivate for attributes not working

    ‏2013-02-15T19:18:58Z  
    Greetings Louie and Bill and thanks for the responses.

    I agree with Louie's initial comment of the oleActivate should be attribute based and not column based. I've already had to do a workaround where, when I am searching in another attribute than the object text attribute, I have to see if it is in a column and if not, add the column first. Would have been much simplier to just look in the attribute I am interested in. Oh well, I did see where someone else did mention that dxl usually also means workarounds.

    According to the manual, there are two oleActivate commands, the oleActivate(o) which will activate the ole in the object text attribute. The oleActivate (o, column c, index) is the one that is to be used to activate the ole in a different attribute and this is the one I am having trouble with. In my scenerio, I have a _Proposed change attribute that I want to be able to search for a string in both the text and the OLE if it is there. The OLEs we use are mainly excel and visio with some word documents. I haven't cracked how to do a find in visio yet, so I am concentrating on the excel first.

    I used Louie's snippet to match what he did and it still gave me the same error message "OLE index specified is invalid". But the comment he made about doing it in column 1 first gave me an idea. In the object I was trying, there is only an OLE in the _Proposed change column (column 3) and not in the main column (column 2). So I made another object where I had an OLE in both the main column and the _Proposed change column. The snippet worked perfectly for either column, no matter which one I did first.

    So, it appears that the problem is the oleActivate(Object o, Column c, integer index) command doesn't work for any other column unless the object text also has an OLE!

    Adding the current = o or current = oCurr before the oleActivate doesn't fix anything. Louie's snippet already has the Object oCurr = current at the declaration, and even adding it, didn't change anything (nice thought though).

    So, I'm still back to not knowing how I can activate an OLE in a different column when the object text doesn't have an OLE. Main reason to activate it, is because it could be one of three different kinds and it needs to be activated to look at it and find out what application to use. Is there another way? Maybe brute force of trying each application to see which works?

    Again, thanks for the replies and the help. I do appreciate it!
    I'm not saying I'm sure I was right, but I suggested that you needed to SEARCH for it in the main column; not just there being one there. And I noticed that once I closed and re-opened the module, the call worked without the main search. So, if I really cared, I'd do some testing to find out if perhaps you only need to search the main column once per DOORS instance. It is remotely possible that search sets some top-context variable needed by non-main searches.

    -Louie

    But I don't care. lol
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: oleActivate for attributes not working

    ‏2013-02-16T17:59:58Z  
    This is really stumping me. Mathias example also works for me, but I don't understand why his works and mine doesn't. I tried to just do what Mathias does, and insert a new column of the attribute then activate the OLE and it doesn't work.

    Thanks for the reply Louie, but I'm not sure what you mean by searching the main column for an ole first. I've tried to check if the object text attribute has an ole and this doesn't work. I ran my dxl script first on an object that had ole's in both the main text and the _Proposed change attribute (works) and then tried it with just an ole in the _Proposed change and I get the same results, no activation.

    Wondered if it had something to do with which column DOORS thinks is the 'current' one, based on Mathias's example of making a new column, but can't find any dxl command to set a column to current and generating a new column, a-la Mathias, didn't work.

    I'll attach my little example program. Can anyone figure out why it doesn't work? Or better yet, how I can get it to work?

    Thanks a lot for all your help and support.

    Greg
  • llandale
    llandale
    2986 Posts

    Re: oleActivate for attributes not working

    ‏2013-02-16T21:47:17Z  
    The oleActivate function works for me as expected. See the attached example

    (Sometimes I hate the forum software. It told me the example file contains a virus, it just contains some OLE example)

    Regards, Mathias


    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
    Runnning v9306

    Mathias code does not activate although it keeps creating objects with the OLE at the bottom of the module. I notice though that the Main column is left In-Place-Edting (the cursor) Object Text.

    After running Mathias' code leaving the module open and the last object selected, the following does NOT work
    • oleActivate (current Object, column 0, 0)

    -Louie
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: oleActivate for attributes not working

    ‏2013-02-21T17:56:16Z  
    Thanks Louie - More clues!
    Mathias program works for me, run it all day long and it keeps making a new object and activating the paint application. However, I did notice that the new objects were all considered headings and not text. So, to make another experiment, I added the line o."Object Text" = "Make it a text object" to Mathias's code just before inserting the ole into o."Blah". Once I did this, the activate command stopped working. So it seems that the command only listens to object headings and not object text. To verify this, I changed my line to o."Object Heading" = "Make it a heading object". This now again activates the paint application.

    Finally, I wondered how that worked with my previous clue of activating when there is an ole in the main column. So I again changed the line to o."Object Text" = richText bufOle and ran it again. This also runs and activates the application.

    So, it appears like the oleActivate(o, column 0, 0) only works if the object is a heading, or the object has another ole in the object text attribute.

    I truly think this is a dxl bug now. However, since I am way less experienced than many of the people in this forum, I would like to get concurrence. Any help in how to work around this would also be greatly appreciated.

    As always, your help is greatly appreciated!!
    Thanks,
    Greg
  • llandale
    llandale
    2986 Posts

    Re: oleActivate for attributes not working

    ‏2013-02-22T18:06:53Z  
    Thanks Louie - More clues!
    Mathias program works for me, run it all day long and it keeps making a new object and activating the paint application. However, I did notice that the new objects were all considered headings and not text. So, to make another experiment, I added the line o."Object Text" = "Make it a text object" to Mathias's code just before inserting the ole into o."Blah". Once I did this, the activate command stopped working. So it seems that the command only listens to object headings and not object text. To verify this, I changed my line to o."Object Heading" = "Make it a heading object". This now again activates the paint application.

    Finally, I wondered how that worked with my previous clue of activating when there is an ole in the main column. So I again changed the line to o."Object Text" = richText bufOle and ran it again. This also runs and activates the application.

    So, it appears like the oleActivate(o, column 0, 0) only works if the object is a heading, or the object has another ole in the object text attribute.

    I truly think this is a dxl bug now. However, since I am way less experienced than many of the people in this forum, I would like to get concurrence. Any help in how to work around this would also be greatly appreciated.

    As always, your help is greatly appreciated!!
    Thanks,
    Greg
    The difference between the following is sadly subjective and fluid:
    • bug
    • unintended feature
    • intended feature

    -Louie
  • Mathias Mamsch
    Mathias Mamsch
    1984 Posts

    Re: oleActivate for attributes not working

    ‏2013-02-24T14:56:40Z  
    Thanks Louie - More clues!
    Mathias program works for me, run it all day long and it keeps making a new object and activating the paint application. However, I did notice that the new objects were all considered headings and not text. So, to make another experiment, I added the line o."Object Text" = "Make it a text object" to Mathias's code just before inserting the ole into o."Blah". Once I did this, the activate command stopped working. So it seems that the command only listens to object headings and not object text. To verify this, I changed my line to o."Object Heading" = "Make it a heading object". This now again activates the paint application.

    Finally, I wondered how that worked with my previous clue of activating when there is an ole in the main column. So I again changed the line to o."Object Text" = richText bufOle and ran it again. This also runs and activates the application.

    So, it appears like the oleActivate(o, column 0, 0) only works if the object is a heading, or the object has another ole in the object text attribute.

    I truly think this is a dxl bug now. However, since I am way less experienced than many of the people in this forum, I would like to get concurrence. Any help in how to work around this would also be greatly appreciated.

    As always, your help is greatly appreciated!!
    Thanks,
    Greg
    If I put -1 for the oleIndex Parameter it works again ;-) At least when there is max. 1 OLE in the attribute. It still works if Object Text and the attribute contain an OLE. So maybe the oleIndex must only be used, when there is more than one OLE object in the attribute.

    Regards, Mathias

    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: oleActivate for attributes not working

    ‏2013-02-25T23:22:52Z  
    Greetings Louie and Mathias and thank you for the replies.
    I understand that it might be considered something other than a bug and may only be "missing a little documentation clarification". Really just trying to nail down what the issue is and the symptoms.
    In my investigation, I did a check of any parameter index from 0 to 100. Didn't think about using -1 so kudos to you! When I use the test script with the -1, I get an error message of "Unable to acquire POLEOBJ or POLESITE". However, in my module, I have text before the OLE. If I remove the text, then the -1 index will activate the OLE. Any suggestions on what to use to activate it with text? The devil is sooooo into the details.

    On Satuday I generated a script to see if I could activate it without using the oleActivate command. I copied the OLE to the clipboard, was able to launch the application and pastespecial the OLE into the spreadsheet. However, it pastes it in as an OLE instead of data. So the Find function still didn't find the text. Aaarrruugh.

    Do you know how to get OLE data into the application without it being pasted as an OLE?

    Much appreciate all the help,
    Greg
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: oleActivate for attributes not working

    ‏2013-02-25T23:28:08Z  
    Oh, -1 works if there is text after the OLE, but not before.
  • llandale
    llandale
    2986 Posts

    Re: oleActivate for attributes not working

    ‏2013-02-26T20:40:46Z  
    Greetings Louie and Mathias and thank you for the replies.
    I understand that it might be considered something other than a bug and may only be "missing a little documentation clarification". Really just trying to nail down what the issue is and the symptoms.
    In my investigation, I did a check of any parameter index from 0 to 100. Didn't think about using -1 so kudos to you! When I use the test script with the -1, I get an error message of "Unable to acquire POLEOBJ or POLESITE". However, in my module, I have text before the OLE. If I remove the text, then the -1 index will activate the OLE. Any suggestions on what to use to activate it with text? The devil is sooooo into the details.

    On Satuday I generated a script to see if I could activate it without using the oleActivate command. I copied the OLE to the clipboard, was able to launch the application and pastespecial the OLE into the spreadsheet. However, it pastes it in as an OLE instead of data. So the Find function still didn't find the text. Aaarrruugh.

    Do you know how to get OLE data into the application without it being pasted as an OLE?

    Much appreciate all the help,
    Greg
    Don't know, but I would try Paste-Special of some raw-text format.

    You could get really carried away and save it into some temp file, then do this:
    • system(MyAppName.exe NameTempFile)

    -Louie
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: oleActivate for attributes not working

    ‏2013-02-28T00:57:56Z  
    Greetings Louie and Mathias and thank you for the replies.
    I understand that it might be considered something other than a bug and may only be "missing a little documentation clarification". Really just trying to nail down what the issue is and the symptoms.
    In my investigation, I did a check of any parameter index from 0 to 100. Didn't think about using -1 so kudos to you! When I use the test script with the -1, I get an error message of "Unable to acquire POLEOBJ or POLESITE". However, in my module, I have text before the OLE. If I remove the text, then the -1 index will activate the OLE. Any suggestions on what to use to activate it with text? The devil is sooooo into the details.

    On Satuday I generated a script to see if I could activate it without using the oleActivate command. I copied the OLE to the clipboard, was able to launch the application and pastespecial the OLE into the spreadsheet. However, it pastes it in as an OLE instead of data. So the Find function still didn't find the text. Aaarrruugh.

    Do you know how to get OLE data into the application without it being pasted as an OLE?

    Much appreciate all the help,
    Greg

    I figured out the solution!!

    If you use oleActivate() it will activate the OLE object inside of DOORS

    oleActivate(o, c, 0)  // activates the OLE in DOORS
    

     


    If you use oleOpen() it will activate the OLE object in its own application

     

     

    oleOpen(o, c, 0)  // activates the OLE in Excel   <-- solution!!!
    



    The DXL Reference Manual does not have oleOpen so I just gave it a wack and it worked :-) I used the same parameters as oleActivate()

    Zak



     

    Updated on 2014-01-06T23:14:38Z at 2014-01-06T23:14:38Z by iron-man
  • GregM_dxler
    GregM_dxler
    166 Posts

    Re: oleActivate for attributes not working

    ‏2013-04-15T21:48:24Z  

    Just to wrap up this thread.  After mulling it over, I decided to have our support team enter in a support request to IBM.   The response:

    Our Dev team has determined that this is a defect. It has been logged as
    APAR (PM86554). You will be notified when a fix becomes available.

    Greg