Skip to main content
1-Visitor
January 12, 2012
Question

Mapkey Logging

  • January 12, 2012
  • 15 replies
  • 3008 views

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

23-Emerald IV
January 12, 2012
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:->


21-Topaz II
January 12, 2012
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
1-Visitor
January 12, 2012
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>
1-Visitor
January 12, 2012
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.


12-Amethyst
January 12, 2012

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.


12-Amethyst
January 12, 2012

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.



23-Emerald IV
January 12, 2012
How are you tying this into the mapkeys?
21-Topaz I
January 12, 2012
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
12-Amethyst
January 12, 2012

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



20-Turquoise
January 13, 2012
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