%userprofile% in keyboard shortcut?

Hi Everybody,

is there a way to make the following keyboard shortcut work without a script? Via scripting I know how to do it. Need it for a simple org. wide setup. %userprofile% is not resolved.

'_-New _Browse "%userprofile%\AppData\Roaming\McNeel\Rhinoceros\7.0\Localization\en-US\Template Files\Small Objects - Meters.3dm"

Thanks

This should work, I think, assuming all users have the default templates:

! _-New "Small Objects - Meters.3dm"

-Pascal

1 Like

Thanks Pascal, the template was just an example. The actual file I will have to use, will be in a sub folder of the users home folder.

Sounds like a good fit for a Python script

import System

print System.Environment.GetEnvironmentVariable("USERPROFILE")
1 Like

I guess the problem is New always brings you to the current template folder - if there is a different folder that you want to use, then users can set that folder as the template folder and -New Browse should go there, I’d think - but in a general way, I do not see how to do this in a macro - not that you can’t I just do not see it, yet at least.

-Pascal

1 Like

Hi Everybody,

thanks for the great support. I’ll make a Python command. That’s the easiest way to distribute since we have a Python based office plugin anyways.
@nathanletwory : Do you know if the following works cross platform?

import os
print(os.path.expanduser('~'))

Thanks again!

It looks like you need to handle it differently depending on the OS.

Python | os.path.expanduser() method - GeeksforGeeks.

-Pascal