Link to home
Start Free TrialLog in
Avatar of hasnut
hasnut

asked on

Browse for File Dialog Box

hi,

is there a "Browse for File Dialog Box" similar to "Browse for Folder Dialog
Box" in vbs.

i havent found something in microsofts scripthelp

thanks for help

for more details

https://www.experts-exchange.com/questions/20926583/VBSCRIPT-something-link-BrowseForFile-as-BrowseForFolder.html

If I got the right answer then you will get total 600
Avatar of sajuks
sajuks

// browse for folder script. browse for file, havent seenn one yet
<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
  function fnGetMyPathJ()
  {            
    var oShell = new ActiveXObject("Shell.Application");
                      
    var oFolder = new Object;                              
    oFolder = oShell.BrowseForFolder(0, "Choose a folder", 0);
                                        
    var oFolderItem = new Object;            
    oFolderItem = oFolder.Items().Item();                                                
   
    document.all.item("myPath").innerText = oFolderItem.Path;
  }    
-->
</SCRIPT>


<SCRIPT LANGUAGE="VBScript">
<!--
  function fnGetMyPathVB()
    dim oShell
    dim oFolder
    dim oFolderItem
            
    set oShell = CreateObject("Shell.Application")            
    set oFolder = oShell.BrowseForFolder(0, "Choose a Folder", 0)                    
    set oFolderItem = oFolder.Items.Item            
            
    document.all.item("myPath").innerText = oFolderItem.Path                                
  end function
-->
</SCRIPT>


</head>

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<INPUT type="button" value="VB" id=button2 name=button2 onClick=fnGetMyPathVB()>
<INPUT type="button" value="JSC" id=button2 name=button2 onClick=fnGetMyPathJ()>

<INPUT type="text" name = "myPath">

</body>

</html>
Most Activex security settings dont allow this to run

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<script language="JavaScript">
/* File browser (c) 2000 Michel pLungjan */
function goFish(theForm) {
if ( navigator.appName == 'Netscape' && theForm.url.value.indexOf("://",0) == -1 )
  window.open('file://' + theForm.theFile.value, '_self');
else
  window.open(theForm.theFile.value, '_self');
}
</script>
<form NAME="myForm" onSubmit="goFish(this); return false">
<input TYPE="file" NAME="theFile" VALUE size="40">
<input TYPE="submit" VALUE="Go"
</form>



</HTML>
Avatar of hasnut

ASKER

Hi sajuks,
your first examle only select folder not file,  I need first example that can do both,

You can also give me example dom level that only IE6(not sure) can do.

If you see my other link that I mentioned you will get that same example with folder.


any Ideas?
ASKER CERTIFIED SOLUTION
Avatar of sajuks
sajuks

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial