Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hello all,
First time poster here. Thanks for the supportive community.
I am trying to get the mapkeys that are being loaded in the current Pro/E session using Pro/TOOLKIT. Is that possible? Here is what I tried with no success:
ProName name( L" );
ProStringToWstring( name, "mapkey"/*"visible_mapkey"*/ );
ProPath * mapkeys;
ProError err = PRO_TK_NO_ERROR;
err = ProConfigoptArrayGet( name, & mapkeys );
If I tried to get 'value' associated with "visible_mapkey" I do get a valid value of "NO". If instead I try to get the value of "mapkey", I get NULL and a ProError of 'PRO_TK_E_NOT_FOUND'. Of course opening, PROE=>Tools=>Options does show me the "mapkey" entries (many of them).
Does Pro/TK provide a way to get the "mapkeys" that are listed in Tools=>Options?
Any suggestions/advice would be most appreciated.
Hi all,
No reason to bother with Pro/Toolkit functions. 'fgets' works just fine. Pro/E reads config files in theorder which is well documented. Just follow the same order and parse the plain text files...
HIH.
Feliks.
ThanksPatrick,
I was afraid of that.
Ganesh
Hi Feliks,
Just to confirm I understood your suggestion - are you suggesting that I open the config.pro file and read the 'mapkey' entries from it?
That would work, but would that not require the user to select the config.pro, or is there a way to get the active config.pro from the current Pro/E session?
Thanks
Ganesh
Hi Ganesh,
you know your current Pro-E Session and the path where the Pro-E works.
All other paths where the config.pro could be you can search too (Its sthe User path %home%, ... )
Another suggestion you can write out a file only with a mapkey per Mapkeys -> save Mapkeys -> All and then read the outcoming file. With this way you get the actual mapkeys thats in your Pro-E Session. You'll get also that one's that are created through API programms. Don't forget to wait on the mapkey end (Don't know if these mapkey end can be waited directly in Pro-E or if you need a workaround).
Best regards,
Eike
Hi all,
Ganesh,
This question - load config filesinto session, how, when, why, order of loading,directories to be searchedand so on -would be better answered by sysadmin group...
From customization standpointan appwould read/parse a trail file in order to extract names of configuration files loadedby a user while in active session. ProTrailfileCommentWritein conjunction withgetpid would ensure that an app reads the correct trail file in case whenmultiple sessions are running.For configuration files loaded by default an app would have to read those configuration files in the same orderas Pro/E session does ( config.sup in $PRO_INSTALL/text directory, config.pro in $PRO_INSTALL/text directory, config.pro in 'startup' directory, config.pro in $HOME directory and so on, consult documentation or sysadmins for an explanation). The rest is just an excercise of fopen-fgets-fclose.
Feliks.
In Reply to ganeshram iyer:
Hi Feliks,
Just to confirm I understood your suggestion - are you suggesting that I open the config.pro file and read the 'mapkey' entries from it?
That would work, but would that not require the user to select the config.pro, or is there a way to get the active config.pro from the current Pro/E session?
Thanks
Ganesh
Thanks Eike,
Your suggestion is one I am going to try. I was hoping this would be a simple task, but at least I get paid by the hour 🙂
Thanks
Ganesh
ThanksFeliks,
I have never played with trail files, so will need to spend some time with them. I am on Windows, so need to find out if getpid() works as your suggestion would need.
Thanks
Ganesh