oldeast Active Member Licensed User Longtime User May 22, 2019 #1 My new laptop, Win 10 now names the user folder with the first 5 letters of the email address so it does not match the user name and the program crashes. Code: Copy Dim username As String = GetSystemProperty("user.name", "default") Log(username) fc.Initialize fc.InitialDirectory ="C:\Users\" &username &"\Desktop" ' Set starting folder so is it possible to look up the user folder name, rather than the user name.. thanks
My new laptop, Win 10 now names the user folder with the first 5 letters of the email address so it does not match the user name and the program crashes. Code: Copy Dim username As String = GetSystemProperty("user.name", "default") Log(username) fc.Initialize fc.InitialDirectory ="C:\Users\" &username &"\Desktop" ' Set starting folder so is it possible to look up the user folder name, rather than the user name.. thanks
Daestrum Expert Licensed User Longtime User May 22, 2019 #2 Your code works fine here, it opens the filechooser pointing at the desktop folder. Upvote 0
oldeast Active Member Licensed User Longtime User May 23, 2019 #3 Yes it worked fine on my old laptop,because the user (account) name matches the user folder name, If you get a new computer Windows changed it so now the user name is not used for the user folder name , it uses the first five letter of your email address so the code fails. To make the code work I need to find the user folder name not the user name. Thanks Upvote 0
Yes it worked fine on my old laptop,because the user (account) name matches the user folder name, If you get a new computer Windows changed it so now the user name is not used for the user folder name , it uses the first five letter of your email address so the code fails. To make the code work I need to find the user folder name not the user name. Thanks
Erel B4X founder Staff member Licensed User Longtime User May 23, 2019 #4 1. Where is the error message? 2. What are you trying to do? Why do you need this specific folder? Upvote 0
oldeast Active Member Licensed User Longtime User May 23, 2019 #5 Thaks Erel, I wanted to start the browse on the desktop to assist the user.. After the user.name didn't match the named folder C:/user/username its stopped working. I fixed it by creating a new user. Thanks Upvote 0
Thaks Erel, I wanted to start the browse on the desktop to assist the user.. After the user.name didn't match the named folder C:/user/username its stopped working. I fixed it by creating a new user. Thanks
DarkMann Member Licensed User Longtime User May 23, 2019 #6 Just a quick thought to throw a spanner in the machine. Windows doesn't maintain the link between the user's chosen username - as displayed when the log on - and the name of the folder. When you first create a Local account, the folder name will probably be the same as the username. If the user subsequently changes their username, then the folder will not change and they won't match. If you start from a Microsoft account login, then this will be something similar to what you describe - part of the account name (email address) will be used to create the folder name and this also will then never change. If you want to access the Desktop of the current user then you'll need to start from the %HOMEPATH% system variable in windows. David Upvote 0
Just a quick thought to throw a spanner in the machine. Windows doesn't maintain the link between the user's chosen username - as displayed when the log on - and the name of the folder. When you first create a Local account, the folder name will probably be the same as the username. If the user subsequently changes their username, then the folder will not change and they won't match. If you start from a Microsoft account login, then this will be something similar to what you describe - part of the account name (email address) will be used to create the folder name and this also will then never change. If you want to access the Desktop of the current user then you'll need to start from the %HOMEPATH% system variable in windows. David
oldeast Active Member Licensed User Longtime User May 23, 2019 #7 Thanks David, that's what i want to do, so if a user changes an account name the program won't be affected. I will use that solution in the distributed version. Graham Upvote 0
Thanks David, that's what i want to do, so if a user changes an account name the program won't be affected. I will use that solution in the distributed version. Graham
S sorex Expert Licensed User Longtime User May 23, 2019 #8 %userprofile% is actually the right one. %homepath% will fail when you don't run the jar file on the system drive. type SET in a dosbox for all the stuff you can access. some extra things can be fetched via vbscript. Upvote 0
%userprofile% is actually the right one. %homepath% will fail when you don't run the jar file on the system drive. type SET in a dosbox for all the stuff you can access. some extra things can be fetched via vbscript.
oldeast Active Member Licensed User Longtime User May 23, 2019 #9 thanks Sorex, ..i will try to use that ..can you give me a heads up on using it in fie chooser please Upvote 0
thanks Sorex, ..i will try to use that ..can you give me a heads up on using it in fie chooser please
S sorex Expert Licensed User Longtime User May 23, 2019 #10 this seems to work Code: Copy Log( GetSystemProperty("user.home", "c:\") ) which reads out that user profile variable Upvote 0
this seems to work Code: Copy Log( GetSystemProperty("user.home", "c:\") ) which reads out that user profile variable
oldeast Active Member Licensed User Longtime User May 23, 2019 #11 thanks, much appreciated.. Graham Upvote 0