|
It is currently Tue Feb 07, 2012 8:57 pm
|
View unanswered posts | View active topics
| Welcome |
|
Welcome to RHAPSODY4YOU
You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, respond to polls, upload and download content, and access many other special features. Registration is fast, simple, and absolutely free, so please, register to join our community today. |
 |
|
 |
|
| Author |
Message |
|
Christian
|
Post subject: Send Feedback from Script to User Posted: Fri Aug 07, 2009 12:14 pm |
Joined: Tue Jul 14, 2009 9:21 am Posts: 22 Location: Germany
|
|
Hi,
as I now know how to do basic Rhapsody scripting using python I was wondering whether there is a way for the script to give feedback to the user. For example, I have a script that searches for elements in the model that match certain criteria. When it finds one, it highlights the element. If not, I would like to inform the user that no element could be found. -- How would this be achieved best? I imagined there would be the possibility to open a Rhapsody message box or to write something to the Rhapsody's log window -- but this seems not to be the case.
Thanks,
Christian
|
|
|
|
 |
|
che
|
Post subject: Posted: Mon Aug 10, 2009 6:09 am |
Joined: Tue Dec 04, 2007 3:25 pm Posts: 7 Location: Zürich
|
|
Hi Christian
I've attached a sample.
Highlighting elements:
Use the method of highLightElement() of IRPApplication
Message Box:
Use the Win32 API directly (win32ui.MessageBox)
Rhapsody's Log-window:
Use the method writeToOutputWindow() of IRPApplication. (If you are, unlike me, able to use Rhapsody >7.0)
Btw: I don't know the state in 7.5, but up to 7.3, writeToOutputWindow() is a undocumented Feature. It expects 2 strings as arguments. The first naming the specific output window ("Log", "Build", "Configuration Management" ...) and the second is the text you'd like to write.
Btw2: There are some more features not documented in the API help. So have a look in your <PyhtonInstallDir>\Lib\site-packages\win32com\gen_py. There you will find the a file named 47DBF9D5-F318-11D2-B825-00104B3E6572x0x1x0.py containing all interfaces from the Rhapsody API. And, as this file is generated from the typelib, its the most up to date ressource on the Rhapsody API.
Have Fun!
Christian
| Attachments: |
File comment: Example of giving user feedback from a python-RhapsodyAPI-script.
Seeks a class named 'MyClass' in the current project and, if successful, high lights it. If the class can't be found, some output is written to the log window and a message box is displaye
RhapsodyAPIDemo2.zip [597 Bytes]
Downloaded 29 times
|
_________________ "I love deadlines. I like the whooshing
sound they make as they fly by." - Douglas Adams
|
|
|
|
 |
|
Christian
|
Post subject: Posted: Mon Aug 10, 2009 7:01 am |
Joined: Tue Jul 14, 2009 9:21 am Posts: 22 Location: Germany
|
|
Hi Christian,
thanks again for your reply.
I'm using version 7.4 and writeToOutputWindow() still works. This is exactly what I was looking for. Strange though that it is still undocumented.
Looking at the generated python file will be of much value, too.
Thanks,
Christian
|
|
|
|
 |
|
|
 |
|
 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|