* Create Individual Shortcut Plugin

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Create Individual Shortcut Plugin

Post by tatewise »

Jane, I have discovered a snag with this Plugin, associated with OneDrive, but also if Desktop is relocated by user.

A relatively new feature in OneDrive allows the Desktop to be saved.
This is done via OneDrive > Settings > Auto-save tab Update folders button.

But when enabled the default Desktop path changes from C:\Users\<username>\Desktop to C:\Users\<username>\OneDrive\Desktop or wherever OneDrive folder happens to be, and in any case a user can relocate their Desktop folder.

So the solution is to retrieve the Desktop path from the Windows Registry at:
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Desktop

So in Plugin use:
local filepath,err = getRegKey('HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\\Desktop').."\\"
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
Jane
Site Admin
Posts: 8508
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: Create Individual Shortcut Plugin

Post by Jane »

I used your example on my PC and it returned

%USERPROFILE%\Desktop\

which failed as a location to store files. I assume your PC is returning a full path?

Ok, I 'll try and look at some point, I don't use OneDrive as I wouldn't trust Microsoft's Cloud with anything important.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
User avatar
Jane
Site Admin
Posts: 8508
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: Create Individual Shortcut Plugin

Post by Jane »

This works on mine, does it work with one drive.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Create Individual Shortcut Plugin

Post by tatewise »

Yes, that works fine, and yes for me the Registry key returns a full path without %USERPROFILE%.

Note that this copes with any user who relocates their Desktop folder not just the OneDrive scenario.

Perhaps need to test err variable, as you do later for Get Path to FH.
But I guess Plugin would have to abort if the getRegKey(...) fails.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
Jane
Site Admin
Posts: 8508
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: Create Individual Shortcut Plugin

Post by Jane »

I have added just a check for fail and set the parameter to the default value if the key read fails.
Create Individual Shortcut.fh_lua
(8.44 KiB) Downloaded 158 times
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Create Individual Shortcut Plugin

Post by tatewise »

Looks good to me.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Post Reply