Skip to main content
Mar 8, 2022 7:15 PM UTC
Solved

How to use Windows system token(variable) in mapkey for user id

Hi,

What's the proper way to use the windows system token(variable) for user id in a mapkey?
I would like to replace johndoe with windows %username% token.

I have tried $USER and $USERNAME with no success.
Could someone point me to the correct syntax for using a system variable in a mapkey? 

 

mapkey(continued) ~ Select `file_saveas` `ph_list.Filelist` 1 `c:`;\
mapkey(continued) ~ Activate `file_saveas` `ph_list.Filelist` 1 `c:`;\
mapkey(continued) ~ Select `file_saveas` `ph_list.Filelist` 1 `Users`;\
mapkey(continued) ~ Activate `file_saveas` `ph_list.Filelist` 1 `Users`;\
mapkey(continued) ~ Select `file_saveas` `ph_list.Filelist` 1 `johndoe`;\
mapkey(continued) ~ Activate `file_saveas` `ph_list.Filelist` 1 `johndoe`;\
mapkey(continued) ~ Select `file_saveas` `ph_list.Filelist` 1 `mydocs_pb`;\
mapkey(continued) ~ Activate `file_saveas` `ph_list.Filelist` 1 `mydocs_pb`;\

 

Thanks for any help you can provide,

Don A

Mar 8, 2022 7:29 PM UTC

Can you try $userprofile (%userprofile%)? We use this syntax in mapkeys and settings and it works well. Here's an old example of a model tree config path.

 

mdl_tree_cfg_file $USERPROFILE\Creo4\configs\tree.cfg - This points to C:\Users\Username\Creo4\configs

2 replies

Mar 8, 2022 7:29 PM UTC

Can you try $userprofile (%userprofile%)? We use this syntax in mapkeys and settings and it works well. Here's an old example of a model tree config path.

 

mdl_tree_cfg_file $USERPROFILE\Creo4\configs\tree.cfg - This points to C:\Users\Username\Creo4\configs

Mar 8, 2022 9:05 PM UTC

I was able to finally get it to work after doing the following:
Make sure not to navigate to a folder location but type in the full path to where you want to save or open something from!

You're file paths should look like the below text when viewing the mapkey in the config.pro file


mapkey(continued) ~ Input `file_saveas` `opt_EMBED_BROWSER_TB_SAB_LAYOUT` \
mapkey(continued) `C:\\Users\\$username\\Documents\\folder\\sub_folder\
mapkey(continued) ot_Delete`;\
mapkey(continued) ~ Update `file_saveas` `opt_EMBED_BROWSER_TB_SAB_LAYOUT` \
mapkey(continued) `C:\\Users\\$username\\Documents\\folder\\sub_folder\
mapkey(continued) ot_Delete`;~ Activate `file_saveas` `opt_EMBED_BROWSER_TB_SAB_LAYOUT`;\
mapkey(continued) ~ Activate `file_saveas` `OK`;~ Select `main_dlg_cur` `appl_casc`;\

danders238_1-1646773269301.png

My mapkeys now work 🙂
Thanks,

Don A