Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    Jun 2001
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    API from Windows Script?

    I'm using Windows Script Host as, basically, a batch file processor. The little programs are stand-alone, and don't run in a browser. VBScript under WSH is much better than DOS's batch file facility. But I'd like to use a Windows FileOpenSave dialog facility, rather than type in a long file path and probably mess it up. Is there any way to declare Windows API's like this for use by a pure VBScript program running under WSH (as opposed to one living in a web page)?

    Jim Beard

  2. #2
    5 Star Lounger
    Join Date
    Dec 2002
    Location
    Perth, Western Australia, Australia
    Posts
    730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: API from Windows Script?

    If you don't get a solution for a direct API call, you might be able to concoct something with AutoIt, or more specifically with AutoItX:
    <hr>There is also an ActiveX control version of AutoIt called AutoItX. This is a stand alone control that can be used to great effect under other scripting languages such as WSH/VBScript.<hr>
    I haven't used the ActiveX version, but the "FileSelectFile" command in standard AutoIt brings up the standard windows file selection dialog, which sounds like what you're after.
    <font face="Comic Sans MS" color="blue">TimOz</font>
    <img src=/S/flags/Finland.gif border=0 alt=Finland width=30 height=18> <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: API from Windows Script?

    Someone (Andrew?) recently posted a little hack for using the SHBrowseForFolder API call from a VBScript file. This doesn't let you name a file, it just literally lets you drill down through folders to set the path. Whether this extends to other APIs, I'm not sure.

  4. #4
    New Lounger
    Join Date
    Jun 2001
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: API from Windows Script?

    I never was able to find the posting referred to. (Searching on the API call name was fruitless, and unfortunately I don't know who Andrew is.)

    I did find it possible to use drag-and-drop for the purpose. That is, I can use Explorer to locate the file I want to perform the script actions on, and drag and drop it onto the VBscript file's icon. I'd still be very interested to know how some API's might be called.

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: API from Windows Script?

    Fruit: <post#=179268>post 179268</post#>

  6. #6
    New Lounger
    Join Date
    Jun 2001
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: API from Windows Script?

    Thanks, Jefferson. I'm chagrined that I spent most of an hour searching through the vbscript and WSH documentation trying to find such a thing (shellObject.BrowseForFolder), and Andrew's code clearly indicates that it exists.

  7. #7
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Phoenix, Arizona, USA
    Posts
    265
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: API from Windows Script?

    I have found this site to be helpful, especially their API Guide.
    Ed
    "Somebody left the cork out of my lunch." - W. C. Fields

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •