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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Mapkey Logging

RossFulton
4-Participant

Mapkey Logging

Does anyone know of a clean way tolog the use of mapkeys? I would like to know if certain mapkeys are being used and how often.

The trail file does not necessarily capture the name of the mapkey depending on which method is used to initiate it (keyed in, menu/icon pick, Mapkey dialog box). I can add the @system to call out a batch file in each mapkey but that causes the system window to flash. It would be great to find a way that doesn't cause an additional window to flash or if there is an additional way to create logging somehow.


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
15 REPLIES 15
TomU
23-Emerald IV
(To:RossFulton)

PTC claims there is not. Key presses are not recorded to the trail file. I've been told there is no way to capture this with J-link or Toolkit either. Please let me know if you find an alternative method.

Tom Uminn
Systems Administrator
trans-matic Mfg.
616-820-2499
-<">mailto:->


You could record a Info -> Session Info -> Date and time into each
mapkey and then look for that. You'd still have to figure out what
mapkey was run.



I'd think running a batch file is a great idea, because then you could
run a specific batch file that outputs what mapkey was called into a log
file on your server, essentially building a database for you.



Doug Schaefer
--
Doug Schaefer | Experienced Mechanical Design Engineer
LinkedIn
TimKnier
4-Participant
(To:RossFulton)

Disable them. I'm sure the users will let you know.

Tim Knier
QG Product & Support Engineering
QuadTech
A Subsidiary of Quad/Graphics
Sussex, Wisconsin
414-566-7439 phone
-<">mailto:->
www.quadtechworld.com<">http://www.quadtechworld.com>

I've been there, done that.



Then, when they complain two years later that it's not there, I tell them
that it never was, and they were / are imagining things. If you haven't
needed it in the last two years, you don't need it today either.


Along a similar vein...


In the past when planning on a Pro/E upgrade, I would test all the mapkeys and delete any that were going to fail in the new version. When we rolled that version out, I'd play dumb when users asked why they weren't working any longer: "Huh. Must be because of the upgrade. Give me the details and I'll try to find time to recreate it."


Of the 10 or 12 mapkeys that got deleted, only two had to be recreated.



In Reply to Darrin Hiebert:


I've been there, done that.



Then, when they complain two years later that it's not there, I tell them
that it never was, and they were / are imagining things. If you haven't
needed it in the last two years, you don't need it today either.



Here is a simple example that I used a few years back. It records the user,
date and time the mapkey was launched. In this case it was part of a
larger batch file so there was no additional window that opened. It worked
great!


:: CREATE LOG FILE FOR TRACKING PURPOSES

SET UseLog=H:\CAx\PTC\custom\utility\Usage_Log.txt
IF EXIST %UseLog% GOTO LOG
:CREATE
ECHO B^&W PDF MAPKEY USAGE LOG > %UseLog%
ECHO USER ID,DATE,TIME >> %UseLog%
:LOG
ECHO %USERNAME%,%DATE%,%TIME% >> %UseLog%



Mike Phillips
Sr. Mechanical Systems Technologist
Network Centric Systems
Raytheon Company

+1 (972).344.4056 (office)
-

6620 Chase Oaks Blvd
Plano, TX 75023-2310
www.raytheon.com


This message contains information that may be confidential and privileged.
Unless you are the addressee (or authorized to receive mail for the
addressee), you should not use, copy or disclose to anyone this message or
any information contained in this message. If you have received this
message in error, please so advise the sender by reply e-mail and delete
this message. Thank you for your cooperation.



TomU
23-Emerald IV
(To:RossFulton)

How are you tying this into the mapkeys?
STEVEG
21-Topaz I
(To:RossFulton)

That's great.
Just testing it out and it works. All I did was add to the existing mapkey two lines after the label text portion. I always forget about the OS Script tab in mapkeys.

mapkey imaf @MAPKEY_NAMExxxxxxx @MAPKEY_LABELxxx;\
mapkey(continued) @SYSTEMSET UseLog=K:\\Standards\\Utilities\\pro_log\\Usage_Log.txt\nECHO \
mapkey(continued) \%USERNAME\%,\%DATE\%,\%TIME\%,imaf >> \%UseLog\%;\
mapkey(continued) ~ Command `ProCmdMmSetup` ;#MATERIAL;\

I would put the name of the mapkey in the second of the two added lines for each mapkey in the config.pro.

Depending on the amount of mapkeys there could be a lot of work to add the two lines manually.

Is there is a way to set it so, as Mike said, the mapkey does not open another window? The way I did it above opens a command prompt window. I don't think a batch file would work if you wanted to record the name of the mapkey. Any ideas?

