Hey, I'm looking for a way to create a browse button on a web page so it
brings up something like the browseforfolder method in shell.application. I
can't seem to get this to work since I guess shell.application is locked from
scripting on a web page. If I try to use it I get permission denied. Can
anyone assist?

Re: Create a browse button on web page by McKirahan

McKirahan
Mon Feb 21 16:26:18 CST 2005

"Steve" <Steve@discussions.microsoft.com> wrote in message
news:F080492E-2E2E-4666-948C-1B0781B92C0E@microsoft.com...
> Hey, I'm looking for a way to create a browse button on a web page so it
> brings up something like the browseforfolder method in shell.application.
I
> can't seem to get this to work since I guess shell.application is locked
from
> scripting on a web page. If I try to use it I get permission denied. Can
> anyone assist?

AFAIK, BrowseForFolder requires a license.

What are the details of your purpose?

Why does this need to be done within a Web page?


Under how many different Subjects are you going to post your question?
1) Browse for folder in HTML
2) Browse button in HTML using VBScript
3) Create a browse button on web page
All within less than six hours! Be patient.



Re: Create a browse button on web page by Steve

Steve
Mon Feb 21 16:47:04 CST 2005

Sorry about the other posts, this is the only one I can see for some reason.

I'm trying to give the user the option to browse to a folder and bring back
the folder path into a text box so they don't have to type it in manually.

I guess it doesn't need to be in the form of a web page, but it's the only
thing I could come up with that is "free". There are a lot of other input
items on the page that the user needs to be able to choose from before
clicking "submit".

"McKirahan" wrote:

> "Steve" <Steve@discussions.microsoft.com> wrote in message
> news:F080492E-2E2E-4666-948C-1B0781B92C0E@microsoft.com...
> > Hey, I'm looking for a way to create a browse button on a web page so it
> > brings up something like the browseforfolder method in shell.application.
> I
> > can't seem to get this to work since I guess shell.application is locked
> from
> > scripting on a web page. If I try to use it I get permission denied. Can
> > anyone assist?
>
> AFAIK, BrowseForFolder requires a license.
>
> What are the details of your purpose?
>
> Why does this need to be done within a Web page?
>
>
> Under how many different Subjects are you going to post your question?
> 1) Browse for folder in HTML
> 2) Browse button in HTML using VBScript
> 3) Create a browse button on web page
> All within less than six hours! Be patient.
>
>
>

Re: Create a browse button on web page by McKirahan

McKirahan
Mon Feb 21 16:54:46 CST 2005

"Steve" <Steve@discussions.microsoft.com> wrote in message
news:E953A234-B264-4B5A-8C89-AAEAF4CAE551@microsoft.com...
> Sorry about the other posts, this is the only one I can see for some
reason.
>
> I'm trying to give the user the option to browse to a folder and bring
back
> the folder path into a text box so they don't have to type it in manually.
>
> I guess it doesn't need to be in the form of a web page, but it's the only
> thing I could come up with that is "free". There are a lot of other input
> items on the page that the user needs to be able to choose from before
> clicking "submit".

[snip]

Try this "as-is"; watch for word-wrap.

<html>
<head>
<title>BFF.htm</title>
<script type="text/vbscript">
Sub BrowseForFolder(sBFF,sPMT)
Dim objSHL
Set objSHL = CreateObject("Shell.Application")
Dim objBFF
'*
'On Error Resume Next
If sBFF = "Folder" Then
Set objBFF = objSHL.BrowseForFolder(&H0,sPMT,&H0031,&H0011)
document.formBFF.Folder.value =
objBFF.ParentFolder.ParseName(objBFF.Title).Path
Else
Set objBFF = objSHL.BrowseForFolder(&H0,sPMT,&H4031,&H0011)
document.formBFF.File.value =
objBFF.ParentFolder.ParseName(objBFF.Title).Path
End If
'*
Set objBFF = Nothing
Set objSHL = Nothing
End Sub
</script>
<style type="text/css">
body { font-family:Arial; font-size:9pt }
td { font-family:Arial; font-size:8pt }
th { font-family:Arial; font-size:8pt; font-weight:bold }
</style
</head>
<body>
<center>
<form name="formBFF">
<input type="button" value=" Browse For File "
onclick="Call BrowseForFolder('File','Browse for a File')">
<input type="text" name="File" size="50">
<br>
<input type="button" value="Browse For Folder"
onclick="Call BrowseForFolder('Folder','Browse for a Folder')">
<input type="text" name="Folder" size="50">
</form>
</center>
</body>
</html>

