1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Function() to obtain a Disk File

Discussion in 'Software Development' started by dlipman, Mar 7, 2019.

  1. dlipman

    dlipman Thread Starter

    Joined:
    Feb 14, 2013
    Messages:
    373
    First Name:
    David
    I created the following KiXtart Function() to obtain a Disk File. It works but because I am using MSHTA the GUI defaults to displaying "Choose File to Upload" which belies the context in which I use it.

    Any alternate suggestions for a GUI function that obtains/selects a Disk File ?

    Code:
    Function SelectFile()
       Dim $objSHELLexec, $CMD, $objSHELL
       $SelectFile=""
       $CMD='mshta.exe "about:<input type=file id=FILE><script>FILE.click();new ActiveXObject("Scripting.FileSystemObject").GetStandardStream(1).WriteLine(FILE.value);close();resizeTo(0,0);</script>" '
       $objSHELL=CreateObject("WScript.Shell")
       $objSHELLexec=$objSHELL.Exec($CMD)
       $SelectFile=$objSHELLexec.StdOut.ReadLine()
    EndFunction
    
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Short URL to this thread: https://techguy.org/1224119

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice