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

Run Async Jlink App on CREO startup

SOLVED
hamzawaseem
5-Regular Member

Run Async Jlink App on CREO startup

Hi everyone,

 

I have successfully developed a jlink Async app for CREO, and it is working perfect. What I need is that whenever I start CREO Parametric the app should be started too. Currently, I need to run the app through Netbeans, and then CREO is started via the code.

So, is there any way I can register the async app globally so whenever CREO is started, my app is started along.
Please respond!


Thanks

Hamza
1 ACCEPTED SOLUTION

Accepted Solutions
hamzawaseem
5-Regular Member
(To:hamzawaseem)

Thank you everyone, your help directed me to optimum solution.

For starting my app I used "Parametric Start File" parametric.psf, placed this command at the end of file:

RUN="NameOfJarFile.jar"

Where jar file was placed in same folder as psf file.

 

For my other problem with connection, @sjuraj I used the connect method instead of start

pfcAsyncConnection.AsyncConnection_Connect(null, null, proETextPath, 1000);
connection = pfcAsyncConnection.AsyncConnection_GetActiveConnection();

Now it's all sorted out, thanks again!

Hamza

View solution in original post

6 REPLIES 6

You can create simple synchronou app which starts your async app or use os script in mapkey to start it. I suppose os script can be run in trail file as well. A trail file can be passed to creo as parameter while starting.

hamzawaseem
5-Regular Member
(To:sjuraj)

@sjuraj  Thanks for quick response, and yes I get your idea, now the problem is I start CREO from code, so I assume this will start another instance of CREO, here is the code

connection = pfcAsyncConnection.AsyncConnection_Start(proECommand, proETextPath);
connection.AddActionListener((AsyncActionListener) this);

curSession = connection.GetSession();
createMenuButtons();

Is there anyway I can connect to already opened CREO, so my ultimate goal would be,
User starts CREO from where ever, my async app is started along, and app connects to CREO. I hope that makes sense.
Thanks

Hamza
RPN
13-Aquamarine
13-Aquamarine
(To:hamzawaseem)

I really have no clue about your intention, just modify the psf file to start your Script, this will connect to the first session and later starts the second Session, or vice versa. It may required to make the session ID public, dependent on the order, not sure if the connect is smart enough to ignore his parent. I think you have to deal with this two handles. You may have fun with dead locks 😀, and you have 2 event loops.

from documentation:

 

AsyncConnection_ConnectById

 

static AsyncConnection AsyncConnection_ConnectById (ConnectionId Id, /*optional*/ String TextPath, /*optional*/ Integer TimeoutSec)



     Connects to a specific Creo Parametric session by passing the identification string.

The ID string for a given session can be obtained from AsyncConnection.GetConnectionId().

The application may only connect to one Creo Parametric session at any time.


Manual References:
Running J-Link Applications in Asynchronous Mode: Connecting Via Connection ID
Parameters:
Id
The connection id string previously obtained for the Creo Parametric session you wish to connect to.
TextPath
The path under which the message and menu files are held. If no external messaging or menus are needed pass null.
TimeoutSec
The time, in seconds, to wait for Creo Parametric to respond to the connection request. Pass null to use the default timeout.
Returns:
Object representing the asynchronous connection.

 

Connection ID can be extracted from Session object: BaseSession.GetConnectionId ()

You need to develop synchronous app. The app will be started with Creo. You can register the app in Creo using protk.dat file.

hamzawaseem
5-Regular Member
(To:hamzawaseem)

Thank you everyone, your help directed me to optimum solution.

For starting my app I used "Parametric Start File" parametric.psf, placed this command at the end of file:

RUN="NameOfJarFile.jar"

Where jar file was placed in same folder as psf file.

 

For my other problem with connection, @sjuraj I used the connect method instead of start

pfcAsyncConnection.AsyncConnection_Connect(null, null, proETextPath, 1000);
connection = pfcAsyncConnection.AsyncConnection_GetActiveConnection();

Now it's all sorted out, thanks again!

Hamza

View solution in original post

Announcements