This works for me because I have Visual Studio installed.



Re: Create a browse button on web page by Steve

Steve
Mon Feb 21 17:11:03 CST 2005

Same error message: Permission Denied on this line:
Set objBFF = objSHL.BrowseForFolder(&H0,sPMT,&H0031,&H0011)

Is there a way to run a stand-alone script when you click on the Browse
button and return the value (path) to the web page? The script works on it's
own, just not in IE.

"McKirahan" wrote:

> "Steve" <Steve@discussions.microsoft.com> wrote in message
> news:E953A234-B264-4B5A-8C89-AAEAF4CAE551@microsoft.com...
> > Sorry about the other posts, this is the only one I can see for some
> reason.
> >
> > I'm trying to give the user the option to browse to a folder and bring
> back
> > the folder path into a text box so they don't have to type it in manually.
> >
> > I guess it doesn't need to be in the form of a web page, but it's the only
> > thing I could come up with that is "free". There are a lot of other input
> > items on the page that the user needs to be able to choose from before
> > clicking "submit".
>
> [snip]
>
> Try this "as-is"; watch for word-wrap.
>
> <html>
> <head>
> <title>BFF.htm</title>
> <script type="text/vbscript">
> Sub BrowseForFolder(sBFF,sPMT)
> Dim objSHL
> Set objSHL = CreateObject("Shell.Application")
> Dim objBFF
> '*
> 'On Error Resume Next
> If sBFF = "Folder" Then
> Set objBFF = objSHL.BrowseForFolder(&H0,sPMT,&H0031,&H0011)
> document.formBFF.Folder.value =
> objBFF.ParentFolder.ParseName(objBFF.Title).Path
> Else
> Set objBFF = objSHL.BrowseForFolder(&H0,sPMT,&H4031,&H0011)
> document.formBFF.File.value =
> objBFF.ParentFolder.ParseName(objBFF.Title).Path
> End If
> '*
> Set objBFF = Nothing
> Set objSHL = Nothing
> End Sub
> </script>
> <style type="text/css">
> body { font-family:Arial; font-size:9pt }
> td { font-family:Arial; font-size:8pt }
> th { font-family:Arial; font-size:8pt; font-weight:bold }
> </style
> </head>
> <body>
> <center>
> <form name="formBFF">
> <input type="button" value=" Browse For File "
> onclick="Call BrowseForFolder('File','Browse for a File')">
> <input type="text" name="File" size="50">
> <br>
> <input type="button" value="Browse For Folder"
> onclick="Call BrowseForFolder('Folder','Browse for a Folder')">
> <input type="text" name="Folder" size="50">
> </form>
> </center>
> </body>
> </html>
>
> This works for me because I have Visual Studio installed.
>
>
>

Re: Create a browse button on web page by Michael

Michael
Mon Feb 21 17:30:16 CST 2005

Steve wrote:
> Same error message: Permission Denied on this line:
> Set objBFF = objSHL.BrowseForFolder(&H0,sPMT,&H0031,&H0011)


Because its use is unsafe in the browser context.


--
Michael Harris
Microsoft MVP Scripting
http://maps.google.com/maps?q=Sammamish%20WA%20US



Re: Create a browse button on web page by Steve

Steve
Tue Feb 22 10:53:03 CST 2005

If it's unsafe then it should at least bring up a message prompting you if
you want to run it or not.

How else can I do this then?


"Michael Harris (MVP)" wrote:

> Steve wrote:
> > Same error message: Permission Denied on this line:
> > Set objBFF = objSHL.BrowseForFolder(&H0,sPMT,&H0031,&H0011)
>
>
> Because its use is unsafe in the browser context.
>
>
> --
> Michael Harris
> Microsoft MVP Scripting
> http://maps.google.com/maps?q=Sammamish%20WA%20US
>
>
>

Re: Create a browse button on web page by Michael

Michael
Tue Feb 22 18:39:18 CST 2005

Steve wrote:
> If it's unsafe then it should at least bring up a message prompting
> you if you want to run it or not.
>
> How else can I do this then?

Design your web app as an HTA...

--
Michael Harris
Microsoft MVP Scripting
http://maps.google.com/maps?q=Sammamish%20WA%20US