Steve G


Just save the script in a batch file (.bat) and call that batch file from
within the mapkey. After the mapkey sequence completes, the batch file
runs and writes an entry to the log file.


Mike



On 01/12/12 15:30, Steve Galayda wrote:
>
> That's great.
>
> Just testing it out and it works. All I did was add to the existing mapkey two lines after the label text portion. I always forget about the OS
> Script tab in mapkeys.
>
> mapkey imaf @MAPKEY_NAMExxxxxxx @MAPKEY_LABELxxx;\
>
> *mapkey(continued) @SYSTEMSET UseLog=K:\Standards\Utilities\pro_log\Usage_Log.txt\nECHO \*
>
> *mapkey(continued) \%USERNAME\%,\%DATE\%,\%TIME\%,imaf >> \%UseLog\%;\*
>
> mapkey(continued) ~ Command `ProCmdMmSetup` ;#MATERIAL;\
>
> I would put the name of the mapkey in the second of the two added lines for each mapkey in the config.pro.
>
> Depending on the amount of mapkeys there could be a lot of work to add the two lines manually.
>
> Is there is a way to set it so, as Mike said, the mapkey does not open another window? The way I did it above opens a command prompt window. I
> don't think a batch file would work if you wanted to record the name of the mapkey. Any ideas?
>

Well if you were running on a unix platform the OS scripts do not open a terminal window so this kind of thing thing is trivial. For example the
following sh script:
----------------------------------------------------------------------------------
#!/bin/sh
#takes 1 argument = name of mapkey to log
#record the date [tab] login name [tab] name of mapkey

#define name of mapkeylog file to record to
#mapkeylog="someFilePathCouldBeNetworked"
mapkeylog="mapkeylog.txt"

echo "`date`\t$LOGNAME\t$1" >> $mapkeylog
----------------------------------------------------------------------------------

If saved to a file called log_mapkey.sh could be called in a mapkey like this:

mapkey xx @SYSTEMlog_mapkey.sh xx;\
do other mapkey stuff\
more mapkey stuff

If I was actually doing something like this for real I would create a jlink app that does the following:

1. Create a new menu selection in Pro/Engineer (ie MapKeyLogger)
2. when MapKeyLogger is selected it asks for a string (session.UIReadStringMessage(null)Smiley Wink
3. this string is then stored in a database (in my case I would use mysql) along with the users login name, timestamp, and any other pertinent
information. With jlink in the mix you could also get information such as the release and build code of the user's session of Pro/Engineer.

The purpose of this new menu selection is to be used in mapkeys. To use this functionality the above mapkey xx would be rewritten like this:

mapkey xx ~ Command `MapKeyLogger` ;xx;\
do other mapkey stuff\
more mapkey stuff

This operates "invisible" to the user and is platform independent.

> Steve G
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------
>
> *From:*Uminn, Tom [
>
> 6620 Chase Oaks Blvd
> Plano, TX 75023-2310_
> _www.raytheon.com

What if you create a seperate batch file containing the logging code then
call that file from the mapkey using the START command. This command has a
run minimized switch.


[ Taken from the START help file]
TomU
23-Emerald IV
(To:RossFulton)

You would still see a quick flash from the original system prompt. Using J-Link (as Steve wrote) would be much cleaner solution … if you’re using J-Link. We are not right now, so the next best solution seems to be to reduce the size of the initial system window before calling the start command to launch the actual logging script (with the /min switch). This way there is just a small flash in the corner instead of the entire screen. Here is what I came up with.

mapkey(continued) @SYSTEM\@echo off\nmode con:cols=15 lines=1\nstart /min \
mapkey(continued) c:\\ptc\\mapkeylog.bat mapkey_name;\

If someone wants to build a J-Link program, I’ll be more than willing to test it. ?

Tom Uminn
Systems Administrator
trans-matic Mfg.
616-820-2499
-<">mailto:->

STEVEG
21-Topaz I
(To:RossFulton)

Great idea but when the command prompt window starts it starts as the normal size. Then when it sees the mode con command the window changes size.

Plus the /MIN switch does not work in this situation for what ever reason.

Steve G
TomU
23-Emerald IV
(To:RossFulton)

It's working on my machine (Windows 7 - 64bit). I have not tried it on others. The first time it runs it flashes the whole screen. Every time after that it only flashes a small window. Here's a screen shot of the small window (pause was added so I could capture it).

[cid:image002.png@01CCD1E5.8587FEA0]

Tom U.
RossFulton
4-Participant
(To:RossFulton)

Thank you for the new ideas. I have some new options to start testing now. Good to see that this may help some others with similar aspirations.

Top Tags