• API from Windows Script?

    Home » Forums » AskWoody support » Windows » Windows – other » API from Windows Script?

    Author
    Topic
    #390268

    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

    Viewing 1 reply thread
    Author
    Replies
    • #692561

      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: [indent]


      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.


      [/indent] 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.

    • #692580

      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.

      • #773738

        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.

        • #773795

          Fruit: post 179268

          • #773975

            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.

            • #774505

              I have found this site to be helpful, especially their API Guide.

              The difference between Genius and Stupidity:
              A Genius knows their limits.
              - Albert Einstein

            • #774506

              I have found this site to be helpful, especially their API Guide.

              The difference between Genius and Stupidity:
              A Genius knows their limits.
              - Albert Einstein

          • #773976

            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.

        • #773796

          Fruit: post 179268

      • #773739

        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.

    Viewing 1 reply thread
    Reply To: API from Windows Script?

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: