UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Finding Users Desktop Path, Access 2010    
 
   
Alexander
post Dec 5 2017, 08:50 AM
Post#1



Posts: 3,372
Joined: 30-December 03
From: Glasgow, Scotland


I have searched and read quite a bit about finding a users path to their Desktop or Documents.

I have been used to placing my applications on a users Desktop simply because most of my users have no real understanding of Directories and paths (with respect to any of my users reading this but it seems finding files can be tricky for lots of computer users, in my experience). I also use the Desktop as I can set this as a trusted location but again need the path.

Does any UA member have a simple way to find out the path using say a file that can be emailed to a user and for them to simply run it to produce the required path they can copy and email back to me?

I am sure other come up against this issue but maybe there are other ways around this.

Any help appreciated.


--------------------
Alexander
Keep using the sunscreen!
Go to the top of the page
 
GroverParkGeorge
post Dec 5 2017, 09:05 AM
Post#2


UA Admin
Posts: 31,223
Joined: 20-June 02
From: Newcastle, WA


It may vary depending on the OS, Win7, Win8X, Win10.

What do your users have?

--------------------
Go to the top of the page
 
Alexander
post Dec 5 2017, 09:14 AM
Post#3



Posts: 3,372
Joined: 30-December 03
From: Glasgow, Scotland


Thanks George ... the majority are now on Windows 10.

--------------------
Alexander
Keep using the sunscreen!
Go to the top of the page
 
theDBguy
post Dec 5 2017, 11:05 AM
Post#4


Access Wiki and Forums Moderator
Posts: 71,229
Joined: 19-June 07
From: SunnySandyEggo


Hi Alexander,

The following works in Win7. I hope it works for Win10 too.

CODE
Public Function getDesktopPath() As String
Dim sh As Object

Set sh = CreateObject("WScript.Shell")

getDesktopPath = sh.SpecialFolders("Desktop")

Set sh = Nothing

End Function

Cheers!

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
GroverParkGeorge
post Dec 5 2017, 11:08 AM
Post#5


UA Admin
Posts: 31,223
Joined: 20-June 02
From: Newcastle, WA


Thanks.

I was searching for a reference to all of the special folders in case you might want to place your application accdb files elsewhere, but this works.

--------------------
Go to the top of the page
 
theDBguy
post Dec 5 2017, 11:10 AM
Post#6


Access Wiki and Forums Moderator
Posts: 71,229
Joined: 19-June 07
From: SunnySandyEggo


Hi George,

How about this reference?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
GroverParkGeorge
post Dec 5 2017, 11:32 AM
Post#7


UA Admin
Posts: 31,223
Joined: 20-June 02
From: Newcastle, WA


That's the one. For some reason my search skills are no good today. I'll bookmark that.

--------------------
Go to the top of the page
 
Alexander
post Dec 5 2017, 12:56 PM
Post#8



Posts: 3,372
Joined: 30-December 03
From: Glasgow, Scotland


Many thanks DBguy and George

Do I run this as a standalone file? (say the user does not have Access and I am trying to find their Desktop path before getting them to install the Runtime and then the application).


--------------------
Alexander
Keep using the sunscreen!
Go to the top of the page
 
theDBguy
post Dec 5 2017, 02:02 PM
Post#9


Access Wiki and Forums Moderator
Posts: 71,229
Joined: 19-June 07
From: SunnySandyEggo


Hi Alexander,

I gave you a VBA example. If the user does not have Access installed, you might have to use a script file instead.

However, what is the purpose of finding the user's Desktop location prior to installation? You should be able to install the app on the user's desktop without knowing the location beforehand. During the install process, you can query the computer for the path and then install the app there.

Just curious...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
Alexander
post Dec 5 2017, 03:17 PM
Post#10



Posts: 3,372
Joined: 30-December 03
From: Glasgow, Scotland


That's interesting for me DBguy. No problem in answering that one.

I had asked a user to install the Runtime version because they had no Office package and asked him to place my application on the desktop.

Of course it then gave a security warning as the trusted location was not set up.

If I had known the users Desktop path I could have ensured the trusted location was set up prior to installation.

Thank you for the VBA example which I did save as a .vbs and when you simply double click this you get the desktop location so if I sent this to my user he/she would be able to tell me the desktop path.

You commented as follows "You should be able to install the app on the user's desktop without knowing the location beforehand. During the install process, you can query the computer for the path and then install the app there"

That is exactly what I need to work on and find a way to do this in as seamless a way as possible.

Thanks as always for your help.

--------------------
Alexander
Keep using the sunscreen!
Go to the top of the page
 
Scott McDaniel
post Dec 5 2017, 08:56 PM
Post#11


UtterAccess VIP
Posts: 588
Joined: 18-February 09
From: North Augusta, SC


Also, if you have installation requirements beyond a simple copy/paste, you might consider using a Windows Installer tool to create your installation packages. Inno Setup is a good one (and it's free), but there are plenty out there. I use Advanced Installer, which also has a very nice free version as well.

With a Windows installer, you can easily get environment variables like the user's Document folder, Desktop, etc. You can then run code in the installer to do things like add a Trusted Location (it's nothing more than adding registry keys), creating shortcuts.

Remember that your user's first impression of your program is the installation ...

--------------------
Go to the top of the page
 
Alexander
post Dec 6 2017, 04:33 AM
Post#12



Posts: 3,372
Joined: 30-December 03
From: Glasgow, Scotland


Nice of you Scott to help me understand this process.

I agree 100% that the installation is very important and something I have fallen down on as mostly my users have to manually install and of course some make a mess of even simple step by step instructions so anything that makes it automatic would be of great benefit.

Unless I can see examples of a typical installation I will need time to study this and I will now look at the two installers you quoted to see if I can find an example of an install that can install into a users desktop and set the trusted location as well.

Thanks again.

--------------------
Alexander
Keep using the sunscreen!
Go to the top of the page
 
Scott McDaniel
post Dec 6 2017, 05:43 AM
Post#13


UtterAccess VIP
Posts: 588
Joined: 18-February 09
From: North Augusta, SC


There are others too. Some use SSE: http://www.ssesetup.com/. I've never used that myself, but I know of a few MVPs who use that one.

Note none of these are automatic - that is, they will not query your Access app to determine which references to include, what prerequisites to enforce, etc etc. That's on you to do. Nor will they install the Runtime, if needed (although you can include it as a Merge Module, but that would make your installer enormous). You can have a prerequisite check for the Access Runtime, and alert the user if they need to install (and in many cases, download and begin the install).


--------------------
Go to the top of the page
 
Alexander
post Dec 6 2017, 05:54 AM
Post#14



Posts: 3,372
Joined: 30-December 03
From: Glasgow, Scotland


Many thanks Scott for the follow up

I know it will be trial and error on my part and agree not a good idea to include the runtime in any installation as too large.

I need to do a lot of searching today to see if I can find some basic stuff for automatically installing my application on a users desktop and at the same time setting up a trusted location on the desktop.

Thanks again

--------------------
Alexander
Keep using the sunscreen!
Go to the top of the page
 
jleach
post Dec 6 2017, 07:16 AM
Post#15


UtterAccess Editor
Posts: 9,810
Joined: 7-December 09
From: Staten Island, NY, USA


If you're going to use an installer (which I too recommend: I use Inno, but there is a learning curve), you might as well put the application in a more reasonable location. Compared to the rest of the complexity of a robust installer, adding a shortcut to the desktop is trivial.

Typically I'll place the FE in the %appdata%/local folder. You can create a shortcut by determining the Access executable location and passing the full path of your FE to it.

This whole task is immensely easier if you know the exact version of Access that you're running: MS has made a real mess of installation details with CTR in recent years.

Cheers,

--------------------
Go to the top of the page
 
Alexander
post Dec 6 2017, 07:28 AM
Post#16



Posts: 3,372
Joined: 30-December 03
From: Glasgow, Scotland


Many thanks Jack

I did wonder if the Desktop was a suitable location but my users can at least find the desktop !!!!

I only have two versions .. the full 2010 or the 2013 runtime.

I am searching now for examples of the inno installer.

Your comment "Typically I'll place the FE in the %appdata%/local folder. You can create a shortcut by determining the Access executable location and passing the full path of your FE to it" is beyond me at the moment but I will keep at it.

Thanks

--------------------
Alexander
Keep using the sunscreen!
Go to the top of the page
 
Scott McDaniel
post Dec 6 2017, 08:19 AM
Post#17


UtterAccess VIP
Posts: 588
Joined: 18-February 09
From: North Augusta, SC


The desktop would work, but you'd be better off putting it somewhere else, as Jack suggested. You could also drop it in a subfolder of the user's Documents folder.

If you're dealing with tightly secured machines (i.e. UAC) be sure to thoroughly test the application in whatever location you end up placing it. I've had issues where I tested with an app in certain locations that were more tightly locked down than I anticipated, and I had to make changes on the fly (which is never fun).

--------------------
Go to the top of the page
 
Alexander
post Dec 6 2017, 08:34 AM
Post#18



Posts: 3,372
Joined: 30-December 03
From: Glasgow, Scotland


Thanks Scott ... good to know.

--------------------
Alexander
Keep using the sunscreen!
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    15th December 2017 - 09:06 AM