I'm trying to make a user configurable shortcut. I was able to create one that allows the user to drag and drop a file or program onto the shortcut (which is displayed as text), and then rename the display text to whatever they want. The dropped files are stored in PersistStorage, the extension of the file is checked, and later the filepath is called on when it's time to run the file.
The problem:
I can execute executables but I have to go through a security check everytime I want to run a non-executable (e.g., folders, files, documents). Windows treats it as though I were downloading something from the internet and pops up the dialog box asking to 'Open' 'Save' or 'Cancel'. So, everytime I click on my shortcut to run a non-executable I then have to click 'Open' in the pop up dialog box.
The goal:
To click once on my shortcut and have both executables and non-executables run smoothly without the security pop up.
I hope that's understandable. Can anyone help me out?!
Here's the code:
'Runs an executable
Function RunExe
Set Sh = CreateObject("WScript.Shell")
Sh.Exec(Object.PersistStorage("target"))
Set Sh = Nothing
End Function
'Runs a non-executable
Function RunNonExe
If Object.state <> "Not" Then
Set Sh = CreateObject("WScript.Shell")
Filepath = (Object.PersistStorage("target"))
Sh.Run"Explorer.exe " & Filepath
Set Sh = Nothing
End If
End Function
Thank you.